示例#1
0
GLDEF_C TInt E32Main()
//
// Test Uid handling.
//
{

    test.Title();
//
    test.Start(_L("Uid tests"));
    testUid();
//
    test.Next(_L("Checked Uid tests"));
    testCheckedUid();
//
    test.Next(_L("Check this process's Uids"));
    test(RProcess().Type()[1]==TUid::Uid(0x22222222));
    test(RProcess().Type()[2]==TUid::Uid(0x33333333));

    test.Next(_L("Load Uid DLL"));
    RLibrary lib;
    TInt r=lib.Load(_L("T_DUID.DLL"));
    test(r==KErrNone);
    test.Next(_L("Test FileName"));
    test.Printf(lib.FileName());
    test.Printf(_L("\n"));

#if defined(__WINS__)
    if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
        test(lib.FileName().CompareF(_L("Z:\\Sys\\Bin\\T_DUID.DLL"))==0);
    else
        test(lib.FileName().CompareF(_L("Z:\\System\\Bin\\T_DUID.DLL"))==0);
#else
    if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
        test(lib.FileName().MatchF(_L("?:\\Sys\\Bin\\T_DUID.DLL"))!=KErrNotFound);
    else
        test(lib.FileName().MatchF(_L("?:\\System\\Bin\\T_DUID.DLL"))!=KErrNotFound);
#endif
    test.Next(_L("Check DLL Uid"));
    test(lib.Type()[1]==TUid::Uid(0x12345678));
    test(lib.Type()[2]==TUid::Uid(0x87654321));
    lib.Close();
    test.End();
    return(KErrNone);
}
/**
 Check if a Utility Plugin is already loaded.

 @param 	A RLibrary based on the DLL file which we want to investigate if its already
 			included in iLoadedPlugins.
 @return 	The index of any CSusPluginFrame in iLoadedPlugins which is based on the same DLL file
 			as given in parameter aLibrary.
 @internalComponent
 @released
 */
TInt CSusUtilServer::IndexOf(const RLibrary& aLibrary, TInt aNewLOrdinal) const
	{
	const TFileName nameToLookFor = aLibrary.FileName();
	const TInt count = iLoadedPlugins.Count();
	for(TInt i=0; i<count; i++)
		{
		if(0 == nameToLookFor.CompareF(iLoadedPlugins[i]->FileName()) && aNewLOrdinal == iLoadedPlugins[i]->NewLOrdinal())
			{
			return i;
			}
		}
	return KErrNotFound;
	}