sl@0
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\loader\t_ldrcheck.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "dlltree.h"
|
sl@0
|
20 |
#include <e32uid.h>
|
sl@0
|
21 |
#include <hal.h>
|
sl@0
|
22 |
#include <e32wins.h>
|
sl@0
|
23 |
#include <e32svr.h>
|
sl@0
|
24 |
#include <e32test.h>
|
sl@0
|
25 |
#include <f32file.h>
|
sl@0
|
26 |
#include <f32dbg.h>
|
sl@0
|
27 |
#include <f32image.h>
|
sl@0
|
28 |
#include "t_hash.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
#if defined (WIN32) && !defined (__X86GCC__)
|
sl@0
|
31 |
#include <emulator.h>
|
sl@0
|
32 |
#include <stdlib.h>
|
sl@0
|
33 |
#endif
|
sl@0
|
34 |
|
sl@0
|
35 |
|
sl@0
|
36 |
RTest test(_L("T_LDRCheck"));
|
sl@0
|
37 |
RFs TheFs;
|
sl@0
|
38 |
GLDEF_D TChar gDriveToTest;
|
sl@0
|
39 |
|
sl@0
|
40 |
|
sl@0
|
41 |
/**
|
sl@0
|
42 |
Copy modules from z:\\sys\\bin to c:\\sys\\bin
|
sl@0
|
43 |
*/
|
sl@0
|
44 |
void CopyModules()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
test.Next(_L("Copy Modules from ROM to disk"));
|
sl@0
|
47 |
|
sl@0
|
48 |
TInt r;
|
sl@0
|
49 |
TTime modtime;
|
sl@0
|
50 |
|
sl@0
|
51 |
r=TheFs.MkDirAll(KSystemLibs);
|
sl@0
|
52 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
53 |
|
sl@0
|
54 |
CFileMan* fileMan=NULL;
|
sl@0
|
55 |
TRAP(r,fileMan=CFileMan::NewL(TheFs));
|
sl@0
|
56 |
test(r==KErrNone);
|
sl@0
|
57 |
|
sl@0
|
58 |
TBuf<40> dllfilenames;
|
sl@0
|
59 |
TBuf<40> dlldestination;
|
sl@0
|
60 |
|
sl@0
|
61 |
for(TInt i=0;i<14;i++)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
dllfilenames=KDllfilename;
|
sl@0
|
64 |
dllfilenames.AppendNum(i);
|
sl@0
|
65 |
dllfilenames +=KDllExt;
|
sl@0
|
66 |
dlldestination=KNewDllName;
|
sl@0
|
67 |
dlldestination.AppendNum(i);
|
sl@0
|
68 |
dlldestination+=KDllExt;
|
sl@0
|
69 |
#ifndef WIN32
|
sl@0
|
70 |
r=fileMan->Copy(dllfilenames,dlldestination, 0);
|
sl@0
|
71 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
72 |
|
sl@0
|
73 |
r=fileMan->Attribs(dlldestination,0, KEntryAttReadOnly,modtime,0);
|
sl@0
|
74 |
test(r==KErrNone);
|
sl@0
|
75 |
#endif
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
TBuf<40> exefilenames;
|
sl@0
|
79 |
TBuf<40> exedestination;
|
sl@0
|
80 |
|
sl@0
|
81 |
for(TInt j=14;j<16;j++)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
exefilenames=KExefilename;
|
sl@0
|
84 |
exefilenames.AppendNum(j);
|
sl@0
|
85 |
exefilenames +=KExeExt;
|
sl@0
|
86 |
exedestination=KNewExeName;
|
sl@0
|
87 |
exedestination.AppendNum(j);
|
sl@0
|
88 |
exedestination+=KExeExt;
|
sl@0
|
89 |
#ifndef WIN32
|
sl@0
|
90 |
r=fileMan->Copy(exefilenames,exedestination,0);
|
sl@0
|
91 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
92 |
|
sl@0
|
93 |
r=fileMan->Attribs(exedestination, 0, KEntryAttReadOnly, modtime, 0);
|
sl@0
|
94 |
test(r==KErrNone);
|
sl@0
|
95 |
#endif
|
sl@0
|
96 |
}
|
sl@0
|
97 |
delete fileMan;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
|
sl@0
|
102 |
#ifndef WIN32
|
sl@0
|
103 |
/*
|
sl@0
|
104 |
void ModifyModuleCapabilties(TUint32 aNewCap, TInt aModuleNumber)
|
sl@0
|
105 |
//
|
sl@0
|
106 |
// Assign new capabilties to a module using raw disk write
|
sl@0
|
107 |
//
|
sl@0
|
108 |
{
|
sl@0
|
109 |
// test.Next(_L("Modify Module Capabilities"));
|
sl@0
|
110 |
|
sl@0
|
111 |
test(aModuleNumber<=15 && aModuleNumber>=0);
|
sl@0
|
112 |
|
sl@0
|
113 |
TBuf<40> dlldestination;
|
sl@0
|
114 |
RFile modFile;
|
sl@0
|
115 |
TInt r=0;
|
sl@0
|
116 |
|
sl@0
|
117 |
SCapabilitySet caps;
|
sl@0
|
118 |
memset(&caps,0,sizeof(caps));
|
sl@0
|
119 |
caps[0] = aNewCap;
|
sl@0
|
120 |
TPtrC8 theNewCaps((TUint8*)(&caps),sizeof(caps));
|
sl@0
|
121 |
|
sl@0
|
122 |
if(aModuleNumber < 14)
|
sl@0
|
123 |
{
|
sl@0
|
124 |
dlldestination=KNewDllName;
|
sl@0
|
125 |
dlldestination.AppendNum(aModuleNumber);
|
sl@0
|
126 |
dlldestination+=KDllExt;
|
sl@0
|
127 |
}
|
sl@0
|
128 |
else
|
sl@0
|
129 |
{
|
sl@0
|
130 |
dlldestination=KNewExeName;
|
sl@0
|
131 |
dlldestination.AppendNum(aModuleNumber);
|
sl@0
|
132 |
dlldestination+=KExeExt;
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
r=modFile.Open(TheFs, dlldestination, EFileWrite);
|
sl@0
|
136 |
test(r==KErrNone);
|
sl@0
|
137 |
r=modFile.Write(_FOFF(E32ImageHeaderV,iS.iCaps), theNewCaps,4);
|
sl@0
|
138 |
test(r==KErrNone);
|
sl@0
|
139 |
modFile.Close();
|
sl@0
|
140 |
|
sl@0
|
141 |
RLibrary lib;
|
sl@0
|
142 |
TCapabilitySet theCaps;
|
sl@0
|
143 |
RLibrary::TInfoBuf info;
|
sl@0
|
144 |
|
sl@0
|
145 |
lib.GetInfo(dlldestination, info);
|
sl@0
|
146 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
147 |
|
sl@0
|
148 |
lib.Close();
|
sl@0
|
149 |
test(theCaps==aNewCap);
|
sl@0
|
150 |
|
sl@0
|
151 |
}
|
sl@0
|
152 |
*/
|
sl@0
|
153 |
#else
|
sl@0
|
154 |
/*
|
sl@0
|
155 |
void ModifyModuleCapabilties(TUint32 aNewCap, TInt aModuleNumber)
|
sl@0
|
156 |
//
|
sl@0
|
157 |
// Wins version (poking values is not quite so simple
|
sl@0
|
158 |
//
|
sl@0
|
159 |
{
|
sl@0
|
160 |
// test.Next(_L("Modify Module Capabilities"));
|
sl@0
|
161 |
test(aModuleNumber<=15 && aModuleNumber>=0);
|
sl@0
|
162 |
|
sl@0
|
163 |
TBuf<40> dlldestination;
|
sl@0
|
164 |
TInt r=0;
|
sl@0
|
165 |
|
sl@0
|
166 |
TPtrC8 theNewCaps((TUint8*)(&aNewCap),sizeof(TUint32));
|
sl@0
|
167 |
|
sl@0
|
168 |
|
sl@0
|
169 |
if(aModuleNumber < 14)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
dlldestination=KNewDllName;
|
sl@0
|
172 |
dlldestination.AppendNum(aModuleNumber);
|
sl@0
|
173 |
dlldestination+=KDllExt;
|
sl@0
|
174 |
}
|
sl@0
|
175 |
else
|
sl@0
|
176 |
{
|
sl@0
|
177 |
dlldestination=KNewExeName;
|
sl@0
|
178 |
dlldestination.AppendNum(aModuleNumber);
|
sl@0
|
179 |
dlldestination+=KExeExt;
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
RLibrary lib2;
|
sl@0
|
183 |
TCapabilitySet theCaps2;
|
sl@0
|
184 |
RLibrary::TInfoBuf info;
|
sl@0
|
185 |
|
sl@0
|
186 |
lib2.GetInfo(dlldestination, info);
|
sl@0
|
187 |
theCaps2=info().iSecurityInfo.iCaps;
|
sl@0
|
188 |
|
sl@0
|
189 |
lib2.Close();
|
sl@0
|
190 |
|
sl@0
|
191 |
TBuf<MAX_PATH> fileName;
|
sl@0
|
192 |
r = MapEmulatedFileName(fileName, dlldestination);
|
sl@0
|
193 |
|
sl@0
|
194 |
HANDLE hFile=Emulator::CreateFile((LPCTSTR)fileName.PtrZ(),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
|
sl@0
|
195 |
if (hFile==INVALID_HANDLE_VALUE)
|
sl@0
|
196 |
return;
|
sl@0
|
197 |
DWORD ret;
|
sl@0
|
198 |
TBuf8<sizeof(TCheckedUid)> checkedUidBuf;
|
sl@0
|
199 |
checkedUidBuf.SetLength(sizeof(TCheckedUid));
|
sl@0
|
200 |
ReadFile(hFile,&checkedUidBuf[0],sizeof(TCheckedUid),&ret,NULL);
|
sl@0
|
201 |
if (ret!=sizeof(TCheckedUid))
|
sl@0
|
202 |
goto close;
|
sl@0
|
203 |
|
sl@0
|
204 |
//Look at PE file for UID section
|
sl@0
|
205 |
{
|
sl@0
|
206 |
const TInt KPeHeaderAddrAddr=0x3c;
|
sl@0
|
207 |
const TInt KPeHeaderAddrSize=0x01;
|
sl@0
|
208 |
const TInt KNumberOfSectionsOffset=0x06;
|
sl@0
|
209 |
const TInt KNumberOfSectionsSize=0x02;
|
sl@0
|
210 |
const TInt KSectionTableOffset=0xf8;
|
sl@0
|
211 |
const TInt KSectionHeaderSize=0x28;
|
sl@0
|
212 |
const TInt KSectionNameLength=0x08;
|
sl@0
|
213 |
const TInt KPtrToRawDataOffset=0x14;
|
sl@0
|
214 |
const TInt KPtrToRawDataSize=0x04;
|
sl@0
|
215 |
const TText8 peText[4]={'P','E',0,0};
|
sl@0
|
216 |
const TText8 uidText[8]={'.','S','Y','M','B','I','A','N'};
|
sl@0
|
217 |
|
sl@0
|
218 |
//Read address of start of PE header
|
sl@0
|
219 |
if (SetFilePointer(hFile,KPeHeaderAddrAddr,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
220 |
goto close;
|
sl@0
|
221 |
TInt peAddr=0;
|
sl@0
|
222 |
ReadFile(hFile,&peAddr,KPeHeaderAddrSize,&ret,NULL);
|
sl@0
|
223 |
if (ret!=KPeHeaderAddrSize)
|
sl@0
|
224 |
goto close;
|
sl@0
|
225 |
|
sl@0
|
226 |
//Check it really is the start of PE header
|
sl@0
|
227 |
if (SetFilePointer(hFile,peAddr,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
228 |
goto close;
|
sl@0
|
229 |
TText8 text[4];
|
sl@0
|
230 |
ReadFile(hFile,text,4,&ret,NULL);
|
sl@0
|
231 |
if (*(TInt32*)text!=*(TInt32*)peText)
|
sl@0
|
232 |
goto close;
|
sl@0
|
233 |
|
sl@0
|
234 |
//Read number of sections
|
sl@0
|
235 |
if (SetFilePointer(hFile,peAddr+KNumberOfSectionsOffset,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
236 |
goto close;
|
sl@0
|
237 |
TInt sections=0;
|
sl@0
|
238 |
ReadFile(hFile,§ions,KNumberOfSectionsSize,&ret,NULL);
|
sl@0
|
239 |
if (ret!=KNumberOfSectionsSize)
|
sl@0
|
240 |
goto close;
|
sl@0
|
241 |
|
sl@0
|
242 |
//Go through section headers looking for UID section
|
sl@0
|
243 |
if (SetFilePointer(hFile,peAddr+KSectionTableOffset,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
244 |
goto close;
|
sl@0
|
245 |
TInt i=0;
|
sl@0
|
246 |
for(;i<sections;i++)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
TText8 name[KSectionNameLength];
|
sl@0
|
249 |
ReadFile(hFile,name,KSectionNameLength,&ret,NULL);
|
sl@0
|
250 |
if (ret!=KSectionNameLength)
|
sl@0
|
251 |
goto close;
|
sl@0
|
252 |
if (*(TInt64*)name==*(TInt64*)uidText)
|
sl@0
|
253 |
break;
|
sl@0
|
254 |
if (SetFilePointer(hFile,KSectionHeaderSize-KSectionNameLength,0,FILE_CURRENT)==0xFFFFFFFF)
|
sl@0
|
255 |
goto close;
|
sl@0
|
256 |
}
|
sl@0
|
257 |
if (i==sections)
|
sl@0
|
258 |
goto close;
|
sl@0
|
259 |
|
sl@0
|
260 |
//Read RVA/Offset
|
sl@0
|
261 |
if (SetFilePointer(hFile,KPtrToRawDataOffset-KSectionNameLength,0,FILE_CURRENT)==0xFFFFFFFF)
|
sl@0
|
262 |
goto close;
|
sl@0
|
263 |
TInt uidOffset;
|
sl@0
|
264 |
ReadFile(hFile,&uidOffset,KPtrToRawDataSize,&ret,NULL);
|
sl@0
|
265 |
if (ret!=KPtrToRawDataSize)
|
sl@0
|
266 |
goto close;
|
sl@0
|
267 |
|
sl@0
|
268 |
//SYMBIAN Header
|
sl@0
|
269 |
if (SetFilePointer(hFile,uidOffset,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
270 |
goto close;
|
sl@0
|
271 |
|
sl@0
|
272 |
TEmulatorImageHeader header;
|
sl@0
|
273 |
|
sl@0
|
274 |
ReadFile(hFile,&header,sizeof(header),&ret,NULL);
|
sl@0
|
275 |
if (ret!=sizeof(header))
|
sl@0
|
276 |
goto close;
|
sl@0
|
277 |
|
sl@0
|
278 |
// DON'T modify, for now header.iS.iCaps[0] = aNewCap; //assign new caps to binary
|
sl@0
|
279 |
|
sl@0
|
280 |
|
sl@0
|
281 |
if (SetFilePointer(hFile,uidOffset,0,FILE_BEGIN)==0xFFFFFFFF)
|
sl@0
|
282 |
goto close;
|
sl@0
|
283 |
|
sl@0
|
284 |
BOOL b = WriteFile(hFile,&header,sizeof(header),&ret,NULL);
|
sl@0
|
285 |
if (b==FALSE)
|
sl@0
|
286 |
goto close;
|
sl@0
|
287 |
CloseHandle(hFile);
|
sl@0
|
288 |
|
sl@0
|
289 |
RLibrary lib;
|
sl@0
|
290 |
TCapabilitySet theCaps;
|
sl@0
|
291 |
RLibrary::TInfoBuf info;
|
sl@0
|
292 |
lib.GetInfo(dlldestination, info);
|
sl@0
|
293 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
294 |
|
sl@0
|
295 |
lib.Close();
|
sl@0
|
296 |
|
sl@0
|
297 |
SCapabilitySet& realCaps = (SCapabilitySet&) theCaps;
|
sl@0
|
298 |
// broke! test(realCaps[0] == aNewCap && realCaps[1] == 0);
|
sl@0
|
299 |
return;
|
sl@0
|
300 |
}
|
sl@0
|
301 |
|
sl@0
|
302 |
//Close file
|
sl@0
|
303 |
close:
|
sl@0
|
304 |
CloseHandle(hFile);
|
sl@0
|
305 |
test(0);
|
sl@0
|
306 |
}
|
sl@0
|
307 |
*/
|
sl@0
|
308 |
#endif
|
sl@0
|
309 |
|
sl@0
|
310 |
/*
|
sl@0
|
311 |
void TestGetCapability()
|
sl@0
|
312 |
//
|
sl@0
|
313 |
// test RLibrary::GetCapabilites
|
sl@0
|
314 |
//
|
sl@0
|
315 |
{
|
sl@0
|
316 |
RLibrary library;
|
sl@0
|
317 |
TInt r;
|
sl@0
|
318 |
test.Next(_L("Test RLibrary::GetCapabilities()"));
|
sl@0
|
319 |
|
sl@0
|
320 |
// These tests check the error code returned by the (deprecated) GetCapability method
|
sl@0
|
321 |
// and now serve no useful purpose
|
sl@0
|
322 |
// TCapability theCaps;
|
sl@0
|
323 |
// r=library.GetCapability(theCaps,_L("Z:\\Mongolia"));
|
sl@0
|
324 |
// test(r==KErrNotFound);
|
sl@0
|
325 |
// r=library.GetCapability(theCaps,_L("C:\\Malawi.Fip"));
|
sl@0
|
326 |
// test(r==KErrNotFound);
|
sl@0
|
327 |
|
sl@0
|
328 |
TCapabilitySet theCaps;
|
sl@0
|
329 |
RLibrary::TInfoBuf info;
|
sl@0
|
330 |
#if defined __WINS__
|
sl@0
|
331 |
|
sl@0
|
332 |
|
sl@0
|
333 |
|
sl@0
|
334 |
|
sl@0
|
335 |
test.Next(_L("Get caps of an existing library"));
|
sl@0
|
336 |
// r=lib1.GetCapability(theCaps,_L("ECONS"));
|
sl@0
|
337 |
// test(r==KErrNone);
|
sl@0
|
338 |
RLibrary lib1;
|
sl@0
|
339 |
// r=lib1.GetInfo(_L("ECONS"), info);
|
sl@0
|
340 |
r=lib1.GetInfo(_L("Z:\\SYS\\BIN\\ECONS"), info);
|
sl@0
|
341 |
test(r==KErrNone);
|
sl@0
|
342 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
343 |
|
sl@0
|
344 |
test.Next(_L("And again"));
|
sl@0
|
345 |
// r=lib2.GetCapability(theCaps,_L("ECONS.DLL"));
|
sl@0
|
346 |
// test(r==KErrNone);
|
sl@0
|
347 |
RLibrary lib2;
|
sl@0
|
348 |
lib2.GetInfo(_L("ECONS.DLL"), info);
|
sl@0
|
349 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
350 |
|
sl@0
|
351 |
#else
|
sl@0
|
352 |
// This test checks for the correct return value from the (deprecated)
|
sl@0
|
353 |
// method GetCapability, and now serves no useful purpose??
|
sl@0
|
354 |
// r=library.GetCapability(theCaps,_L("Malawi.Fip"));
|
sl@0
|
355 |
// test(r==KErrNotSupported);
|
sl@0
|
356 |
library.GetInfo(_L("Malawi.Fip"), info);
|
sl@0
|
357 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
358 |
|
sl@0
|
359 |
//TODO uncomment when in ssytem bin
|
sl@0
|
360 |
// RLibrary lib1;
|
sl@0
|
361 |
// test.Next(_L("Get caps of an existing library"));
|
sl@0
|
362 |
// r=lib1.GetCapability(theCaps,_L("ECONS"));
|
sl@0
|
363 |
// r=lib1.GetCapability(theCaps,_L("Z:\\Sys\\Bin\\ECONS"));
|
sl@0
|
364 |
// RDebug::Print(_L("r====%d"),r);
|
sl@0
|
365 |
// test(r==KErrNone);
|
sl@0
|
366 |
|
sl@0
|
367 |
// RLibrary lib2;
|
sl@0
|
368 |
// test.Next(_L("And again"));
|
sl@0
|
369 |
// r=lib2.GetCapability(theCaps,_L("Z:\\Sys\\Bin\\ECONS.DLL"));
|
sl@0
|
370 |
// r=lib2.GetCapability(theCaps,_L("ECONS.DLL"));
|
sl@0
|
371 |
// test(r==KErrNone);
|
sl@0
|
372 |
|
sl@0
|
373 |
RLibrary lib3;
|
sl@0
|
374 |
test.Next(_L("And again, but searching"));
|
sl@0
|
375 |
r=lib3.GetCapability(theCaps,_L("ECONS.DLL"));
|
sl@0
|
376 |
test(r==KErrNotSupported);
|
sl@0
|
377 |
lib3.Close();
|
sl@0
|
378 |
|
sl@0
|
379 |
#endif
|
sl@0
|
380 |
|
sl@0
|
381 |
test.Next(_L("Search through DLLs from t_ldrcheck"));
|
sl@0
|
382 |
|
sl@0
|
383 |
// Not sure of the benefit of this test ??
|
sl@0
|
384 |
|
sl@0
|
385 |
TBuf<40> dllfilenames;
|
sl@0
|
386 |
RLibrary tlib;
|
sl@0
|
387 |
// TCapability deecaps;
|
sl@0
|
388 |
TCapabilitySet deecaps;
|
sl@0
|
389 |
for(TInt i=0;i<13;i++)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
dllfilenames=KDllfilename;
|
sl@0
|
392 |
dllfilenames.AppendNum(i);
|
sl@0
|
393 |
dllfilenames +=KDllExt;
|
sl@0
|
394 |
// r=tlib.GetCapability(deecaps,dllfilenames);
|
sl@0
|
395 |
tlib.GetInfo(dllfilenames, info);
|
sl@0
|
396 |
theCaps=info().iSecurityInfo.iCaps;
|
sl@0
|
397 |
}
|
sl@0
|
398 |
|
sl@0
|
399 |
test.Next(_L("Close()"));
|
sl@0
|
400 |
tlib.Close();
|
sl@0
|
401 |
library.Close();
|
sl@0
|
402 |
// lib1.Close();
|
sl@0
|
403 |
// lib2.Close();
|
sl@0
|
404 |
}
|
sl@0
|
405 |
*/
|
sl@0
|
406 |
|
sl@0
|
407 |
TInt LoadExe(TInt aModuleNum, RProcess& aProcess)
|
sl@0
|
408 |
//
|
sl@0
|
409 |
// Load executable
|
sl@0
|
410 |
//
|
sl@0
|
411 |
{
|
sl@0
|
412 |
TFileName fn;
|
sl@0
|
413 |
//#ifndef WIN32
|
sl@0
|
414 |
// fn =KSystemLibs();
|
sl@0
|
415 |
//#endif
|
sl@0
|
416 |
TBuf<16> cmd;
|
sl@0
|
417 |
fn += MODULE_FILENAME(aModuleNum);
|
sl@0
|
418 |
TInt r=aProcess.Create(fn, cmd);
|
sl@0
|
419 |
return r;
|
sl@0
|
420 |
}
|
sl@0
|
421 |
|
sl@0
|
422 |
|
sl@0
|
423 |
void TestLoad(TInt aSequence)
|
sl@0
|
424 |
//
|
sl@0
|
425 |
// Test doing the loads using sequence number to get the results
|
sl@0
|
426 |
//
|
sl@0
|
427 |
{
|
sl@0
|
428 |
test.Next(_L("Test all single EXE/DLL combinations\n"));
|
sl@0
|
429 |
TInt r=0;
|
sl@0
|
430 |
test.Next(_L("New EXE"));
|
sl@0
|
431 |
RProcess p;
|
sl@0
|
432 |
|
sl@0
|
433 |
r=LoadExe(14,p);
|
sl@0
|
434 |
test.Printf(_L("LoadExe(14)->%d, Expected %d, seq %d \n"),r,ModuleResultsA[aSequence], aSequence);
|
sl@0
|
435 |
test(r==ModuleResultsA[aSequence]);
|
sl@0
|
436 |
if (r==KErrNone)
|
sl@0
|
437 |
p.Terminate(0);
|
sl@0
|
438 |
p.Close();
|
sl@0
|
439 |
|
sl@0
|
440 |
r=LoadExe(15,p);
|
sl@0
|
441 |
test.Printf(_L("LoadExe(15)->%d, seq %d\n"),r,aSequence);
|
sl@0
|
442 |
test(r==ModuleResultsA[aSequence]);
|
sl@0
|
443 |
if (r==KErrNone)
|
sl@0
|
444 |
p.Terminate(0);
|
sl@0
|
445 |
p.Close();
|
sl@0
|
446 |
}
|
sl@0
|
447 |
|
sl@0
|
448 |
/*
|
sl@0
|
449 |
void TestLoadLibrary()
|
sl@0
|
450 |
//
|
sl@0
|
451 |
// test using load library to load dlls with out rom time dependancies
|
sl@0
|
452 |
//
|
sl@0
|
453 |
{
|
sl@0
|
454 |
test.Next(_L("Test loading libraries fromn this exe"));
|
sl@0
|
455 |
|
sl@0
|
456 |
RLibrary lib;
|
sl@0
|
457 |
TInt r=0;
|
sl@0
|
458 |
//I want to load 6 7 and 11 as these are of most interest
|
sl@0
|
459 |
|
sl@0
|
460 |
for(TInt i=0;i<KTestCases;i++)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
for(TInt mod=0 ; mod < 16 ; mod++) //each module
|
sl@0
|
463 |
{
|
sl@0
|
464 |
ModifyModuleCapabilties(ModuleCaps[mod][i],mod);
|
sl@0
|
465 |
}
|
sl@0
|
466 |
r=lib.Load(KDll11);
|
sl@0
|
467 |
test.Printf(_L("mod11, iter=%d, ret=%d, exp=%d"),i,r,ModuleResultsB[i]);
|
sl@0
|
468 |
test(r==ModuleResultsB[i]);
|
sl@0
|
469 |
lib.Close();
|
sl@0
|
470 |
r=lib.Load(KDll6);
|
sl@0
|
471 |
test.Printf(_L("mod6, iter=%d, ret=%d, exp=%d"),i,r,ModuleResultsB[i]);
|
sl@0
|
472 |
test(r==ModuleResultsB[i]);
|
sl@0
|
473 |
lib.Close();
|
sl@0
|
474 |
r=lib.Load(KDll7);
|
sl@0
|
475 |
test.Printf(_L("mod7, iter=%d, ret=%d, exp=%d"),i,r,ModuleResultsC[i]);
|
sl@0
|
476 |
test(r==ModuleResultsC[i]);
|
sl@0
|
477 |
lib.Close();
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
}
|
sl@0
|
481 |
*/
|
sl@0
|
482 |
/*
|
sl@0
|
483 |
void TestLoading()
|
sl@0
|
484 |
//
|
sl@0
|
485 |
// test loading various dependancies
|
sl@0
|
486 |
//
|
sl@0
|
487 |
{
|
sl@0
|
488 |
for(TInt tstcase=0; tstcase < KTestCases; tstcase++) //each test case
|
sl@0
|
489 |
{
|
sl@0
|
490 |
for(TInt mod=0 ; mod < 16 ; mod++) //each module
|
sl@0
|
491 |
{
|
sl@0
|
492 |
ModifyModuleCapabilties(ModuleCaps[mod][tstcase],mod);
|
sl@0
|
493 |
}
|
sl@0
|
494 |
TestLoad(tstcase);
|
sl@0
|
495 |
}
|
sl@0
|
496 |
}
|
sl@0
|
497 |
*/
|
sl@0
|
498 |
|
sl@0
|
499 |
|
sl@0
|
500 |
_LIT(KSysHash,"?:\\Sys\\Hash\\");
|
sl@0
|
501 |
const TInt KSlash='\\';
|
sl@0
|
502 |
|
sl@0
|
503 |
/**
|
sl@0
|
504 |
Creates a hash file in c:\\sys\\hash for a given file
|
sl@0
|
505 |
|
sl@0
|
506 |
@param aFileName full path to the file, which hash is to be created
|
sl@0
|
507 |
*/
|
sl@0
|
508 |
void CreateFileHash(const TDesC& aFileName)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
|
sl@0
|
511 |
test.Printf(_L("Create Hash for the file %S\n"), &aFileName);
|
sl@0
|
512 |
|
sl@0
|
513 |
TInt readsize = 1024*2;//to go into header
|
sl@0
|
514 |
HBufC8* block0 = HBufC8::NewL(readsize);
|
sl@0
|
515 |
|
sl@0
|
516 |
TPtr8 fileblock0(block0->Des());
|
sl@0
|
517 |
CSHA1* hasher=CSHA1::NewL();
|
sl@0
|
518 |
|
sl@0
|
519 |
RFile fTarget;
|
sl@0
|
520 |
TInt r= fTarget.Open(TheFs, aFileName, EFileRead);
|
sl@0
|
521 |
test(r==KErrNone);
|
sl@0
|
522 |
TInt size;
|
sl@0
|
523 |
r=fTarget.Size(size);
|
sl@0
|
524 |
TInt offset=0;
|
sl@0
|
525 |
do {
|
sl@0
|
526 |
if((size - offset) < readsize)
|
sl@0
|
527 |
readsize = (size - offset);
|
sl@0
|
528 |
r=fTarget.Read(offset, fileblock0, readsize);
|
sl@0
|
529 |
test(r==KErrNone);
|
sl@0
|
530 |
hasher->Update(fileblock0);
|
sl@0
|
531 |
offset+=readsize;
|
sl@0
|
532 |
}
|
sl@0
|
533 |
while(offset < size);
|
sl@0
|
534 |
|
sl@0
|
535 |
r=fTarget.Read(fileblock0, (size - offset));
|
sl@0
|
536 |
test(r==KErrNone);
|
sl@0
|
537 |
hasher->Update(fileblock0);
|
sl@0
|
538 |
|
sl@0
|
539 |
TBuf8<20> hash;//only outputs a 20 byte hash
|
sl@0
|
540 |
hash = hasher->Final();
|
sl@0
|
541 |
fTarget.Close();
|
sl@0
|
542 |
|
sl@0
|
543 |
// const TUint8 * hptr=hash.Ptr();
|
sl@0
|
544 |
// for(TInt i=0;i<20;i++)
|
sl@0
|
545 |
// {
|
sl@0
|
546 |
// RDebug::Print(_L("install hash byte %d = 0x%x\n"),i,hptr[i]);
|
sl@0
|
547 |
// }
|
sl@0
|
548 |
|
sl@0
|
549 |
delete block0;
|
sl@0
|
550 |
delete hasher;
|
sl@0
|
551 |
TEntry entry;
|
sl@0
|
552 |
r=TheFs.Entry(aFileName,entry);
|
sl@0
|
553 |
test(r==KErrNone);
|
sl@0
|
554 |
RFile fHash;
|
sl@0
|
555 |
TBuf<50> hashfile;
|
sl@0
|
556 |
hashfile = KSysHash;
|
sl@0
|
557 |
hashfile[0] = (TUint8) RFs::GetSystemDriveChar();
|
sl@0
|
558 |
TInt slashpos = aFileName.LocateReverse(KSlash);
|
sl@0
|
559 |
hashfile += aFileName.Mid(slashpos+1);
|
sl@0
|
560 |
|
sl@0
|
561 |
//-- create directory for dll hashes
|
sl@0
|
562 |
r=TheFs.MkDirAll(hashfile);
|
sl@0
|
563 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
564 |
|
sl@0
|
565 |
//-- copy / replace given dll hash
|
sl@0
|
566 |
r=fHash.Replace(TheFs, hashfile, EFileWrite);
|
sl@0
|
567 |
test(r==KErrNone);
|
sl@0
|
568 |
r=fHash.Write(hash);
|
sl@0
|
569 |
test(r==KErrNone);
|
sl@0
|
570 |
r=fHash.Size(size);
|
sl@0
|
571 |
test(r==KErrNone);
|
sl@0
|
572 |
test.Printf(_L("hash file size=%d\n"),size);
|
sl@0
|
573 |
fHash.Close();
|
sl@0
|
574 |
|
sl@0
|
575 |
}
|
sl@0
|
576 |
|
sl@0
|
577 |
|
sl@0
|
578 |
/**
|
sl@0
|
579 |
Corrups a file.
|
sl@0
|
580 |
|
sl@0
|
581 |
@param aFileName a full path to the file to corrupt
|
sl@0
|
582 |
@return KErrNone on success
|
sl@0
|
583 |
*/
|
sl@0
|
584 |
static TInt CorruptFile(const TDesC& aFileName)
|
sl@0
|
585 |
{
|
sl@0
|
586 |
test.Printf(_L("Corrupting file %S\n"), &aFileName);
|
sl@0
|
587 |
|
sl@0
|
588 |
RFile corrFile;
|
sl@0
|
589 |
CleanupClosePushL(corrFile);
|
sl@0
|
590 |
|
sl@0
|
591 |
TInt r=corrFile.Open(TheFs, aFileName, EFileWrite);
|
sl@0
|
592 |
if(r != KErrNone)
|
sl@0
|
593 |
return r;
|
sl@0
|
594 |
|
sl@0
|
595 |
TInt size;
|
sl@0
|
596 |
r=corrFile.Size(size);
|
sl@0
|
597 |
if(r != KErrNone)
|
sl@0
|
598 |
return r;
|
sl@0
|
599 |
|
sl@0
|
600 |
TBuf8<2> dat;
|
sl@0
|
601 |
r=corrFile.Read(size - 5, dat);
|
sl@0
|
602 |
if(r != KErrNone)
|
sl@0
|
603 |
return r;
|
sl@0
|
604 |
|
sl@0
|
605 |
dat[0] = (TUint8) ~dat[0];
|
sl@0
|
606 |
|
sl@0
|
607 |
r=corrFile.Write(size - 5, dat);
|
sl@0
|
608 |
if(r != KErrNone)
|
sl@0
|
609 |
return r;
|
sl@0
|
610 |
|
sl@0
|
611 |
CleanupStack::PopAndDestroy(1); //-- corrFile
|
sl@0
|
612 |
|
sl@0
|
613 |
return KErrNone;
|
sl@0
|
614 |
}
|
sl@0
|
615 |
|
sl@0
|
616 |
|
sl@0
|
617 |
#ifndef WIN32
|
sl@0
|
618 |
void TestRemovableMediaWithHash()
|
sl@0
|
619 |
//
|
sl@0
|
620 |
// test loading from removable media and substed drives Both should fail
|
sl@0
|
621 |
//
|
sl@0
|
622 |
{
|
sl@0
|
623 |
test.Next(_L("Testing Removable Media with hashing\n"));
|
sl@0
|
624 |
TInt r=0;
|
sl@0
|
625 |
CFileMan* fileMan=NULL;
|
sl@0
|
626 |
TRAP(r,fileMan=CFileMan::NewL(TheFs));
|
sl@0
|
627 |
test(r==KErrNone);
|
sl@0
|
628 |
|
sl@0
|
629 |
TBuf<30> dllfilenames;
|
sl@0
|
630 |
TBuf<30> dlldestination;
|
sl@0
|
631 |
RLibrary lib;
|
sl@0
|
632 |
|
sl@0
|
633 |
for(TInt i=0;i<14;i++)
|
sl@0
|
634 |
{
|
sl@0
|
635 |
dllfilenames=KNewDllName;
|
sl@0
|
636 |
dllfilenames.AppendNum(i);
|
sl@0
|
637 |
dllfilenames +=KDllExt;
|
sl@0
|
638 |
|
sl@0
|
639 |
dlldestination=KNewDllName;
|
sl@0
|
640 |
dlldestination[0]=gDriveToTest;
|
sl@0
|
641 |
dlldestination.AppendNum(i);
|
sl@0
|
642 |
dlldestination+=KDllExt;
|
sl@0
|
643 |
|
sl@0
|
644 |
r=TheFs.MkDirAll(dlldestination);
|
sl@0
|
645 |
test.Printf(_L("MkDirAll(%S) returned %d\n"), &dlldestination, r);
|
sl@0
|
646 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
647 |
r=fileMan->Copy(dllfilenames,dlldestination, 0);
|
sl@0
|
648 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
649 |
|
sl@0
|
650 |
|
sl@0
|
651 |
//take hash of binary
|
sl@0
|
652 |
CreateFileHash(dlldestination);
|
sl@0
|
653 |
|
sl@0
|
654 |
//load binary as is
|
sl@0
|
655 |
r=lib.Load(dlldestination);
|
sl@0
|
656 |
RDebug::Print(_L("t_ldrcheck: loading %S returned %d\n"),&dlldestination, r);
|
sl@0
|
657 |
|
sl@0
|
658 |
User::After(100000);
|
sl@0
|
659 |
test(r==KErrNone);
|
sl@0
|
660 |
lib.Close();
|
sl@0
|
661 |
test.Printf(_L("Close lib on untouched load\n"));
|
sl@0
|
662 |
|
sl@0
|
663 |
//-- corrupt dll
|
sl@0
|
664 |
r = CorruptFile(dlldestination);
|
sl@0
|
665 |
test(r==KErrNone);
|
sl@0
|
666 |
test.Printf(_L("Binary %S now corrupted\n"), &dlldestination);
|
sl@0
|
667 |
|
sl@0
|
668 |
//load should fail
|
sl@0
|
669 |
test.Printf(_L("loading %S\n"),&dlldestination);
|
sl@0
|
670 |
r=lib.Load(dlldestination);
|
sl@0
|
671 |
test.Printf(_L("load of %S returned %d\n"),&dlldestination,r);
|
sl@0
|
672 |
test(r==KErrPermissionDenied);//as this process has Root caps and the dlls should be loaded with non
|
sl@0
|
673 |
lib.Close();
|
sl@0
|
674 |
test.Printf(_L("Lib close 1\n"));
|
sl@0
|
675 |
|
sl@0
|
676 |
r=TheFs.Delete(dlldestination);
|
sl@0
|
677 |
test.Printf(_L("Delete ret=%d\n"),r);
|
sl@0
|
678 |
test(r==KErrNone);
|
sl@0
|
679 |
}//for(TInt i=0;i<14;i++)
|
sl@0
|
680 |
|
sl@0
|
681 |
|
sl@0
|
682 |
TBuf<30> exefilenames;
|
sl@0
|
683 |
TBuf<30> exedestination;
|
sl@0
|
684 |
RProcess p;
|
sl@0
|
685 |
TBuf<16> cmd;
|
sl@0
|
686 |
|
sl@0
|
687 |
for(TInt j=14;j<16;j++)
|
sl@0
|
688 |
{
|
sl@0
|
689 |
exefilenames=KNewExeName;;
|
sl@0
|
690 |
exefilenames.AppendNum(j);
|
sl@0
|
691 |
exefilenames +=KExeExt;
|
sl@0
|
692 |
|
sl@0
|
693 |
exedestination=KNewExeName;
|
sl@0
|
694 |
exedestination[0]=gDriveToTest;
|
sl@0
|
695 |
exedestination.AppendNum(j);
|
sl@0
|
696 |
exedestination+=KExeExt;
|
sl@0
|
697 |
|
sl@0
|
698 |
r=fileMan->Copy(exefilenames,exedestination,0);
|
sl@0
|
699 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
700 |
|
sl@0
|
701 |
CreateFileHash(exedestination);
|
sl@0
|
702 |
|
sl@0
|
703 |
r=p.Create(exedestination, cmd);
|
sl@0
|
704 |
test(r==KErrNone);
|
sl@0
|
705 |
p.Terminate(0);
|
sl@0
|
706 |
p.Close();
|
sl@0
|
707 |
|
sl@0
|
708 |
r = CorruptFile(exedestination);
|
sl@0
|
709 |
test(r==KErrNone);
|
sl@0
|
710 |
|
sl@0
|
711 |
test.Printf(_L("Binary %S now corrupted\n"), &exedestination);
|
sl@0
|
712 |
|
sl@0
|
713 |
r=p.Create(exedestination, cmd);
|
sl@0
|
714 |
test(r==KErrPermissionDenied);
|
sl@0
|
715 |
// p.Terminate(0); DON'T DO THIS SINCE CREATION FAILED - HANDLE NOT OPENED
|
sl@0
|
716 |
p.Close();
|
sl@0
|
717 |
|
sl@0
|
718 |
r=TheFs.Delete(exedestination);
|
sl@0
|
719 |
test(r==KErrNone);
|
sl@0
|
720 |
|
sl@0
|
721 |
}
|
sl@0
|
722 |
delete fileMan;
|
sl@0
|
723 |
}
|
sl@0
|
724 |
|
sl@0
|
725 |
/*
|
sl@0
|
726 |
void TestRemovableMedia()
|
sl@0
|
727 |
//
|
sl@0
|
728 |
// test loading from removable media and substed drives Both should fail
|
sl@0
|
729 |
//
|
sl@0
|
730 |
{
|
sl@0
|
731 |
test.Next(_L("Testing Removeable Media"));
|
sl@0
|
732 |
TInt r=0;
|
sl@0
|
733 |
CFileMan* fileMan=NULL;
|
sl@0
|
734 |
TRAP(r,fileMan=CFileMan::NewL(TheFs));
|
sl@0
|
735 |
test(r==KErrNone);
|
sl@0
|
736 |
|
sl@0
|
737 |
TBuf<30> dllfilenames;
|
sl@0
|
738 |
TBuf<30> dlldestination;
|
sl@0
|
739 |
RLibrary lib;
|
sl@0
|
740 |
for(TInt i=0;i<14;i++)
|
sl@0
|
741 |
{
|
sl@0
|
742 |
dllfilenames=KNewDllName;
|
sl@0
|
743 |
dllfilenames.AppendNum(i);
|
sl@0
|
744 |
dllfilenames +=KDllExt;
|
sl@0
|
745 |
|
sl@0
|
746 |
dlldestination=KNewDllName;
|
sl@0
|
747 |
dlldestination[0]='D';
|
sl@0
|
748 |
dlldestination.AppendNum(i);
|
sl@0
|
749 |
dlldestination+=KDllExt;
|
sl@0
|
750 |
|
sl@0
|
751 |
r=TheFs.MkDirAll(dlldestination);
|
sl@0
|
752 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
753 |
|
sl@0
|
754 |
r=fileMan->Copy(dllfilenames,dlldestination, 0);
|
sl@0
|
755 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
756 |
|
sl@0
|
757 |
r=lib.Load(dlldestination);
|
sl@0
|
758 |
test.Printf(_L("load %S ret=%d"),&dlldestination,r);
|
sl@0
|
759 |
RDebug::Print(_L("r=%d"),r);
|
sl@0
|
760 |
test(r==KErrPermissionDenied);//as this process has Root caps and the dlls should be loaded with non
|
sl@0
|
761 |
lib.Close();
|
sl@0
|
762 |
}
|
sl@0
|
763 |
|
sl@0
|
764 |
TBuf<30> exefilenames;
|
sl@0
|
765 |
TBuf<30> exedestination;
|
sl@0
|
766 |
RProcess p;
|
sl@0
|
767 |
TBuf<16> cmd;
|
sl@0
|
768 |
|
sl@0
|
769 |
for(TInt j=14;j<16;j++)
|
sl@0
|
770 |
{
|
sl@0
|
771 |
exefilenames=KNewExeName;;
|
sl@0
|
772 |
exefilenames.AppendNum(j);
|
sl@0
|
773 |
exefilenames +=KExeExt;
|
sl@0
|
774 |
|
sl@0
|
775 |
exedestination=KNewExeName;
|
sl@0
|
776 |
exedestination[0]='D';
|
sl@0
|
777 |
exedestination.AppendNum(j);
|
sl@0
|
778 |
exedestination+=KExeExt;
|
sl@0
|
779 |
|
sl@0
|
780 |
r=fileMan->Copy(exefilenames,exedestination,0);
|
sl@0
|
781 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
782 |
|
sl@0
|
783 |
r=p.Create(exedestination, cmd);
|
sl@0
|
784 |
test(r==KErrPermissionDenied);
|
sl@0
|
785 |
p.Close();
|
sl@0
|
786 |
}
|
sl@0
|
787 |
delete fileMan;
|
sl@0
|
788 |
}
|
sl@0
|
789 |
*/
|
sl@0
|
790 |
|
sl@0
|
791 |
void TestNonSystemSubsted()
|
sl@0
|
792 |
//
|
sl@0
|
793 |
// Test an internal drive on non system dir
|
sl@0
|
794 |
//
|
sl@0
|
795 |
{
|
sl@0
|
796 |
test.Next(_L("Testing Non System and Subst"));
|
sl@0
|
797 |
TInt r=0;
|
sl@0
|
798 |
CFileMan* fileMan=NULL;
|
sl@0
|
799 |
TRAP(r,fileMan=CFileMan::NewL(TheFs));
|
sl@0
|
800 |
test(r==KErrNone);
|
sl@0
|
801 |
|
sl@0
|
802 |
TBuf<50> dllfilenames;
|
sl@0
|
803 |
TBuf<50> dlldestination;
|
sl@0
|
804 |
TBuf<50> substed;
|
sl@0
|
805 |
RLibrary lib;
|
sl@0
|
806 |
for(TInt i=0;i<14;i++)
|
sl@0
|
807 |
{
|
sl@0
|
808 |
dllfilenames=KNewDllName;
|
sl@0
|
809 |
dllfilenames.AppendNum(i);
|
sl@0
|
810 |
dllfilenames +=KDllExt;
|
sl@0
|
811 |
|
sl@0
|
812 |
dlldestination=KAnyDirDll;
|
sl@0
|
813 |
dlldestination+=_L("_X");
|
sl@0
|
814 |
dlldestination.AppendNum(i);
|
sl@0
|
815 |
dlldestination+=KDllExt;
|
sl@0
|
816 |
|
sl@0
|
817 |
if(i==0)
|
sl@0
|
818 |
{
|
sl@0
|
819 |
r=TheFs.MkDirAll(dlldestination);
|
sl@0
|
820 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
821 |
r=TheFs.SetSubst(KAnyDirShort(), EDriveN); //set up n as the substed drive
|
sl@0
|
822 |
test(r==KErrNone);
|
sl@0
|
823 |
}
|
sl@0
|
824 |
|
sl@0
|
825 |
RDebug::Print(_L("copying from %S to %S"),&dllfilenames,&dlldestination);
|
sl@0
|
826 |
r=fileMan->Copy(dllfilenames,dlldestination, 0);
|
sl@0
|
827 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
828 |
|
sl@0
|
829 |
//
|
sl@0
|
830 |
// Test that loading from fully qualified path fails
|
sl@0
|
831 |
// (ie - C:\Anyoldname\sys\bin\DLLTS_X0.DLL)
|
sl@0
|
832 |
//
|
sl@0
|
833 |
r=lib.Load(dlldestination);
|
sl@0
|
834 |
RDebug::Print(_L("RLibrary::Load(%S) : r=%d"), &dlldestination, r);
|
sl@0
|
835 |
test(r==KErrNotFound);
|
sl@0
|
836 |
|
sl@0
|
837 |
//
|
sl@0
|
838 |
// Test that loading from substituted drive fails
|
sl@0
|
839 |
// (ie - N:\sys\bin\DLLTS_X0.DLL, where N:\ == C:\Anyoldname\)
|
sl@0
|
840 |
//
|
sl@0
|
841 |
substed=KJDllName;
|
sl@0
|
842 |
substed+=_L("_X");
|
sl@0
|
843 |
substed.AppendNum(i);
|
sl@0
|
844 |
substed+=KDllExt;
|
sl@0
|
845 |
|
sl@0
|
846 |
r=lib.Load(substed);
|
sl@0
|
847 |
RDebug::Print(_L("RLibrary::Load(%S) : r=%d"), &substed, r);
|
sl@0
|
848 |
test(r==KErrNotFound);
|
sl@0
|
849 |
|
sl@0
|
850 |
//
|
sl@0
|
851 |
// Test that loader search does not find substituted drives when
|
sl@0
|
852 |
// loading library with no drive or path specified.
|
sl@0
|
853 |
//
|
sl@0
|
854 |
substed=KJDllNameOnly;
|
sl@0
|
855 |
substed+=_L("_X");
|
sl@0
|
856 |
substed.AppendNum(i);
|
sl@0
|
857 |
substed+=KDllExt;
|
sl@0
|
858 |
|
sl@0
|
859 |
r=lib.Load(substed);
|
sl@0
|
860 |
RDebug::Print(_L("RLibrary::Load(%S) : r=%d"), &substed, r);
|
sl@0
|
861 |
test(r==KErrNotFound);
|
sl@0
|
862 |
}
|
sl@0
|
863 |
|
sl@0
|
864 |
TBuf<50> exefilenames;
|
sl@0
|
865 |
TBuf<50> exedestination;
|
sl@0
|
866 |
RProcess p;
|
sl@0
|
867 |
TBuf<16> cmd;
|
sl@0
|
868 |
|
sl@0
|
869 |
for(TInt j=14;j<16;j++)
|
sl@0
|
870 |
{
|
sl@0
|
871 |
exefilenames=KNewExeName;;
|
sl@0
|
872 |
exefilenames.AppendNum(j);
|
sl@0
|
873 |
exefilenames +=KExeExt;
|
sl@0
|
874 |
|
sl@0
|
875 |
exedestination=KAnyDirExe;
|
sl@0
|
876 |
exedestination+=_L("_X");
|
sl@0
|
877 |
exedestination.AppendNum(j);
|
sl@0
|
878 |
exedestination+=KExeExt;
|
sl@0
|
879 |
|
sl@0
|
880 |
RDebug::Print(_L("copying from %S to %S"),&exefilenames,&exedestination);
|
sl@0
|
881 |
r=fileMan->Copy(exefilenames,exedestination,0);
|
sl@0
|
882 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
883 |
|
sl@0
|
884 |
//
|
sl@0
|
885 |
// Test that loading from fully qualified path fails
|
sl@0
|
886 |
// (ie - C:\Anyoldname\sys\bin\EXETS_X14.EXE)
|
sl@0
|
887 |
//
|
sl@0
|
888 |
r=p.Create(exedestination, cmd);
|
sl@0
|
889 |
RDebug::Print(_L("RProcess::Create(%S) : r=%d"), &exedestination, r);
|
sl@0
|
890 |
test(r==KErrNotFound);
|
sl@0
|
891 |
|
sl@0
|
892 |
//
|
sl@0
|
893 |
// Test that loading from substituted drive fails
|
sl@0
|
894 |
// (ie - N:\sys\bin\EXETS_X14.EXE, where N:\ == C:\Anyoldname\)
|
sl@0
|
895 |
//
|
sl@0
|
896 |
substed=KJExeName;
|
sl@0
|
897 |
substed+=_L("_X");
|
sl@0
|
898 |
substed.AppendNum(j);
|
sl@0
|
899 |
substed+=KExeExt;
|
sl@0
|
900 |
|
sl@0
|
901 |
r=p.Create(substed, cmd);
|
sl@0
|
902 |
RDebug::Print(_L("RProcess::Create(%S) : r=%d"), &substed, r);
|
sl@0
|
903 |
test(r==KErrNotFound);
|
sl@0
|
904 |
|
sl@0
|
905 |
//
|
sl@0
|
906 |
// Test that loader search does not find substituted drives when
|
sl@0
|
907 |
// loading process with no drive or path specified.
|
sl@0
|
908 |
//
|
sl@0
|
909 |
substed=KJExeNameOnly;
|
sl@0
|
910 |
substed+=_L("_X");
|
sl@0
|
911 |
substed.AppendNum(j);
|
sl@0
|
912 |
substed+=KExeExt;
|
sl@0
|
913 |
|
sl@0
|
914 |
r=p.Create(substed, cmd);
|
sl@0
|
915 |
RDebug::Print(_L("RProcess::Create(%S) : r=%d"), &substed, r);
|
sl@0
|
916 |
test(r==KErrNotFound);
|
sl@0
|
917 |
}
|
sl@0
|
918 |
delete fileMan;
|
sl@0
|
919 |
|
sl@0
|
920 |
// Clear the substituted drive
|
sl@0
|
921 |
r=TheFs.SetSubst(KNullDesC, EDriveN);
|
sl@0
|
922 |
test(r==KErrNone);
|
sl@0
|
923 |
}
|
sl@0
|
924 |
|
sl@0
|
925 |
/*
|
sl@0
|
926 |
void TestSystemBinSubsted()
|
sl@0
|
927 |
//
|
sl@0
|
928 |
// Test an internal drive on system dir
|
sl@0
|
929 |
//
|
sl@0
|
930 |
{
|
sl@0
|
931 |
test.Next(_L("Testing System bin -> Subst"));
|
sl@0
|
932 |
TInt r=0;
|
sl@0
|
933 |
CFileMan* fileMan=NULL;
|
sl@0
|
934 |
TRAP(r,fileMan=CFileMan::NewL(TheFs));
|
sl@0
|
935 |
test(r==KErrNone);
|
sl@0
|
936 |
|
sl@0
|
937 |
TBuf<50> dllfilenames;
|
sl@0
|
938 |
TBuf<50> substed;
|
sl@0
|
939 |
RLibrary lib;
|
sl@0
|
940 |
r=TheFs.SetSubst(KSystemLibs, 14); //set up O as the substed drive
|
sl@0
|
941 |
test(r==KErrNone);
|
sl@0
|
942 |
for(TInt i=0;i<14;i++)
|
sl@0
|
943 |
{
|
sl@0
|
944 |
RDebug::Print(_L("doing modify caps = %d"),i);
|
sl@0
|
945 |
ModifyModuleCapabilties(KCapabilityRoot,i);
|
sl@0
|
946 |
dllfilenames=KNewDllName;
|
sl@0
|
947 |
dllfilenames.AppendNum(i);
|
sl@0
|
948 |
dllfilenames +=KDllExt;
|
sl@0
|
949 |
|
sl@0
|
950 |
RDebug::Print(_L("Module = %S"),&dllfilenames);
|
sl@0
|
951 |
r=lib.Load(dllfilenames);
|
sl@0
|
952 |
test(r==KErrNone);//as this process has Root caps and the dlls should be loaded with non
|
sl@0
|
953 |
substed=_L("O:\\DLLTS");
|
sl@0
|
954 |
substed.AppendNum(i);
|
sl@0
|
955 |
substed+=KDllExt;
|
sl@0
|
956 |
|
sl@0
|
957 |
r=lib.Load(substed);
|
sl@0
|
958 |
test(r==KErrNone);
|
sl@0
|
959 |
lib.Close();
|
sl@0
|
960 |
}
|
sl@0
|
961 |
TBuf<50> exefilenames;
|
sl@0
|
962 |
RProcess p;
|
sl@0
|
963 |
TBuf<16> cmd;
|
sl@0
|
964 |
|
sl@0
|
965 |
for(TInt j=14;j<16;j++)
|
sl@0
|
966 |
{
|
sl@0
|
967 |
exefilenames=KNewExeName;
|
sl@0
|
968 |
exefilenames.AppendNum(j);
|
sl@0
|
969 |
exefilenames +=KExeExt;
|
sl@0
|
970 |
ModifyModuleCapabilties(KCapabilityRoot,j);
|
sl@0
|
971 |
r=p.Create(exefilenames, cmd);
|
sl@0
|
972 |
test(r==KErrNone);
|
sl@0
|
973 |
p.Terminate(0);
|
sl@0
|
974 |
p.Close();
|
sl@0
|
975 |
|
sl@0
|
976 |
|
sl@0
|
977 |
substed=_L("O:\\EXETS");
|
sl@0
|
978 |
substed.AppendNum(j);
|
sl@0
|
979 |
substed+=KExeExt;
|
sl@0
|
980 |
RDebug::Print(_L("substed=%S"),&substed);
|
sl@0
|
981 |
r=p.Create(substed, cmd);
|
sl@0
|
982 |
test(r==KErrNone);
|
sl@0
|
983 |
p.Terminate(0);
|
sl@0
|
984 |
p.Close();
|
sl@0
|
985 |
}
|
sl@0
|
986 |
delete fileMan;
|
sl@0
|
987 |
}
|
sl@0
|
988 |
*/
|
sl@0
|
989 |
#endif
|
sl@0
|
990 |
|
sl@0
|
991 |
|
sl@0
|
992 |
|
sl@0
|
993 |
void HashBM()
|
sl@0
|
994 |
//
|
sl@0
|
995 |
// time how long to load a small dll 100 times and one large one
|
sl@0
|
996 |
//
|
sl@0
|
997 |
{
|
sl@0
|
998 |
test.Next(_L("Next Do Bench Mark\n"));
|
sl@0
|
999 |
TBuf<30> dlldestination;
|
sl@0
|
1000 |
dlldestination=KNewDllName;
|
sl@0
|
1001 |
dlldestination[0]='D';
|
sl@0
|
1002 |
dlldestination.AppendNum(1);
|
sl@0
|
1003 |
dlldestination+=KDllExt;
|
sl@0
|
1004 |
RLibrary lib;
|
sl@0
|
1005 |
TInt r=0;
|
sl@0
|
1006 |
TUint32 startcount = User::NTickCount();
|
sl@0
|
1007 |
for (TInt i=0;i<100;i++)
|
sl@0
|
1008 |
{
|
sl@0
|
1009 |
r=lib.Load(dlldestination);
|
sl@0
|
1010 |
lib.Close();
|
sl@0
|
1011 |
}
|
sl@0
|
1012 |
TUint32 endcount = User::NTickCount();
|
sl@0
|
1013 |
test(r==KErrNone);
|
sl@0
|
1014 |
RDebug::Print(_L("100 * 4k dll \n"));
|
sl@0
|
1015 |
RDebug::Print(_L("start count=%d, end count=%d, dif=%d\n"),startcount,endcount,endcount-startcount);
|
sl@0
|
1016 |
|
sl@0
|
1017 |
startcount = User::NTickCount();
|
sl@0
|
1018 |
r=lib.Load(_L("D:\\sys\\bin\\euser.dll"));
|
sl@0
|
1019 |
lib.Close();
|
sl@0
|
1020 |
endcount = User::NTickCount();
|
sl@0
|
1021 |
RDebug::Print(_L("r=%d"));
|
sl@0
|
1022 |
// test(r==KErrNone);
|
sl@0
|
1023 |
RDebug::Print(_L("1 * 233k dll \n"));
|
sl@0
|
1024 |
RDebug::Print(_L("start count=%d, end count=%d, dif=%d\n"),startcount,endcount,endcount-startcount);
|
sl@0
|
1025 |
}
|
sl@0
|
1026 |
|
sl@0
|
1027 |
//-------------------------------------------------------
|
sl@0
|
1028 |
|
sl@0
|
1029 |
/**
|
sl@0
|
1030 |
testing RLoader::CheckLibraryHash() API
|
sl@0
|
1031 |
*/
|
sl@0
|
1032 |
void TestCheckLibraryHash()
|
sl@0
|
1033 |
{
|
sl@0
|
1034 |
test.Next(_L("Testing CheckLibraryHash API\n"));
|
sl@0
|
1035 |
|
sl@0
|
1036 |
TInt r=0;
|
sl@0
|
1037 |
CFileMan* pFileMan=NULL;
|
sl@0
|
1038 |
TRAP(r,pFileMan=CFileMan::NewL(TheFs));
|
sl@0
|
1039 |
test(r==KErrNone);
|
sl@0
|
1040 |
|
sl@0
|
1041 |
RLoader loader;
|
sl@0
|
1042 |
r=loader.Connect();
|
sl@0
|
1043 |
test(r==KErrNone);
|
sl@0
|
1044 |
|
sl@0
|
1045 |
//-- 1. copy test DLL to the specified drive and create hash file for it.
|
sl@0
|
1046 |
TBuf<40> dllFileName;
|
sl@0
|
1047 |
TBuf<40> dllDestination;
|
sl@0
|
1048 |
|
sl@0
|
1049 |
const TInt KDllNumber = 0;
|
sl@0
|
1050 |
|
sl@0
|
1051 |
dllFileName=KDllfilename;
|
sl@0
|
1052 |
dllFileName.AppendNum(KDllNumber);
|
sl@0
|
1053 |
dllFileName+=KDllExt;
|
sl@0
|
1054 |
|
sl@0
|
1055 |
dllDestination=KNewDllName;
|
sl@0
|
1056 |
dllDestination[0]=(TUint16)gDriveToTest;
|
sl@0
|
1057 |
dllDestination.AppendNum(KDllNumber);
|
sl@0
|
1058 |
dllDestination+=KDllExt;
|
sl@0
|
1059 |
|
sl@0
|
1060 |
test.Printf(_L("Copy %S to %S\n"), &dllFileName, &dllDestination);
|
sl@0
|
1061 |
|
sl@0
|
1062 |
r=TheFs.MkDirAll(dllDestination);
|
sl@0
|
1063 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
1064 |
|
sl@0
|
1065 |
r=pFileMan->Copy(dllFileName, dllDestination);
|
sl@0
|
1066 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
1067 |
|
sl@0
|
1068 |
r=pFileMan->Attribs(dllDestination, 0, KEntryAttReadOnly, TTime(0) ,0);
|
sl@0
|
1069 |
test(r==KErrNone);
|
sl@0
|
1070 |
|
sl@0
|
1071 |
test.Printf(_L("Creating Dll hash.\n"));
|
sl@0
|
1072 |
CreateFileHash(dllDestination);
|
sl@0
|
1073 |
|
sl@0
|
1074 |
//-- 2. check if the hash exists
|
sl@0
|
1075 |
r=loader.CheckLibraryHash(dllDestination);
|
sl@0
|
1076 |
test(r==KErrNone);
|
sl@0
|
1077 |
test.Printf(_L("Dll hash exists.\n"));
|
sl@0
|
1078 |
|
sl@0
|
1079 |
//-- 2.1 check if the hash exists and valid
|
sl@0
|
1080 |
r=loader.CheckLibraryHash(dllDestination, ETrue);
|
sl@0
|
1081 |
test(r==KErrNone);
|
sl@0
|
1082 |
|
sl@0
|
1083 |
test.Printf(_L("Dll hash exists and valid.\n"));
|
sl@0
|
1084 |
|
sl@0
|
1085 |
//-- 3. corrupt dll
|
sl@0
|
1086 |
r = CorruptFile(dllDestination);
|
sl@0
|
1087 |
test(r==KErrNone);
|
sl@0
|
1088 |
|
sl@0
|
1089 |
//-- 3.1 check that the hash exists, but is incorrect.
|
sl@0
|
1090 |
r=loader.CheckLibraryHash(dllDestination);
|
sl@0
|
1091 |
test(r==KErrNone);
|
sl@0
|
1092 |
test.Printf(_L("Dll hash exists.\n"));
|
sl@0
|
1093 |
|
sl@0
|
1094 |
r=loader.CheckLibraryHash(dllDestination, ETrue);
|
sl@0
|
1095 |
test(r==KErrCorrupt);
|
sl@0
|
1096 |
|
sl@0
|
1097 |
test.Printf(_L("Dll hash exists and INVALID.\n"));
|
sl@0
|
1098 |
|
sl@0
|
1099 |
//-- 4. try to locte hash fo the unexisting dll.
|
sl@0
|
1100 |
r=loader.CheckLibraryHash(_L("Z:\\sys\\bin\\NotExist.dll"));
|
sl@0
|
1101 |
test(r==KErrNotFound);
|
sl@0
|
1102 |
|
sl@0
|
1103 |
loader.Close();
|
sl@0
|
1104 |
|
sl@0
|
1105 |
delete pFileMan;
|
sl@0
|
1106 |
}
|
sl@0
|
1107 |
|
sl@0
|
1108 |
//-------------------------------------------------------
|
sl@0
|
1109 |
|
sl@0
|
1110 |
void ParseCommandArguments()
|
sl@0
|
1111 |
//
|
sl@0
|
1112 |
//
|
sl@0
|
1113 |
//
|
sl@0
|
1114 |
{
|
sl@0
|
1115 |
TBuf<0x100> cmd;
|
sl@0
|
1116 |
User::CommandLine(cmd);
|
sl@0
|
1117 |
TLex lex(cmd);
|
sl@0
|
1118 |
TPtrC token=lex.NextToken();
|
sl@0
|
1119 |
TFileName thisfile=RProcess().FileName();
|
sl@0
|
1120 |
if (token.MatchF(thisfile)==0)
|
sl@0
|
1121 |
{
|
sl@0
|
1122 |
token.Set(lex.NextToken());
|
sl@0
|
1123 |
}
|
sl@0
|
1124 |
test.Printf(_L("CLP=%S"),&token);
|
sl@0
|
1125 |
|
sl@0
|
1126 |
if(token.Length()!=0)
|
sl@0
|
1127 |
{
|
sl@0
|
1128 |
gDriveToTest=token[0];
|
sl@0
|
1129 |
gDriveToTest.UpperCase();
|
sl@0
|
1130 |
}
|
sl@0
|
1131 |
else
|
sl@0
|
1132 |
gDriveToTest='D'; //default to D:
|
sl@0
|
1133 |
}
|
sl@0
|
1134 |
|
sl@0
|
1135 |
|
sl@0
|
1136 |
//-------------------------------------------------------
|
sl@0
|
1137 |
|
sl@0
|
1138 |
void TestExes()
|
sl@0
|
1139 |
{
|
sl@0
|
1140 |
test.Next(_L("Testing Exes presence.\n"));
|
sl@0
|
1141 |
|
sl@0
|
1142 |
TInt r;
|
sl@0
|
1143 |
|
sl@0
|
1144 |
RProcess ap;
|
sl@0
|
1145 |
r=LoadExe(14,ap);
|
sl@0
|
1146 |
test(r==KErrNone);
|
sl@0
|
1147 |
ap.Terminate(0);
|
sl@0
|
1148 |
ap.Close();
|
sl@0
|
1149 |
|
sl@0
|
1150 |
r=LoadExe(15,ap);
|
sl@0
|
1151 |
test(r==KErrNone);
|
sl@0
|
1152 |
ap.Terminate(0);
|
sl@0
|
1153 |
ap.Close();
|
sl@0
|
1154 |
}
|
sl@0
|
1155 |
|
sl@0
|
1156 |
|
sl@0
|
1157 |
//-------------------------------------------------------
|
sl@0
|
1158 |
|
sl@0
|
1159 |
static void CallTestsL(void)
|
sl@0
|
1160 |
{
|
sl@0
|
1161 |
|
sl@0
|
1162 |
#ifdef __WINS__
|
sl@0
|
1163 |
test.Printf(_L("Not testing on WINS !\n"));
|
sl@0
|
1164 |
return;
|
sl@0
|
1165 |
#else
|
sl@0
|
1166 |
|
sl@0
|
1167 |
TestExes();
|
sl@0
|
1168 |
// TestGetCapability();
|
sl@0
|
1169 |
CopyModules(); //copies modules from ROM to disk so they may be modified
|
sl@0
|
1170 |
// TestLoading();
|
sl@0
|
1171 |
// TestLoadLibrary();
|
sl@0
|
1172 |
|
sl@0
|
1173 |
|
sl@0
|
1174 |
#ifndef WIN32
|
sl@0
|
1175 |
if(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin))
|
sl@0
|
1176 |
TestRemovableMediaWithHash();
|
sl@0
|
1177 |
|
sl@0
|
1178 |
// TestSystemBinSubsted();
|
sl@0
|
1179 |
// TestRemovableMedia();
|
sl@0
|
1180 |
TestNonSystemSubsted();
|
sl@0
|
1181 |
#endif //WIN32
|
sl@0
|
1182 |
// HashBM();
|
sl@0
|
1183 |
|
sl@0
|
1184 |
TestCheckLibraryHash();
|
sl@0
|
1185 |
|
sl@0
|
1186 |
#endif //#ifndef __WINS__
|
sl@0
|
1187 |
|
sl@0
|
1188 |
}
|
sl@0
|
1189 |
|
sl@0
|
1190 |
//-------------------------------------------------------
|
sl@0
|
1191 |
//
|
sl@0
|
1192 |
// main
|
sl@0
|
1193 |
//
|
sl@0
|
1194 |
GLDEF_C TInt E32Main()
|
sl@0
|
1195 |
{
|
sl@0
|
1196 |
ParseCommandArguments(); //need this for drive letter to test
|
sl@0
|
1197 |
|
sl@0
|
1198 |
test.Title();
|
sl@0
|
1199 |
test.Start(_L("Setup\n"));
|
sl@0
|
1200 |
CTrapCleanup* cleanup;
|
sl@0
|
1201 |
cleanup=CTrapCleanup::New();
|
sl@0
|
1202 |
__UHEAP_MARK;
|
sl@0
|
1203 |
|
sl@0
|
1204 |
TBuf<20> sessPath;
|
sl@0
|
1205 |
TInt r=0;
|
sl@0
|
1206 |
r=TheFs.Connect();
|
sl@0
|
1207 |
test(r==KErrNone);
|
sl@0
|
1208 |
r=TheFs.SessionPath(sessPath);
|
sl@0
|
1209 |
test(r==KErrNone);
|
sl@0
|
1210 |
|
sl@0
|
1211 |
TInt drive;
|
sl@0
|
1212 |
RFs::CharToDrive(gDriveToTest, drive);
|
sl@0
|
1213 |
TDriveInfo info;
|
sl@0
|
1214 |
r=TheFs.Drive(info, drive);
|
sl@0
|
1215 |
test(r==KErrNone);
|
sl@0
|
1216 |
|
sl@0
|
1217 |
if((info.iDriveAtt & KDriveAttRemovable) == 0)
|
sl@0
|
1218 |
{
|
sl@0
|
1219 |
test.Printf(_L("Not testing on non-removable media !\n"));
|
sl@0
|
1220 |
}
|
sl@0
|
1221 |
else
|
sl@0
|
1222 |
{//-- testing on removable media
|
sl@0
|
1223 |
TRAP(r,CallTestsL());
|
sl@0
|
1224 |
}
|
sl@0
|
1225 |
|
sl@0
|
1226 |
TheFs.Close();
|
sl@0
|
1227 |
test.End();
|
sl@0
|
1228 |
test.Close();
|
sl@0
|
1229 |
|
sl@0
|
1230 |
__UHEAP_MARKEND;
|
sl@0
|
1231 |
delete cleanup;
|
sl@0
|
1232 |
|
sl@0
|
1233 |
return KErrNone;
|
sl@0
|
1234 |
}
|
sl@0
|
1235 |
|
sl@0
|
1236 |
|