Esempio n. 1
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;
}
Esempio n. 2
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;
}
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;
	}
Esempio n. 4
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();
	}
Esempio n. 5
0
/**
 * Executable Entry Point
 * Top level always creates TRAP harness.
 * Calls MainL() inside the TRAP harness
 */
GLDEF_C TInt E32Main()
	{
	__UHEAP_MARK;
	CTrapCleanup* cleanup = CTrapCleanup::New();
	if(cleanup == NULL)
		{
		return KErrNoMemory;
		}

  // Fix PDEF124952, set the priority EPriorityAbsoluteHigh. In this case, the timeout will 
  // take effect even if the server executes with almost 100% CPU usage.
  RThread().SetPriority(EPriorityAbsoluteHigh);
  // End PDEF124952
  
	// Check to see if the plugin wrapper around the GetSystemDrive is loadable
	// If yes, then instantiate the wrapper object and obtain the default system drive
	// Else, use the hardcoded default drive as c:
	TDriveName defaultSysDrive(KTEFLegacySysDrive);	
	
	RLibrary pluginLibrary;
	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
	
	if (plugin!=NULL)
		{
		TDriveUnit driveUnit(plugin->GetSystemDrive());
		defaultSysDrive.Copy(driveUnit.Name());
		delete plugin;
		pluginLibrary.Close();
		}
	
	TBool enableSysStart = ETrue;
	CTestExecuteIniData* iniData = NULL;
	TRAPD(err, iniData = CTestExecuteIniData::NewL(defaultSysDrive));
	if (err == KErrNone)
		{
		// Extract all the key values within the object
		iniData->ExtractValuesFromIni();
		iniData->GetKeyValueFromIni(KTEFSystemStarter, enableSysStart);
		}

	err = KErrNone;
	#if !(defined TEF_LITE)
	if (enableSysStart)
		{
		TRAP(err, StartSystemL());
		__ASSERT_ALWAYS(!err, User::Panic(KTestExecuteName,err));
		}
	#endif
	if (iniData != NULL)
		{
		delete iniData;
		}	
	
	err = KErrNone;
	TRAP(err,MainL(defaultSysDrive));
	__ASSERT_ALWAYS(!err, User::Panic(KTestExecuteName,err));
	delete cleanup;
	__UHEAP_MARKEND;
	return KErrNone;
    }
Esempio n. 6
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;
	}
Esempio n. 7
0
    void init()
    {
        _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");

        TPtrC libName;
        TInt uidValue;
        switch (QSysInfo::s60Version()) {
        case QSysInfo::SV_S60_3_1:
            libName.Set(KLibName_3_1);
            uidValue = 0x2001E620;
            break;
        case QSysInfo::SV_S60_3_2:
            libName.Set(KLibName_3_2);
            uidValue = 0x2001E621;
            break;
        case QSysInfo::SV_S60_5_0: // Fall through to default
        default:
            // Default to 5.0 version, as any unknown platform is likely to be newer than that
            libName.Set(KLibName_5_0);
            uidValue = 0x2001E622;
            break;
        }

        TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue));
        lib.Load(libName, libUid);

        // Duplicate lib handle to enable process wide access to it. Since Duplicate overwrites
        // existing handle without closing it, store original for subsequent closing.
        RLibrary origHandleCloser = lib;
        lib.Duplicate(RThread(), EOwnerProcess);
        origHandleCloser.Close();
    }
Esempio n. 8
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();
    }
Esempio n. 9
0
   ~C_simple_sound_player_imp(){
      //delete asw;
      delete plr;
#ifdef USE_OPTIONAL_POSITIONING
      if(lib_loaded)
         lib_mca.Close();
#endif
   }
Esempio 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;
	}
Esempio n. 11
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();
	}
// -----------------------------------------------------------------------------
// 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;
	}
Esempio n. 13
0
void gf_modules_unload_library(ModuleInstance *inst)
{
	if (!inst->lib_handle || gf_list_count(inst->interfaces)) return;

	RLibrary* pLibrary = (RLibrary *) inst->lib_handle;
	pLibrary->Close();
	delete pLibrary;

	inst->lib_handle = NULL;
	inst->load_func = NULL;
	inst->destroy_func = NULL;
	inst->query_func = NULL;
	//GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("[Core] Module %s unloaded\n", inst->szName));
}
Esempio n. 14
0
/*delete all interfaces loaded on object*/
void gf_modules_free_module(ModuleInstance *inst)
{
	void *objinterface;
	while (gf_list_count(inst->interfaces)) {
		objinterface = gf_list_get(inst->interfaces, 0);
		gf_list_rem(inst->interfaces, 0);
		inst->destroy_func(objinterface);
	}
	if (inst->lib_handle) {
		RLibrary* pLibrary = (RLibrary *) inst->lib_handle;
		pLibrary->Close();
	}
	gf_list_del(inst->interfaces);
	gf_free(inst);
}
Esempio n. 15
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" );
    }
Esempio n. 16
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);
}
Esempio n. 17
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;
	}
Esempio n. 18
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;
}
Esempio n. 19
0
LOCAL_C void StartSystemL()
	{
	CActiveScheduler* theScheduler = new (ELeave) CActiveScheduler();
	CleanupStack::PushL(theScheduler);
	CActiveScheduler::Install(theScheduler);
	
	RLibrary pluginLibrary;
	CWrapperUtilsPlugin* plugin = TEFUtils::WrapperPluginNew(pluginLibrary);
	
	if (plugin!=NULL)
		{
		plugin->WaitForSystemStartL();
		delete plugin;
		pluginLibrary.Close();
		}
	else
		{
		User::Leave(KErrGeneral);
		}
	
	CleanupStack::PopAndDestroy(theScheduler);
	}
Esempio n. 20
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;

	}
Esempio n. 21
0
//-----------------------------------------------------------------------------
//Function Name : void* __dlopen_r(const char* filename, int flag)
//Description   : To open the given dll filename.
//Return Value  : Valid handle value if no error, Null if dll couldn't be loaded 
//-----------------------------------------------------------------------------
void* __dlopen_r(const char* filename,const int flag)
	{
	//convert filename to TFileName
	TPtrC8 ptr8( (unsigned char*)filename);
	TFileName fileNameBuf;
	CnvUtfConverter::ConvertToUnicodeFromUtf8(fileNameBuf, ptr8);
	TParsePtr filePathName(fileNameBuf);
	
	//if file name contains wild character
	if ( filePathName.IsWild() )
		{
		SetError(KDlOpenErrNoSupport);
		return NULL;
		}
	//to load dll	
	RLibrary library;	
	TInt err;
	TBool isLibraryLoaded = EFalse;
	RFs fs;
	err = fs.Connect();
	if ( KErrNone == err )
		{
		TUint tempAtt;
		//if path is there load from this path
		if ( filePathName.PathPresent() )
			{
			err = fs.Att(filePathName.FullName(), tempAtt);
			fs.Close();	
			if ( KErrNotFound != err && KErrPathNotFound != err)
				{
				err = library.Load(filePathName.FullName());
				if ( KErrNone != err )
					{
					SetError(KDlOpenErrLoading);
					return NULL;
					}
				isLibraryLoaded = ETrue;	
				}
			}
		else//if there is no path its only file name
			{
			TPtrC fileName(filePathName.NameAndExt());
			char* envPathName = getenv("LD_LIBRARY_PATH");
			if ( envPathName )
				{
				TPtrC8 tempPtr8((unsigned char*)envPathName);
				TFileName envPathBuf;
				CnvUtfConverter::ConvertToUnicodeFromUtf8(envPathBuf, tempPtr8);
				TPtrC envPath(envPathBuf);
				TChar delim(';');
				TFileName fileToLoad;
				TInt pos = envPath.Locate(delim);
				//if delim does not found and still envPath contains value
				//i.e. this one is last path without delim(';') so take 
				//this also, for this length is checked
				while ( KErrNotFound != pos || envPath.Length())
					{
					//if there is no delim
					if (KErrNotFound == pos )
						{// so last path without delim
						pos = envPath.Length();
						}
					TPtrC thisPath(envPath.Left(pos));
					fileToLoad = thisPath;
					fileToLoad.Trim();
					//to check ";;" and ";   ;"
					if (fileToLoad.Length())
						{
						//if path does not conatin trailing \ add one
						if ( L'\\' != fileToLoad[fileToLoad.Length()-1] )
							{
							fileToLoad.Append(TChar(L'\\'));					
							}
						fileToLoad.Append(fileName);
					
						err = fs.Att(fileToLoad, tempAtt);
						if ( KErrNotFound != err && KErrPathNotFound != err)
							{
							//load file from this path
							err = library.Load(fileToLoad);
							if ( KErrNone == err )
								{
								// dll loaded successfully from thispath
								isLibraryLoaded = ETrue;	
								break;
								}	
							}
						}
					if ( pos == envPath.Length())		
						{
						break;
						}
					else
						{
						envPath.Set(envPath.Mid(pos + 1));
						}
					pos = envPath.Locate(delim);
					}
				fs.Close();	
				}
			else//load dll if only name is there and LD_LIBRARY_PATH path not set
				{
				fs.Close();	
				TInt err = library.Load(filePathName.NameAndExt());
				if ( KErrNone != err )
					{
					SetError(KDlOpenErrLoading);
					return NULL;
					}
				isLibraryLoaded = ETrue;		
				}
			}
	
		//if library is loaded	
		if ( isLibraryLoaded )	
			{
			//handle value to return 
			void* handle  = NULL;
			//lock list before any operation
			LoadedDlls()->Lock();
			//is this dll already there
			TInt listIdx = LoadedDlls()->Find(library);
			//if not already open
			if ( KErrNotFound == listIdx )
				{				
				TDllEntry dllEntry(library, flag);
				dllEntry.iSymbolHeader = (TE32ExpSymInfoHdr*)library.Lookup(0);
				
				err = dllEntry.iLibrary.Duplicate(RThread());	
				//Close the library irrespective of the result of duplicate
				library.Close();
				if ( KErrNone != err )
					{
					SetError(KDlOpenErrLoading);
					LoadedDlls()->UnLock();
					return NULL;
					}
				//add to list	
				err = LoadedDlls()->Add(dllEntry);
				handle = (void*) dllEntry.iLibrary.Handle();
				LoadedDlls()->UnLock();
				if ( KErrNone != err )
					{
					SetError(KDlOpenErrNoMemory);
					dllEntry.iLibrary.Close();
					return NULL;
					}
				}
			else//if this dll is already in list.
				{
				//close library we already have loaded
				library.Close();
				TDllEntry& dllEntry = LoadedDlls()->At(listIdx);
				//if flag is RTLD_GLOBAL store it otherwise ignore
				//as RTLD_LAZY and RTLD_NOW both means RTLD_NOW
				//so can be ignored. RTLD_LOCAL does not change previous flag
				if ( flag & RTLD_GLOBAL )
					{
					dllEntry.iFlags |= RTLD_GLOBAL;
					}
				dllEntry.iRefCount++;	
				handle = (void*) dllEntry.iLibrary.Handle();
				LoadedDlls()->UnLock();	
				}	
			return handle;			
			}
		}
	SetError(KDlOpenErrLoading);
	return NULL;		
	}
