Ejemplo n.º 1
0
TDriveNumber CFileServPlugin::GetSystemDrive()
	{
	TDriveNumber defaultSysDrive(EDriveC);
	RFs fileServer;
	TVersionName version(fileServer.Version().Name());
	if (fileServer.Version().iMajor >= 2 &&
		fileServer.Version().iBuild >= 1100)
		{
		_LIT(KFileSrvDll, "efsrv.dll");

		RLibrary pluginLibrary;
		TInt pluginErr = pluginLibrary.Load(KFileSrvDll);

		if (pluginErr == KErrNone)
			{
			typedef TDriveNumber(*fun1)();
			fun1 sysdrive;

	#ifdef __EABI__
			sysdrive = (fun1)pluginLibrary.Lookup(336);
	#else
			sysdrive = (fun1)pluginLibrary.Lookup(304);
	#endif
			defaultSysDrive = sysdrive();
			}
		pluginLibrary.Close();
		}
	
	return defaultSysDrive;
	}
// ----------------------------------------------------------------------------
// CSamplerPluginLoader::LoadRlibraryL
// ----------------------------------------------------------------------------
//
void CSamplerPluginLoader::LoadRlibraryL(CArrayPtrFlat<CSamplerPluginInterface>* aPluginArray)
    {
    LOGSTRING("CSamplerPluginLoader rlibrary loading");
                // Load dll
    iPluginArray = aPluginArray;
    RLibrary aLib;
    TInt ret = aLib.Load(_L("PIProfilerGenerals.dll"),_L("c:\\sys\\bin"));

    LOGSTRING2("RLibrary load returns %d", ret);
    User::LeaveIfError(ret);
    const TInt KNewLOrdinal = 2;
    TLibraryFunction NewL =aLib.Lookup(KNewLOrdinal);

    if(!NewL)
        {
        RDebug::Printf("library.lookup returns null");    
        }
    else
        {
        LOGSTRING2("library.lookup returns 0x%x", NewL);
        //CGeneralsPlugin* mydll=(CGeneralsPlugin*)NewL();
        CSamplerPluginInterface* mydll=(CSamplerPluginInterface*)NewL();
        //Generals plugin loaded, samplers enabled.
        CleanupStack::PushL( mydll );
        //InsertPluginInOrderL( mydll, aPluginArray);
        CleanupStack::Pop(mydll);
        // call engine to finalize the startup
        //TRAPD(result, iObserver->HandleSamplerControllerReadyL(););
        NotifyProgress();

        //Begin CActive asynchronous loop.
        CompleteOwnRequest();
        }
    LOGSTRING("RLibrary and plugins loaded");
    }
Ejemplo n.º 3
0
// -----------------------------------------------------------------------------
// CEcmtMMCEvent::OpenMMCDoor
// Public Method to set MMC card seem to be as removed
// -----------------------------------------------------------------------------
//
void CEcmtMMCEvent::OpenMMCDoor()
	{
	_LIT(KECust,"ecust.dll");
    const TInt KECustUidValue=0x1000008d;
    const TUid KECustUid={KECustUidValue};

	RFs fs;
	User::LeaveIfError(fs.Connect());
	
	RLibrary library;
		// Dynamically load DLL
	User::LeaveIfError(library.Load(KECust));
	if (library.Type()[1] != KECustUid)
		{
		User::Leave(KErrGeneral);
		}
	
	TLibraryFunction MediaChangeCallBack = library.Lookup(6);
	MediaChangeCallBack();
	
	TLibraryFunction MediaDoorOpenPtr = library.Lookup(7);
	TBool* value = (TBool*) MediaDoorOpenPtr();
	*value = ETrue;
	library.Close();	
	fs.Close();
    }
Ejemplo n.º 4
0
TInt E32Main()
	{
	test.Title();

	// Turn off evil lazy dll unloading
	RLoader l;
	test(l.Connect()==KErrNone);
	test(l.CancelLazyDllUnload()==KErrNone);
	l.Close();

	test.Start(_L("Preload t_oedll1.dll"));
	RLibrary library;
	test(library.Load(_L("t_oedll1.dll")) == KErrNone);

	test.Next(_L("Run T_OEEXPORT.EXE..."));
	RProcess p;
	TInt r=p.Create(_L("T_OEEXPORT.EXE"), _L("2"));
	test(r==KErrNone);
	TRequestStatus s;
	p.Logon(s);
	p.Resume();
	User::WaitForRequest(s);
	TExitCategoryName aExitCategory = p.ExitCategory();
	test.Printf(_L("Second test exits with: %d,%d,%S\n"),p.ExitType(),p.ExitReason(),&aExitCategory);
	test(p.ExitType()==EExitKill);
	test(p.ExitReason()==0);
	p.Close();

	library.Close();

	test.End();
	return KErrNone;
	}
