Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 12:59, 28 November 2007.

How to Know Capability of an Application Dynamically

From Forum Nokia Wiki

The following code shows how to know the capabilities granted to your application Dynamically.

This code will get the current Process id and Checks if the process has a given capability using HasCapability(). When a check fails the action taken is determined by the system wide Platform Security configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. If PlatSecEnforcement is OFF, then this function will return ETrue even though the check failed.

#include <e32std.h>
 
void CCapability::ConstructL
{       
        .......
   	RProcess process(KCurrentProcessHandle);
   	process.Id().Id(); 
   	for(TInt i=0; i<ECapability_Limit; i++) 
   	{ 
      		DisplayCapaInfo(i, process.HasCapability( (TCapability)i) ); 
      	} 
}
void CCapability::DisplayCapaInfo(const TInt& capa, TBool enabled) 
{       
        TBuf<40> line1; 
        TBuf<40> line2; 
        switch (capa) 
	{       
                case ECapabilityTCB: 
                        line1.Copy(_L("TCB")); 
                        break; 
                case ECapabilityCommDD: 
                        line1.Copy(_L("CommDD")); 
                        break; 
                case ECapabilityPowerMgmt: 
                        line1.Copy(_L("PowerMgmt")); 
                        break; 
                case ECapabilityMultimediaDD: 
                        line1.Copy(_L("MultimediaDD")); 
                        break; 
                case ECapabilityReadDeviceData: 
                        line1.Copy(_L("ReadDeviceData")); 
                        break; 
                case ECapabilityWriteDeviceData: 
                        line1.Copy(_L("WriteDeviceData")); 
                        break; 
                case ECapabilityDRM: 
                        line1.Copy(_L("DRM")); 
                        break; 
                case ECapabilityTrustedUI: 
                        line1.Copy(_L("TrustedUI")); 
                        break; 
                case ECapabilityProtServ: 
                        line1.Copy(_L("ProtServ")); 
                        break; 
                case ECapabilityDiskAdmin: 
                        line1.Copy(_L("DiskAdmin")); 
                        break; 
                case ECapabilityNetworkControl: 
                        line1.Copy(_L("NetworkControl")); 
                        break; 
                case ECapabilityAllFiles: 
                        line1.Copy(_L("AllFiles")); 
                        break; 
                case ECapabilitySwEvent: 
                        line1.Copy(_L("SwEvent")); 
                        break; 
                case ECapabilityNetworkServices: 
                        line1.Copy(_L("NetworkServices")); 
                        break; 
                case ECapabilityLocalServices: 
                        line1.Copy(_L("LocalServices")); 
                        break; 
                case ECapabilityReadUserData: 
                        line1.Copy(_L("ReadUserData")); 
                        break; 
                case ECapabilityWriteUserData: 
                        line1.Copy(_L("WriteUserData")); 
                        break; 
                case ECapabilityLocation: 
                        line1.Copy(_L("Location")); 
                        break; 
                case ECapabilitySurroundingsDD: 
                        line1.Copy(_L("SurroundingsDD")); 
                        break; 
                case ECapabilityUserEnvironment: 
                        line1.Copy(_L("UserEnvironment")); 
                        break; 
                case ECapability_None: 
                        line1.Copy(_L("None")); 
                        break; 
                case ECapability_Denied: 
                        line1.Copy(_L("Denied")); 
                        break; 
                default: 
                        line1.Copy(_L("Unknown case")); 
                        break; 
        } 
    	if ( enabled ) 
    	{ 
            line2.Append(_L("is granted")); 
       	}
        else 
       	{ 
            line2.Append(_L("is NOT granted")); 
       	} 
        CEikonEnv::InfoWinL(line1, line2); 
}

Note: This code snippet does not give any capability information while running on emulator. If you want to grant capabilities on emulator, check with the emulator's platform security preferences.

Internal Links

Related Discussions
Thread Thread Starter Forum Replies Last Post
how to change the status pane display dynamically varshajohn Symbian User Interface 1 2002-11-04 05:02
Problem about imporation of DLL to device liuxingyu_best Symbian Signing, Certification and Security 14 2008-09-16 09:52
exe - dll, S60 3rd platform security stuff kompotFX General Symbian C++ 6 2006-10-03 15:27
Strange problem songoku83 General Symbian C++ 1 2007-12-05 05:31
Displaying Photo Images in Listbox kkramhoeft Symbian User Interface 2 2003-04-17 09:28
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX