Update contrib.
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\loader\security\dllt.cpp
23 #pragma warning(disable:4706)
26 extern "C" TInt _E32Dll(TInt);
28 extern "C" __MODULE_EXPORT TInt INITFUNC(MDllList&);
29 extern "C" __MODULE_EXPORT TInt CHKCFUNC();
30 extern "C" __MODULE_EXPORT TInt RBLKIFUNC(TInt, TInt);
32 extern "C" __MODULE_IMPORT TInt BLKIFUNC(TInt);
34 #ifdef __DLL_LINK_TO_EXE
35 extern "C" IMPORT_C void RegisterConstructorCall(TInt aDllNum);
36 extern "C" IMPORT_C void RegisterInitCall(TInt aDllNum);
37 extern "C" IMPORT_C void RegisterDestructorCall(TInt aDllNum);
40 void GetDllInfo(SDllInfo& aInfo)
43 aInfo.iEntryPointAddress=((TInt)&_E32Dll);
46 aInfo.iModuleHandle=ldd.ModuleHandleFromAddr((TInt)&_E32Dll);
50 #ifdef __MODULE_HAS_DATA
78 TFullName StartThread=RThread().FullName();
79 TName StartProcess=RProcess().Name();
80 TDllData TheDllDataObject;
81 TDllData2 TheDllDataObject2;
85 MDllList* pM=(MDllList*)UserSvr::DllTls(TLS_INDEX);
99 #ifndef __DLL_IN_CYCLE
101 CHKDEPS(r); // Check our dependencies are initialised
103 User::Panic(_L("CHKDEPS"),r);
105 iStartTime.HomeTime();
107 Dll::FileName(iFileName);
108 #ifdef __DLL_LINK_TO_EXE
109 RegisterConstructorCall(DLLNUM);
113 TDllData::~TDllData()
118 #ifdef __DLL_LINK_TO_EXE
119 RegisterDestructorCall(DLLNUM);
124 TDllData2::TDllData2()
133 TDllData2::~TDllData2()
141 #ifdef __MODULE_HAS_DATA
142 void RecordInitCall()
144 TheDllDataObject.iInitTime.HomeTime();
148 extern "C" __MODULE_EXPORT TInt INITFUNC(MDllList& aList)
153 if (!aList.IsPresent(info))
155 TInt pos=aList.Add(info);
156 INITDEPS(r,aList); // Call Init on our dependencies
157 aList.MoveToEnd(pos);
158 #ifdef __MODULE_HAS_DATA
160 r=CHKCFUNC(); // Check initial values for .data/.bss and check constructors have been called
164 #ifdef __DLL_LINK_TO_EXE
165 RegisterInitCall(DLLNUM);
171 extern "C" __MODULE_EXPORT TInt CHKCFUNC()
173 #ifdef __MODULE_HAS_DATA
176 for (i=0; i<16; ++i) x|=Bss[i];
181 if (TheDllDataObject.iTest1!=299792458)
185 if (x!=TheDllDataObject2.iTest2)
187 TInt init_mark=~((DLLNUM+DLLNUMOFFSET)*(DLLNUM+DLLNUMOFFSET));
188 if (InitFlag==init_mark)
194 if (StartProcess!=RProcess().Name())
198 if (fn!=TheDllDataObject.iFileName)
201 RDebug::Print(_L("ChkC %S OK"),&fn);
206 extern "C" __MODULE_EXPORT TInt GetGeneration()
208 #ifdef __MODULE_HAS_DATA
215 extern "C" __MODULE_EXPORT TInt RBLKIFUNC(TInt aInput, TInt aGeneration)
218 #ifdef __MODULE_HAS_DATA
220 if (aGeneration!=Generation)
222 Generation=aGeneration;
224 RBLKIFUNC_DEPS(r,aGeneration);
232 extern "C" __MODULE_EXPORT void SetCloseLib(TInt aLibHandle)
235 #ifdef __MODULE_HAS_DATA
236 TheDllDataObject.iLib.SetHandle(aLibHandle);