Ejemplo n.º 5
0
/**
Performs unit test. 

@param aSeverity The current logging severity level.
@param aSuitDLL The test suite DLL which contains the unit test.
@param aIniFile The ini file name.
*/
LOCAL_C void doUnitTestL(TInt aSeverity, const TFileName& aSuitDLL,const TFileName& aIniFile)
{	
	// check the dll can be found before trying to load
    RLibrary lib;
	TInt err = lib.Load(aSuitDLL, KTxtDLLpath);
    if (err == KErrNone)
        {
        lib.Close();
        }
	    
	if ( err==KErrNotFound ) 
	{	
		// this is not going to load !
 		//pLogSystem->Log(_L("Test suite %S could not be found"), &aSuitDLL );
		//return;
	}

	// create a new suitedll object to store info on loaded DLL
	CSuiteDll * newRef = CSuiteDll::NewL( aSuitDLL );

	// set severity level and logging system
	newRef->iTestSuite->SetSeverity(aSeverity);
	newRef->iTestSuite->SetLogSystem(pLogSystem);

	// do unit test
	newRef->iTestSuite->DoTestUnit(const_cast<TFileName&>(aIniFile));

	delete newRef;
}
Ejemplo n.º 6
0
TInt ChildThread(TAny* aArg)
	{
	TInt testType = (TInt)aArg;
	RThread mainThread;
	TInt r = mainThread.Open(MainThreadId);
	if (r != KErrNone)
		return r;
	// Open handle on dynamic DLL in this thread
	RLibrary library;
	test_KErrNone(library.Load(KDynamicDll));
	RThread().Rendezvous(KErrNone);
	TRequestStatus status;
	mainThread.Logon(status);
	User::WaitForRequest(status);
	if (mainThread.ExitType() != EExitKill)
		return KErrGeneral;
	if (mainThread.ExitReason() != KErrNone)
		return mainThread.ExitReason();
	mainThread.Close();
	if (testType != ETestRecursive)
		{
		RMsgQueue<TMessage> messageQueue;
		r = messageQueue.OpenGlobal(KMessageQueueName);
		if (r != KErrNone)
			return r;
		r = messageQueue.Send(EMessagePreDestruct);
		if (r != KErrNone)
			return r;
		}
	return testType;
	}
Ejemplo n.º 7
0
/**
@SYMTestCaseID          SYSLIB-FATCHARSETCONV-CT-1847-0002
@SYMTestCaseDesc	    Tests API behaviours of UnicodeConv class as part of INC090073
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for correct character conversion on certain chinese characters for CP936
@SYMTestExpectedResults Test must not fail
*/
void CT_CP949::TestINC090073L()
	{
    INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1847-0002 "));
 	_LIT16(unicode, "\x715C\x7A37\x61A9\x80B1\x86A3\x6B46\x6615");
	_LIT8(CP932Code, "\xE9\xF2\xF2\xC3\xCC\xA8\xCE\xDD\xCD\xF7\xFD\xE4\xFD\xDA");

	RLibrary lib;

	const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
	// load the dll
	TInt returnValue = lib.Load(KName,serverUid);
	test(returnValue==0);

	// get a pointer to the specified ordinal function and call it
	TLibraryFunction function1 = lib.Lookup(1);


	//cast the function pointer f to a function of type void with two arguments
	typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
	TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);

	TBuf8<15> foreign1;

	foreign1.Zero();
	const TDesC16& unicode1(unicode);
	TRAPD(err,(*aConvertFromUnicodeL)(foreign1, unicode1)); 	//testing conversion from Unicode
	test(err==0);
	TInt error = foreign1.Compare(CP932Code);
	test(error==0);
	foreign1.Zero();

	lib.Close();
	}
