0
|
1 |
// Copyright (c) 2006-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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// \f32test\loader\tld_helper.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "t_loader_delete.h"
|
|
19 |
#include <e32debug.h>
|
|
20 |
|
|
21 |
|
|
22 |
TInt E32Main()
|
|
23 |
{
|
|
24 |
#ifdef __WINS__
|
|
25 |
// don't use JIT if running on emulator because don't want to halt
|
|
26 |
// t_loader_delete test run.
|
|
27 |
User::SetJustInTime(EFalse);
|
|
28 |
#endif
|
|
29 |
|
|
30 |
TInt r;
|
|
31 |
RProcess p;
|
|
32 |
|
|
33 |
RLoader l;
|
|
34 |
r = l.Connect();
|
|
35 |
if (r != KErrNone)
|
|
36 |
p.Panic(_L("tldh-noconn"), 0);
|
|
37 |
|
|
38 |
|
|
39 |
TFileName fn;
|
|
40 |
User::CommandLine(fn);
|
|
41 |
|
|
42 |
TBuf16<512> aBuf;
|
|
43 |
aBuf.Copy(fn);
|
|
44 |
|
|
45 |
if (aBuf.FindF(KBadDescriptor) >= 0)
|
|
46 |
{
|
|
47 |
const TDesC16 *pBuf = &aBuf;
|
|
48 |
|
|
49 |
((int*)pBuf)[0] = 0x7554444f; //malformed descriptor
|
|
50 |
|
|
51 |
RDebug::Print(_L("Calling RLoader::Delete passing as an argument a malformed descriptor %S\n"),&fn );
|
|
52 |
|
|
53 |
r = l.Delete(*pBuf);
|
|
54 |
|
|
55 |
// panic with the reason from RLoader::Delete so t_loader_delete
|
|
56 |
// can check for the right error code.
|
|
57 |
p.Panic(KTldPanicCat, r);
|
|
58 |
|
|
59 |
}
|
|
60 |
|
|
61 |
// panic with the reason from RLoader::Delete so t_loader_delete
|
|
62 |
// can check for the right error code.
|
|
63 |
r = l.Delete(fn);
|
|
64 |
p.Panic(KTldPanicCat, r);
|
|
65 |
|
|
66 |
// unused return value - present to prevent compiler warning
|
|
67 |
return KErrNone;
|
|
68 |
}
|