Esempio n. 22
0
/** Implementation of MStartupCommand interface.
This function retrieves the DLL name and ordinal number from its 
CSystemStartupDllInfo data member. It attempts to load the DLL 
and call the specified function. 

@see MStartupCommand.
*/
void CDllStarter::Execute(TRequestStatus& aStatus)
	{
	aStatus = KRequestPending; 
	DEBUGPRINT1(_L("SysStart: CDllStarter::Execute"));
	
	// Find the name of the DLL to be loaded from the information 
	// already retrieved from the SSC file.
	TFileName dllName =iDllInfo->DllName();
	_LIT(KExtension, ".dll");
	dllName.Append(KExtension);
    
    // Initialise variables
    _LIT(KSysBin, "z:\\sys\\bin\\");
	RLibrary lib;
	TInt err = KErrGeneral; 
	TBool dllLoaded = EFalse; 
	
	TUint8 ordinal = iDllInfo->Ordinal();
 
	// The DLL may not be found or the DLL function may return an error 
	// code. The number of times to re-attempt is specified in the SSC file.
	TInt attemptsRequired = iDllInfo->NoOfRetries() + 1; 
  
 	while ((err != KErrNone)   && (attemptsRequired-- >0))
	 	{
		// Search for and load the DLL. 	 
       	if ((err = lib.Load(dllName, KSysBin)) == KErrNone)
 			{ 
 			DEBUGPRINT2(_L("SysStart: dll loaded - %S"), &dllName);
 			dllLoaded = ETrue;		 
 			}
 		else
			{
			DEBUGPRINT3(_L("SysStart: Unable to load DLL - %S, error - %d"), &dllName, err);
			}
			
  		// Call the function in the Dll
  		if (dllLoaded)
  			{	
  			// Identify the function to be called according to the ordinal 
 			// number specified in the SSC file.
 			TLibraryFunction ordinalfunction = lib.Lookup(ordinal);
 				
 			if (ordinalfunction != NULL)
 				{	
 				Dllfunctiontype getDllFunction = reinterpret_cast<Dllfunctiontype>(ordinalfunction);
  		 		DEBUGPRINT2(_L("SysStart: Calling function at ordinal %d."), ordinal);
  		 		err = (*getDllFunction)(iDllInfo->DllBuffer());
 				}
 			else
 				{
 				DEBUGPRINT2(_L("Sysstart: No function at specified ordinal %d"), ordinal);
 				err = KErrNotFound;
 				// No function exists at the ordinal specified so 
 				// there is no point in re-attempting execution.
 				attemptsRequired = 0;
 				}
  			}
	 	}
 	
				 	
	// Take action on error condition
	if (err != KErrNone) 
		{	
 		// Check required behaviour on failure specified in SSC
 		if (iDllInfo->FailOnError())
 			{ 
			err = RestartSys::RestartSystem();
			if (KErrNone != err)
				{
				DEBUGPRINT2(_L("Sysstart: Restart System Call failed with error %d"), err);
 				PanicNow(KPanicDllStarter, ERestartSystemCallFailed);
				}
			User::After(5000000); // required by RestartSys API, see comments in RestartSys::RestartSystem()
 			}			 
		}
 
 	lib.Close();
  
	TRequestStatus* requestStatus = &aStatus;
	User::RequestComplete(requestStatus, err);
	}