Ejemplo n.º 8
0
enum TVerdict CTestIdna08::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing the Loading of the new Library "));
	INFO_PRINTF1(_L("****************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RLibrary testLibrary;
	TInt err = testLibrary.Load(_L("punycodeconverter.dll"));
	
	if(err == KErrNone)
		{
		INFO_PRINTF1(_L(" Loading the punycodeconverter library is successful"));
		SetTestStepResult(EPass);
		}
	else 
		{	
		INFO_PRINTF1(_L(" Loading the punycodeconverter library is NOT successful"));
		User::LeaveIfError(KErrNone);  // just to suppress the LeaveScan warning
		}
	
	INFO_PRINTF1(_L("Negative Testing of SetOpt		 "));
	INFO_PRINTF1(_L("****************************************"));		

	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);

	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);
	
	TBool enableIdn = ETrue;//enabling the option of IDN support
	TPckgC<TBool> pckgEnable(enableIdn);
	TInt setOptErr = hr.SetOpt(KSoInetConfigInterface , KSolInetDns , pckgEnable);
	if(setOptErr != KErrNone)
		{
		INFO_PRINTF1(_L(" Negative Testing of the Setopt successful "));
		SetTestStepResult(EPass);
		}
	
	setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgEnable);
	User::LeaveIfError(setOptErr);

	enableIdn = EFalse;
	TPckgC<TBool> pckgDisable(enableIdn);
	setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgDisable);
	User::LeaveIfError(setOptErr);
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();
	return TestStepResult();

	}
Ejemplo n.º 9
0
TInt LoopThread(TAny*)
	{
	// Open handle on dynamic DLL in this thread
	RLibrary library;
	test_KErrNone(library.Load(KDynamicDll));
	for (;;)
		;
	}
Ejemplo n.º 10
0
static TInt StartServer()
//
// Start the server process or thread
//
	{
	const TUidType serverUid(KNullUid,KNullUid,KServerUid3);

#ifdef __CDLSERVER_NO_PROCESSES__
	//
	// In EKA1 WINS the server is a DLL, the exported entrypoint returns a TInt
	// which represents the real entry-point for the server thread
	//
	RLibrary lib;
	TInt r=lib.Load(KCdlServerDllImg,serverUid);
	if (r!=KErrNone)
		return r;
	TLibraryFunction ordinal1=lib.Lookup(1);
	TThreadFunction serverFunc=reinterpret_cast<TThreadFunction>(ordinal1());
	//
	// To deal with the unique thread (+semaphore!) naming in EPOC, and that we may
	// be trying to restart a server that has just exited we attempt to create a
	// unique thread name for the server.
	// This uses Math::Random() to generate a 32-bit random number for the name
	//
	TName name(KCdlServerName);
	name.AppendNum(Math::Random(),EHex);
	RThread server;
	r=server.Create(name,serverFunc,
					KCdlServerStackSize,
					NULL,&lib,NULL,
					KCdlServerInitHeapSize,KCdlServerMaxHeapSize,EOwnerProcess);
	lib.Close();	// if successful, server thread has handle to library now
#else
	//
	// EPOC and EKA2 is easy, we just create a new server process. Simultaneous launching
	// of two such processes should be detected when the second one attempts to
	// create the server object, failing with KErrAlreadyExists.
	//
	RProcess server;
	TInt r=server.Create(KCdlServerExeImg,KNullDesC,serverUid);
#endif
	if (r!=KErrNone)
		return r;
	TRequestStatus stat;
	server.Rendezvous(stat);
	if (stat!=KRequestPending)
		server.Kill(0);		// abort startup
	else
		server.Resume();	// logon OK - start the server
	User::WaitForRequest(stat);		// wait for start or death
	// we can't use the 'exit reason' if the server panicked as this
	// is the panic 'reason' and may be '0' which cannot be distinguished
	// from KErrNone
	r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
	server.Close();
	return r;
	}
Ejemplo n.º 11
0
void CryptoSpiUtil::LoadPluginDllLC(RLibrary& aLib, TFileName& aFileName)
	{
	User::LeaveIfError(aLib.Load(aFileName));
	CleanupClosePushL(aLib);
	RLibrary plugin=aLib;
	CleanupClosePushL(plugin);
	User::LeaveIfError(aLib.Duplicate(RThread(), EOwnerProcess));
	CleanupStack::PopAndDestroy(&plugin);		
	}
void CTestChangeLanguageStep::ChangeLocaleL(TLanguage aLanguage)
	{
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    _LIT(KLitLocaleDllNameBase, "elocl_lan");
    _LIT(KLitLocaleDllNameExtension, ".loc");
#else 
    _LIT(KLitLocaleDllNameBase, "ELOCL");
    _LIT(KLitLocaleDllNameExtension, ".LOC");
#endif
    RLibrary localeDll;
    TBuf<16> localeDllName(KLitLocaleDllNameBase);
    CleanupClosePushL(localeDll);
    const TUidType uidType(TUid::Uid(0x10000079),TUid::Uid(0x100039e6));
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    _LIT(ThreeDigExt,".%03d");
    localeDllName.AppendFormat(ThreeDigExt, aLanguage);
#else
    _LIT(KTwoDigExt,".%02d");
    localeDllName.AppendFormat(KTwoDigExt, aLanguage);
#endif        
       
    TInt error=localeDll.Load(localeDllName, uidType);
    if (error == KErrNotFound)
        {
        _LIT(KLoadError,"ChangeLanguageStep : localeDll-Load() returned error = %d");
        ERR_PRINTF2(KLoadError,error);
        localeDllName=KLitLocaleDllNameBase;
        localeDllName.Append(KLitLocaleDllNameExtension);
        error=localeDll.Load(localeDllName, uidType);   
        }
    User::LeaveIfError(error);
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
    _LIT(KLoadLocale,"Using API LoadLocaleAspect()");
    INFO_PRINTF1(KLoadLocale);
    TExtendedLocale myExtendedLocale;
    User::LeaveIfError(myExtendedLocale.LoadLocaleAspect(localeDllName));
    User::LeaveIfError(myExtendedLocale.SaveSystemSettings());
#else
	_LIT(KSecure,"Using Secure API ChangeLocale()");
	INFO_PRINTF1(KSecure);
	User::LeaveIfError(UserSvr::ChangeLocale(localeDllName));
#endif
	CleanupStack::PopAndDestroy(); // localeDll
	}
Ejemplo n.º 13
0
/**
@SYMTestCaseID          SYSLIB-FATCHARSETCONV-CT-1777
@SYMTestCaseDesc	    Tests API behaviours of UnicodeConv class
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for conversions from/to Unicode, using a function pointer
@SYMTestExpectedResults Test must not fail
*/
void CT_CP949::TestL()
	{
    INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-FATCHARSETCONV-CT-1777 "));
	RLibrary lib;

	const TUidType serverUid(KNullUid,KNullUid,KPluginUid);
	// load the dll
	TInt returnValue = lib.Load(KName,serverUid);
	test(returnValue==0);

	// get a pointer to the specified ordinal function and call it
	TLibraryFunction function1 = lib.Lookup(1);
	TLibraryFunction function2 = lib.Lookup(2);
	TLibraryFunction function3 = lib.Lookup(3);

	//cast the function pointer f to a function of type void with two arguments
	typedef void (*TConvertFromUnicodeL)(TDes8&, const TDesC16&);
	TConvertFromUnicodeL aConvertFromUnicodeL = reinterpret_cast <TConvertFromUnicodeL> (function1);

	typedef void (*TConvertToUnicodeL)(TDes16&, const TDesC8&);
	TConvertToUnicodeL aConvertToUnicodeL = reinterpret_cast <TConvertToUnicodeL> (function2);

	typedef TBool (*TIsLegalShortNameCharacter)(TUint);
	TIsLegalShortNameCharacter aIsLegalShortNameCharacter = reinterpret_cast <TIsLegalShortNameCharacter> (function3);


	TBuf8<20> foreign1;
	TBuf16<15> unicode2;

	const TDesC16& unicode1(Uni_1);
	TRAPD(err,(*aConvertFromUnicodeL)(foreign1, unicode1)); 	//testing conversion from Unicode
	test(err==0);
	TInt error = foreign1.Compare(CP949_1);
	test(error==0);
	foreign1.Zero();

	const TDesC8& foreign2(CP949_2);
	(*aConvertToUnicodeL)(unicode2,foreign2); 	//testing conversion to Unicode
	error = unicode2.Compare(Uni_2);
	test(error==0);
	unicode2.Zero();


	//testing for legal short name character
	TInt result = (*aIsLegalShortNameCharacter)(0x005F); //testing for existent character
	test(result==1);
	result = (*aIsLegalShortNameCharacter)(0x003F); //testing for illegal character
	test(result==0);
	result = (*aIsLegalShortNameCharacter)(0x2999); //testing for non-existent character
	test(result==0);
	result = (*aIsLegalShortNameCharacter)(0xAC02); //testing for double byte character
	test(result==1);

	lib.Close();
	}
Ejemplo n.º 14
0
// -----------------------------------------------------------------------------
// MceServerStarter::CreateServerProcess
// -----------------------------------------------------------------------------
//
TInt MceServerStarter::CreateServerProcess (RSemaphore& aSemaphore)
	{
	const TUidType serverUid (KNullUid, KNullUid, KServerUid3);


#if ((defined (__WINS__) || defined(__WINSCW__)) && !defined (EKA2))

	RLibrary lib;
    RETURN_IF_ERROR (lib.Load(KMceServerFilename,serverUid))

    //  Get the WinsMain function
	TLibraryFunction functionWinsMain = lib.Lookup (1);

    //  Call it and cast the result to a thread function
	TThreadFunction serverThreadFunction = 
        reinterpret_cast<TThreadFunction> (functionWinsMain());

	TName threadName (KSipServerName);

	// Append a random number to make it unique
	threadName.AppendNum (Math::Random(), EHex);

	RThread server;
    TInt err = server.Create (threadName,
                              serverThreadFunction, // thread's main function
                              KDefaultStackSize,
                              NULL,
                              &lib,
                              NULL,
                              KServerMinHeapSize,
                              KServerMaxHeapSize,
                              EOwnerProcess );

	lib.Close ();	// if successful, server thread has handle to library now
    RETURN_IF_ERROR (err)

	server.SetPriority (EPriorityMore);

#else // HW build

	RProcess server;
	RETURN_IF_ERROR (server.Create( KMceServerName, KNullDesC, serverUid ) )

#endif


	server.Resume ();
	aSemaphore.Wait();
	TInt exitReason = server.ExitReason();
	server.Close ();

    return exitReason;
	}
Ejemplo n.º 15
0
EXPORT_C MDrmKeyStorage* DrmKeyStorageNewL()
    {
    RLibrary library;
    MDrmKeyStorage* storage;
    TInt r;
    TStorageConstructor constructor;
    
    r = library.Load(KBb5KeyStorageName);
    if (r != KErrNone)
        {
        r = library.Load(KStdKeyStorageName);
        }
    User::LeaveIfError(r);
    constructor = reinterpret_cast<TStorageConstructor>(
        library.Lookup(KConstructorOrdinal));
    if (constructor == NULL)
        {
        User::Leave(KErrNotFound);
        }
    storage = reinterpret_cast<MDrmKeyStorage*>(constructor(library));
    return storage;
    }
Ejemplo n.º 16
0
TVerdict CApStartTestStep::doTestStepPreambleL()
	{
	// Load the CApaStarter implementation
	RLibrary lib;
	User::LeaveIfError(lib.Load(KApStartDLL)); // load the library
	CleanupClosePushL(lib);		
	TLibraryFunction ord1 = lib.Lookup(1); // This is the NewL function
	TFuncNewL funcL = reinterpret_cast<TFuncNewL>(ord1);
	iAppStart = static_cast<CApaStarter*> (funcL());	
	CleanupStack::PopAndDestroy(&lib);
		
	return CTestStep::doTestStepPreambleL();	
	}
Ejemplo n.º 17
0
Bool gf_modules_load_library(ModuleInstance *inst)
{
	const TUid KGPACModuleUid= {0x10000080};
	char s_path[GF_MAX_PATH];
	HBufC *path;
	TInt e;

	if (inst->lib_handle) return 1;

	sprintf(s_path, "%s%c%s", inst->plugman->dir, GF_PATH_SEPARATOR, inst->szName);

	path = HBufC::NewL( User::StringLength( ( TUint8* ) s_path) + 1 );
	path->Des().Copy( TPtrC8(( TText8* ) s_path) );

	RLibrary* pLibrary = new RLibrary();
	e = pLibrary->Load(*path);
	delete path;

	if (e != KErrNone) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] Cannot load library %s: %d", s_path, e));
		delete pLibrary;
		goto err_exit;
	}
	/*check UID 2 is GPAC's identifier*/
	if (pLibrary->Type()[1] != KGPACModuleUid) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] Invalid library UID %x", (u32) pLibrary->Type()[1].iUid));
		pLibrary->Close();
		delete pLibrary;
		goto err_exit;
	}
	inst->query_func = (QueryInterfaces) pLibrary->Lookup(1);
	inst->load_func = (LoadInterface) pLibrary->Lookup(2);
	inst->destroy_func = (ShutdownInterface) pLibrary->Lookup(3);

	if ((inst->query_func==NULL) || (inst->load_func==NULL) || (inst->destroy_func==NULL) ) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("[core] Library %s has invalid interfaces", inst->szName));
		pLibrary->Close();
		delete pLibrary;
		goto err_exit;
	}

	//store library handle
	inst->lib_handle = (void*) pLibrary;
	//GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Module %s loaded\n", inst->szName));
	return 1;

err_exit:
	gf_cfg_set_key(inst->plugman->cfg, "SymbianDLLs", inst->szName, "no");
	return 0;
}
Ejemplo n.º 18
0
// -----------------------------------------------------------------------------
// CHtiFramework::WaitNormalState
// Delays HTI startup until device reaches normal state.
// -----------------------------------------------------------------------------
void CHtiFramework::WaitNormalState( TInt aMaxWaitTime, TInt aStartUpDelay )
    {
    HTI_LOG_FUNC_IN("CHtiFramework::WaitNormalState");
    // First make sure that EComServer is running before continuing
    TFullName processName;
    TFindProcess finder( KEComServerMatchPattern );
    while ( finder.Next( processName ) != KErrNone )
        {
        HTI_LOG_TEXT( "HTI waiting for EComServer startup" );
        finder.Find( KEComServerMatchPattern );
        User::After( 1000000 ); // wait 1 second
        }
    HTI_LOG_TEXT( "EComServer process found - HTI startup continuing" );

    if ( aMaxWaitTime > 0 )
        {
        TInt err = KErrNone;
        RFs fs;
        err = fs.Connect();
        if ( err == KErrNone )
            {
            RLibrary library;
            err = library.Load( KHtiStartupWaitDllName );
            HTI_LOG_FORMAT( "StartupWait library load returned %d", err );
            if ( err == KErrNone &&
                 library.Type()[1] == KHtiStartupWaitInterfaceUid )
                {
                HTI_LOG_TEXT( "StartupWait DLL found" );
                TLibraryFunction entry = library.Lookup( 1 );
                if ( entry != NULL )
                    {
                    MHtiStartupWaitInterface* startupWait =
                        ( MHtiStartupWaitInterface* ) entry();
                    err = startupWait->WaitForStartup( aMaxWaitTime );
                    HTI_LOG_FORMAT( "StartupWait returned %d", err );
                    delete startupWait;
                    startupWait = NULL;
                    }
                }
            library.Close();
            }
        }

    HTI_LOG_FORMAT( "HTI Starting after %d seconds", aStartUpDelay );
    User::After( aStartUpDelay * 1000 * 1000 );

    HTI_LOG_FUNC_OUT( "CHtiFramework::WaitNormalState" );
    }
/**
Attempt to load the library with the supplied name

@param aLibrary Library object used to load the DLL
@param aLibraryFilename file name of library to load
@leave KErrNotSupported If UID2 of the DLL is not KStatePolicyDllTypeUidValue
@leave KErrNotFound If the requested policy DLL file is missing.
@leave KErrCorrupt Or any other system wide error code that the fileserver can raise.
*/
void CSsmSwpPolicyResolver::LoadLibraryLC(RLibrary& aLibrary, const TDesC& aLibraryFilename) const
	{
	CleanupClosePushL(aLibrary);
	const TInt fileErr = aLibrary.Load(aLibraryFilename);
	if (fileErr != KErrNone)
		{
		DEBUGPRINT3(_L("Failed to load library file %S, file error-code: %d"), &aLibraryFilename, fileErr);
		User::Leave(fileErr);
		}
	if (aLibrary.Type()[1] != KSsmSwpPolicyDllTypeUid)
		{
		DEBUGPRINT4(_L("Wrong type (uid2) in swp policy library dll %S. Expected %x found %x"),
					&aLibraryFilename, KSsmSwpPolicyDllTypeUid, aLibrary.Type()[1]);
		User::Leave(KErrNotSupported);
		}
	}
void CCryptoPluginsLoader::LoadPluginsL()
{
    HBufC *configFileBuf = GetConfigFileNameL();
    CleanupStack::PushL(configFileBuf);
    TPtr configFile(configFileBuf->Des());

    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    RFile file;
    User::LeaveIfError(file.Open(fs, configFile, KEntryAttNormal));
    CleanupClosePushL(file);

    TFileText ft;
    ft.Set(file);
    TFileName line;

    User::LeaveIfError(ft.Read(line));

    //Load all the plugins
    do
    {
        TFileName filename;
        filename.Append(KPluginDir);
        filename.Append(line);

        //Load...
        RLibrary plugin;
        TInt err=plugin.Load(filename);
        if (err==KErrNone)
        {
            CleanupClosePushL(plugin);
            iPluginDllList.AppendL(plugin);
            CleanupStack::Pop(&plugin);
            iPluginNames.AppendL(line);
        }
    }
    while(ft.Read(line) == KErrNone);


    CleanupStack::PopAndDestroy(&file);
    CleanupStack::PopAndDestroy(&fs);
    CleanupStack::PopAndDestroy(configFileBuf);

    BuildPluginCharacteristicsL();
}
Ejemplo n.º 21
0
GLDEF_C TInt EtelServerThread(TAny* /*anArg*/)
//
// The ETel Server Thread.
//
	{
	__UHEAP_MARK;
	LOGTEXT(_L8("----------New Log----------\015\012"));
	LOGTEXT(_L8("Entered ETel Server thread"));
	LOGTEXTREL(_L8("Entered ETel Server thread"));

	CTrapCleanup* pT;
	if ((pT=CTrapCleanup::New())==NULL)
		Fault(EEtelFaultCreateTrapCleanup);

	//
	// Start the scheduler and then the server
	//
	CTelScheduler* pScheduler = CTelScheduler::New();
	CTelServer* pServer=CTelServer::New();

	User::SetCritical(User::ENotCritical);
	RSemaphore s;
	TInt semRet=s.OpenGlobal(KETelSemaphoreName);

	if (semRet==KErrNone)
		{
		s.Signal();
		s.Close();
		}
	RLibrary lib;
	lib.Load(KEtelDLLName); // to ensure the access count on the library is always >0
										// while the ETel thread is running
	CTelScheduler::Start();
	LOGTEXT(_L8("ETel:\tScheduler has been stopped\n"));

	delete pT;
	delete pServer;
	delete pScheduler;

	LOGTEXT(_L8("ETel:\tAbout to exit ETel thread function\n"));
	LOGTEXTREL(_L8("ETel:\tAbout to exit ETel thread function\n"));
	__UHEAP_MARKEND;

	return(KErrNone);
	}
Ejemplo n.º 22
0
extern "C" TLinAddr GetEka1ExeEntryPoint()
	{
	TLinAddr a = 0;
	RLibrary l;
	TInt r = l.Load(KEka1EntryStubName, KNullDesC, TUidType(KDynamicLibraryUid, KEka1EntryStubUid));
	if (r == KErrNone)
		r = l.Duplicate(RThread(), EOwnerProcess);
	if (r == KErrNone)
		{
		a = (TLinAddr)l.Lookup(1);
		if (!a)
			r = KErrNotSupported;
		}
	if (r != KErrNone)
		RThread().Kill(r);
	Exec::SetReentryPoint(a);
	return a;
	}
Ejemplo n.º 23
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);
}
Ejemplo n.º 24
0
TInt PermanentThread(TAny* aArg)
	{
	TInt testType = (TInt)aArg;
	// Open handle on dynamic DLL in this thread
	RLibrary library;
	TInt r = library.Load(KDynamicDll);
	if (r != KErrNone)
		return r;
	RMsgQueue<TMessage> messageQueue;
	r = messageQueue.OpenGlobal(KMessageQueueName);
	if (r != KErrNone)
		return r;
	r = messageQueue.Send(EMessagePreDestruct);
	if (r != KErrNone)
		return r;
	messageQueue.Close();
	User::SetCritical(User::EProcessPermanent);
	User::Exit(testType);
	return KErrGeneral;
	}
void MainL()
	{
	TInt err=KErrNone;
	
	// figure out which test we're supposed to be running
	HBufC* dllName=GetDllNameL();
	
	HBufC* logFileName=GetDesParameterL(KLogFileNameTransferSlot);
	
	TBool shouldPass;
	err = User::GetTIntParameter(KShouldPassTransferSlot, shouldPass);
	TInt testNumber;
	err = User::GetTIntParameter(KTestNumberTransferSlot, testNumber);

	// session
	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
		
	//logfile
	RFile logFile;
	User::LeaveIfError(logFile.Replace(fs, *logFileName, 0));
	CleanupClosePushL(logFile);
	
	// load library
	RLibrary lib;
	User::LeaveIfError(lib.Load(*dllName));
	CleanupClosePushL(lib);
	
	//runtests
	TLibraryFunction testFactory=lib.Lookup(1);
	MCapabilityTestFactory* factory=reinterpret_cast<MCapabilityTestFactory*>(testFactory());
	factory->Test(testNumber)->SetExpectPermissionDenied(!shouldPass);
	
	TRAP(err, factory->Test(testNumber)->RunTestL(logFile));

	delete factory;
	CleanupStack::PopAndDestroy(3, &fs); // lib, logFile, fs
	
	User::LeaveIfError(err);
	}