Esempio n. 23
0
void CAppStarter::StartL()
	{
	TFileName newname = iExeFileName;

	TThreadId threadId = 0;

	switch(iAppType)
		{
		case EApplicationType:
			{
			TApaAppInfo info;
			if(iSession.GetAppInfo(info,TUid::Uid(iAppUid)) != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			
			if(iViewless)
				{
				TRAPD(err, TryStartViewlessAppL(info, threadId));
				if (err != KErrNone)
					{
					After(KRetryWait);
					return; //ignore error
					}
				}
			else if (info.iUid!=KNullUid)
				{
				if(iSession.StartDocument(newname, TUid::Uid(iAppUid), threadId) != KErrNone)
					{
					After(KRetryWait);
					return;
					}
				}
			else
				{
				iState = EAppFailed;
				Next();
				}
			}
			break;
		case EExecutableType:
			{
			newname.Append(KExtension);
			if(iSession.StartDocument(newname, TUid::Uid(0), threadId) != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			}
			break;
		case ECmdLnArgExecutableType:
			{
			ASSERT( !iMonitoring); // Not imlpemented yet
#if defined(__WINS__) || defined(__WINSCW__)
			TName libName = iDllFileName;
			libName.Append(KExtension);
			RLibrary lib;
			TInt error = lib.Load(libName);
			if (error!=KErrNone)
				{
				After(KRetryWait);
				return;
				}
			TThreadFunction serverFunc=reinterpret_cast<TThreadFunction>(lib.Lookup(1));
			RThread server;
			error=server.Create(libName,serverFunc, iStackSize, iCmdLineArgs, &lib,NULL,
								iMinHeapSize,iMaxHeapSize,EOwnerProcess);
			lib.Close();	// if successful, server thread has handle to library now
#else
			RProcess server;
			TInt error = server.Create(newname, *iCmdLineArgs);
#endif
			if( error != KErrNone)
				{
				After(KRetryWait);
				return;
				}
			server.Resume();
			server.Close();
			}
			break;
		default:
			iState = EAppFailed;
			Next();
		}
	
	if (iMonitoring)
		{
		CThreadWatcher *threadWatcher=NULL;
		TRAPD(err, threadWatcher = CThreadWatcher::NewL(iAppType, threadId, newname, iStarter, iAppUid, iViewless));
		if (err == KErrNone) //ignore errors
			iQue->AddLast(*threadWatcher);
		}
	iState = EAppStarted;
	Next();
	}
Esempio n. 24
0
TInt E32Main()

	{

	test.Title();



	test.Start(_L("Test retrieving 0th ordinal and therefore named symbol export data"));

	

	E32EmulExpSymInfoHdr tmpHdr;

	E32EmulExpSymInfoHdr *readHdr;

	RLibrary library;



	// The values for the header of the dll with a 0th ordinal

	tmpHdr.iSymCount = 0x0;

	tmpHdr.iDllCount = 0x3;

	test(library.Load(_L("t_oedll.dll")) == KErrNone);

	test.Next(_L("Attempt to retrieve named symbol data from t_oedll.dll"));

	readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0);

	test(readHdr!=NULL);

//#define PRINT_ZEROTH

#ifdef PRINT_ZEROTH

	test.Printf(_L("iSymCount=%08x;iDllCounts=%08x\n"),readHdr->iSymCount,readHdr->iDllCount);

#endif

	test.Next(_L("Verify export data of t_oedll.dll is that expected"));

	VerifyHdr(tmpHdr, *readHdr);

	library.Close();



	test.Next(_L("Verify lookup on dll without oe export data returns NULL"));

	test(library.Load(_L("t_dll1.dll")) == KErrNone);

	readHdr = (E32EmulExpSymInfoHdr*)library.Lookup(0);

	test(readHdr == NULL);

	library.Close();



	// The values for the header of the exe of the current process with a 0th ordinal

	tmpHdr.iSymCount = 0x3;

	tmpHdr.iDllCount = 0x5;

	test.Next(_L("Attempt to retrieve named symbol data from current process"));

	readHdr = (E32EmulExpSymInfoHdr*)(RProcess::ExeExportData());

	test(readHdr!=NULL);

	test.Next(_L("Verify export data 0th ordinal data of this exe is that expected"));

#ifdef PRINT_ZEROTH

	test.Printf(_L("iSymCount=%08x;iDllCounts=%08x;\n"),readHdr->iSymCount,readHdr->iDllCount);

#endif

	VerifyHdr(tmpHdr, *readHdr);



/*

On Emulator can't examine fixups & depdencies via export data as data not included

in E32EmulExpSymInfoHdr.  This is all handled by the MS loader.



*/

	test.End();

	return KErrNone;

	}
Esempio n. 25
0
EXPORT_C TInt RSgImage::GetPixelFormats(TUint32 aUsage, RArray<TInt>& aPixelFormats, const TSgAttributeArrayBase* aAttributes)
	{
	static const TInt KSupportedPixelFormats[] =
		{
		ESgPixelFormatA_8,
		ESgPixelFormatRGB_565,
		ESgPixelFormatXRGB_8888,
		ESgPixelFormatARGB_8888,
		ESgPixelFormatARGB_8888_PRE
		};
	static const TInt KNumSupportedPixelFormats = sizeof(KSupportedPixelFormats) / sizeof(TInt);
	if (aUsage == 0 || aPixelFormats.Count() != 0)
		{
		return KErrArgument;
		}
	if (aAttributes)
		{
		return KErrNotSupported;
		}
	if (aUsage & ~KSgUsageAll)
		{
		return KErrNone;
		}
	_LIT(KLibOpenVg, "libOpenVG.dll");
	_LIT(KLibOpenGles, "libGLESv1_CM.dll");
	_LIT(KLibOpenGles2, "libGLESv2.dll");
	RLibrary lib;
	if (aUsage & (ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface))
		{
		if (lib.Load(KLibOpenVg) != KErrNone)
			{
			return KErrNone;
			}
		lib.Close();
		}
	if (aUsage & (ESgUsageBitOpenGlesTexture2D | ESgUsageBitOpenGlesSurface))
		{
		if (lib.Load(KLibOpenGles) != KErrNone)
			{
			return KErrNone;
			}
		lib.Close();
		}
	if (aUsage & (ESgUsageBitOpenGles2Texture2D | ESgUsageBitOpenGles2Surface))
		{
		if (lib.Load(KLibOpenGles2) != KErrNone)
			{
			return KErrNone;
			}
		lib.Close();
		}
	TInt err = KErrNone;
	for (TInt i = 0; i < KNumSupportedPixelFormats; ++i)
		{
		if (KSupportedPixelFormats[i] == ESgPixelFormatA_8 && (aUsage & KSgUsageAllSurfaceTypes))
			{
			continue;
			}
		err = aPixelFormats.Append(KSupportedPixelFormats[i]);
		if (err != KErrNone)
			{
			break;
			}
		}
	return err;
	}
EXPORT_C void StartServerL(const TDesC& aServerName, TUid aServerUid3, const TDesC& aServerFileName)
#endif
{
	CALLSTACKITEM_N(_CL(""), _CL("StartServer"));

	TBuf<50> mutexname; MakeServerMutexName(mutexname, aServerName);
	RAMutex mutex; mutex.GlobalLA(mutexname);
	
	TFindServer findServer(aServerName);
	TFullName name;
	
	if (findServer.Next(name) == KErrNone)
        {
		return;
        }
	
#if defined(__WINS__)
	RAThread serverthread;
#else
	RAProcess serverthread;
#endif
	TBuf<50> semaphorename; MakeServerSemaphoreName(semaphorename, aServerName);
	RSemaphore semaphore;
	if (semaphore.CreateGlobal(semaphorename, 0)!=KErrNone) {
		User::LeaveIfError(semaphore.OpenGlobal(semaphorename));
	}

#if defined(__WINS__)
	CreateServerProcessLA(aServerName, aFunction, serverthread);
#else
	CreateServerProcessLA(aServerName, aServerUid3, aServerFileName, serverthread);
#endif
	
	TTimeIntervalMicroSeconds32 w(10*1000);
	TInt i=0;
	TInt result=KErrTimedOut;
	while (i < 17) { 
		// a couple of minutes, in case there's some db conversion or the like
#ifdef __S60V3__
		if (semaphore.Wait(w.Int())==KErrNone) {
#else
		if ( semaphore.Count()>0) {
#endif
			result=KErrNone;
			break;
		}
		TExitType etype=serverthread.ExitType();
		if (etype!=EExitPending) {
			// server died
			result=KErrServerTerminated;
			break;
		}
#ifndef __S60V3__
		User::After(w);
#endif
		w=w.Int()*2;
		i++;
	}
	if (result!=KErrNone) {
		User::Leave(result);
	}

	semaphore.Close();
}

#if defined(__WINS__)
void CreateServerProcessLA(const TDesC& aServerName, TThreadFunction aFunction,
				RAThread& aThreadInto)
#else
#  if defined(__WINS__)
void CreateServerProcessLA(const TDesC& aServerName, TUid aServerUid3, 
				    const TDesC& aServerFileName,
				RAThread& aThreadInto)
#  else
void CreateServerProcessLA(const TDesC& aServerName, TUid aServerUid3, 
				    const TDesC& aServerFileName,
				RAProcess& aThreadInto)
#  endif
#endif
{
	CALLSTACKITEM_N(_CL(""), _CL("CreateServerProcess"));

	TInt result;
	
	
#if defined(__WINS__)
	
//#  if !defined(EKA2)
#if 0
	const TUidType serverUid(KNullUid, KNullUid, aServerUid3);
	RLibrary lib;
	TInt err=lib.Load(aServerFileName, _L("z:\\system\\programs"), serverUid);
	if (err!=KErrNone) {
		err=lib.Load(aServerFileName);
	}
	User::LeaveIfError(err);
	
	//  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());
#  else
	TThreadFunction serverThreadFunction = aFunction;
#  endif
	
	TName threadName(aServerName);
	
	// Append a random number to make it unique
	threadName.AppendNum(Math::Random(), EHex);
	
#  if 0
//#  if !defined(EKA2)
	aThreadInto.CreateLA(threadName,   // create new server thread
		serverThreadFunction, // thread's main function
		KDefaultStackSize,
		NULL,  // parameters
		&lib,
		NULL,
		KServerMinHeapSize,
		KServerMaxHeapSize,
		EOwnerProcess);
	lib.Close();    // if successful, server thread has handle to library now
	
#  else
	aThreadInto.CreateLA(threadName, serverThreadFunction, 
		KDefaultStackSize,
		KServerMinHeapSize, KServerMaxHeapSize, 0, EOwnerProcess);

#  endif
	
	aThreadInto.SetPriority(EPriorityMore);
	
#else
	
	const TUidType serverUid(KNullUid, KNullUid, aServerUid3);
	aThreadInto.CreateLA(aServerFileName, _L(""), serverUid);
	
#endif
	
	aThreadInto.Resume();
	
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
static TInt CreateLockServerProcess()
    {
    TInt result;

	const TUidType serverUid(KNullUid, KNullUid, KCrashServerUid3);

#ifdef __WINS__

	RLibrary lib;
	result = lib.Load(KCrashServerImg, serverUid);
    if (result != KErrNone)
        {
        return  result;
        }

    //  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(KCrashServerName);

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

	RThread server;

	result = server.Create(threadName,   // create new server thread
							 serverThreadFunction, // thread's main function
							 KDefaultStackSize,
							 NULL,
							 &lib,
							 NULL,
							 KServerMinHeapSize,
							 KServerMaxHeapSize,
							 EOwnerProcess);

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

    if (result != KErrNone)
        {
        return  result;
        }

	server.SetPriority(EPriorityMore);


#else

	RProcess server;

	result = server.Create(KCrashServerImg, _L(""), serverUid);
    if (result != KErrNone)
        {
        return  result;
        }

#endif

	server.Resume();
    server.Close();

    return  KErrNone;
    }
Esempio n. 28
0
TInt E32Main()
	{
	test.Title();

	test.Start(_L("Test retrieving 0th ordinal and therefore named symbol export data"));
	
	E32EpocExpSymInfoHdr tmpHdr;
	E32EpocExpSymInfoHdr *readHdr;
	RLibrary library;

	// The values for the header of the dll with a 0th ordinal
	tmpHdr.iSize = 0x1a4;
	tmpHdr.iFlags = 0x0;
	tmpHdr.iSymCount = 0xc;	
	tmpHdr.iSymbolTblOffset = 0x1c;
	tmpHdr.iStringTableSz = 0x134;
	tmpHdr.iStringTableOffset = 0x64;
	tmpHdr.iDllCount = 0x3;	
	tmpHdr.iDepDllZeroOrdTableOffset = 0x198;
	test(library.Load(_L("t_oedll.dll")) == KErrNone);
	test.Next(_L("Attempt to retrieve named symbol data from t_oedll.dll"));
	readHdr = (E32EpocExpSymInfoHdr*)library.Lookup(0);
	test(readHdr!=NULL);
	test.Next(_L("Verify export data of t_oedll.dll at the 0th ordinal is that expected"));
	VerifyHdr(tmpHdr, *readHdr);
	library.Close();

	test.Next(_L("Verify lookup on dll without oe export data returns NULL"));
	test(library.Load(_L("t_dll1.dll")) == KErrNone);
	readHdr = (E32EpocExpSymInfoHdr*)library.Lookup(0);
	test(readHdr == NULL);
	library.Close();

	// The values for the header of the exe of the current process with a 0th ordinal
	tmpHdr.iSize = 0x48;
	tmpHdr.iFlags = 0x0;
	tmpHdr.iSymCount = 0x2;
	tmpHdr.iSymbolTblOffset = 0x1c;
	tmpHdr.iStringTableSz = 0x14;
	tmpHdr.iStringTableOffset = 0x28;
	tmpHdr.iDllCount = 0x3;
	tmpHdr.iDepDllZeroOrdTableOffset = 0x3c;
	test.Next(_L("Attempt to retrieve named symbol data from current process"));
	readHdr = (E32EpocExpSymInfoHdr*)(RProcess::ExeExportData());
	test(readHdr!=NULL);
	test.Next(_L("Verify export data at th 0th ordinal of this exe is that expected"));

//#define PRINT_ZEROTH
#ifdef PRINT_ZEROTH
	test.Printf(_L("iSize=%08x;iFlags=%08x;iSymCount=%08x;iSymbolTblOffset=%08x\n"),readHdr->iSize,readHdr->iFlags,readHdr->iSymCount,readHdr->iSymbolTblOffset);
	test.Printf(_L("iStringTableSz=%08x,iStringTableOffset=%08x,iDllCount=%08x,iDepDllZeroOrdTableOffset=%08x\n"), readHdr->iStringTableSz, readHdr->iStringTableOffset,readHdr->iDllCount,readHdr->iDepDllZeroOrdTableOffset);
#endif
	VerifyHdr(tmpHdr, *readHdr);

	test.Next(_L("Verify static dependency t_oedll1 has been fixed up correctly"));
	test(myfoo()==0x1234);

	// Get the 0th ordinal data from the dependency t_oedll1 and verify it
	readHdr=(E32EpocExpSymInfoHdr *)((TUint32)readHdr+readHdr->iDepDllZeroOrdTableOffset);
	TUint32 readHdrEnd = (TUint32)readHdr + 12;
	// This stdexe only links one stddll so the only non-NULL entry in iDepDllZeroOrdTable
	// should point to 0th ordinal of t_oedll1
	while (*(TUint32*)readHdr == NULL && (TUint32)readHdr < readHdrEnd)
		{
		readHdr=(E32EpocExpSymInfoHdr *)(((TUint32*)readHdr)+1);
		}

#ifdef PRINT_ZEROTH
	test.Printf(_L("iSize=%08x;iFlags=%08x;iSymCount=%08x;iSymbolTblOffset=%08x\n"),(*(E32EpocExpSymInfoHdr**)readHdr)->iSize,(*(E32EpocExpSymInfoHdr**)readHdr)->iFlags,(*(E32EpocExpSymInfoHdr**)readHdr)->iSymCount,(*(E32EpocExpSymInfoHdr**)readHdr)->iSymbolTblOffset);
	test.Printf(_L("iStringTableSz=%08x,iStringTableOffset=%08x,iDllCount=%08x,iDepDllZeroOrdTableOffset=%08x\n"), (*(E32EpocExpSymInfoHdr**)readHdr)->iStringTableSz, (*(E32EpocExpSymInfoHdr**)readHdr)->iStringTableOffset,(*(E32EpocExpSymInfoHdr**)readHdr)->iDllCount,(*(E32EpocExpSymInfoHdr**)readHdr)->iDepDllZeroOrdTableOffset);
#endif

	tmpHdr.iSize = 0x1a4;
	tmpHdr.iFlags = 0x0;
	tmpHdr.iSymCount = 0xc;	
	tmpHdr.iSymbolTblOffset = 0x1c;
	tmpHdr.iStringTableSz = 0x134;
	tmpHdr.iStringTableOffset = 0x64;
	tmpHdr.iDllCount = 0x3;	
	tmpHdr.iDepDllZeroOrdTableOffset = 0x198;
	VerifyHdr(tmpHdr,**(E32EpocExpSymInfoHdr**)readHdr);
	
	test.End();
	return KErrNone;
	}