Ejemplo n.º 26
0
   void InitLib(){
      if(!lib_loaded){
         mca_Pause = NULL;
         mca_GetPosition = NULL;
         mca_SetPosition = NULL;
         const TUid ss_dll_uid = { 0x1000008d };
         const TUidType uid(KNullUid, ss_dll_uid, KNullUid);
         if(!lib_mca.Load(_L("mediaclientaudio.dll"), uid)){
            lib_loaded = true;
#ifdef _DEBUG
            *(TLibraryFunction*)&mca_Pause = lib_mca.Lookup(55);
            *(TLibraryFunction*)&mca_GetPosition = lib_mca.Lookup(30);
            *(TLibraryFunction*)&mca_SetPosition = lib_mca.Lookup(72);
#else
            mca_Pause = (t_Pause)lib_mca.Lookup(54);
            mca_GetPosition = (t_GetPosition)lib_mca.Lookup(29);
            mca_SetPosition = (t_SetPosition)lib_mca.Lookup(71);
#endif
         }
      }
   }
Ejemplo n.º 27
0
EXPORT_C TInt StartC32()
  /**
   * Start the Rootserver and services, 
   * this function in C32 is DEPRECATED and will be removed
   * in the near future.
   *
   * Instead one should link to c32root.dll and use the 
   * StartC32() from that library.
   *
   * @return TInt - An error code
   */
  	{
	C32_STATIC_LOG(KC32Warning,_L8("WARNING: StartC32() CALLED IN C32.DLL. THIS IS DEPRECATED. MUST USE C32ROOT.DLL!!"));

	RLibrary library;
	TInt res = library.Load(KRootServerDll);

    if (res!=KErrNone && res!=KErrAlreadyExists)
		{
		C32_STATIC_LOG2(KC32Warning, _L8("StartC32 from C32.DLL: Unable to load RS DLL %d."), res);

        return res;
		}

	C32_STATIC_LOG(KC32Bootup,      _L8("StartC32 from C32.DLL: Loaded RS library."));

    TLibraryFunction StartC32Entry=library.Lookup(StartC32EntryOrdinal);
    
    if (StartC32Entry==NULL)
		{
		C32_STATIC_LOG2(KC32Warning, _L8("StartC32 from C32.DLL: Unable to load StartC32 ordinal %d."), StartC32EntryOrdinal);
        return KErrNoMemory;
		}

	C32_STATIC_LOG(KC32Bootup, _L8("StartC32 from C32.DLL: Calling StartC32 ordinal from RS."));

	res = StartC32Entry();
	library.Close();
  	return res;
	}
Ejemplo n.º 28
0
/* \internal
 *
 * Uses link-time symbol preemption to capture a call from the application
 * startup. On return, there is some kind of heap allocator installed on the
 * thread.
*/
TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
{
    TInt r = KErrNone;

#ifndef __WINS__
    // attempt to create the fast allocator through a known export ordinal in qtcore.dll
    RLibrary qtcore;
    if (qtcore.Load(QtCoreLibName) == KErrNone)
    {
        const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
        TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);
        if (libFunc)
        {
            typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo);
            TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc);
            r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo);
        }
        qtcore.Close();
        if (libFunc)
            return r;
    }
#endif

    // no fast allocator support - use default allocator creation
    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
        {
        // new heap required
        RHeap* pH = NULL;
        r = UserHeap::CreateThreadHeap(aInfo, pH);
        }
    else if (aInfo.iAllocator)
        {
        // sharing a heap
        RAllocator* pA = aInfo.iAllocator;
        pA->Open();
        User::SwitchAllocator(pA);
        r = KErrNone;
        }
    return r;
}
Ejemplo n.º 29
0
TVerdict COpenCloseBogus::doTestStepL()
	{
	SetTestStepResult(EPass);

	INFO_PRINTF1(_L("============================================\n"));
	INFO_PRINTF1(_L("Test : test1\n"));
	INFO_PRINTF1(_L("============================================\n"));

	RTestNif one;

	INFO_PRINTF1(_L("Open/close with bogus name"));
	TInt Err = one.Open(_L("testagent"));
	TESTEL(Err == KErrNone, Err);
	one.Close();

	RLibrary r;

	Err = r.Load(_L("bogus.agt"));
	TESTEL(Err == KErrNotFound, Err);

	return TestStepResult();
	}
Ejemplo n.º 30
0
TBool CUIManager::CheckPenEnabled()
	{
	TBool penEnabled = EFalse;

	RLibrary avkonDll;
	if (avkonDll.Load(_L( "avkon.dll" )) == KErrNone)
		{
#ifdef __WINS__
		TLibraryFunction PenEnabled = avkonDll.Lookup(3184);
#else
		TLibraryFunction PenEnabled = avkonDll.Lookup( 4251 );
#endif

		if (PenEnabled != NULL)
			{
			penEnabled = PenEnabled();
			}

		avkonDll.Close();
		}
	return penEnabled;

	}