1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/loader/tld_helper.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,69 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// \f32test\loader\tld_helper.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include "t_loader_delete.h"
1.22 +#include <e32debug.h>
1.23 +#include <e32ldr.h>
1.24 +#include <e32ldr_private.h>
1.25 +
1.26 +TInt E32Main()
1.27 + {
1.28 +#ifdef __WINS__
1.29 + // don't use JIT if running on emulator because don't want to halt
1.30 + // t_loader_delete test run.
1.31 + User::SetJustInTime(EFalse);
1.32 +#endif
1.33 +
1.34 + TInt r;
1.35 + RProcess p;
1.36 +
1.37 + RLoader l;
1.38 + r = l.Connect();
1.39 + if (r != KErrNone)
1.40 + p.Panic(_L("tldh-noconn"), 0);
1.41 +
1.42 +
1.43 + TFileName fn;
1.44 + User::CommandLine(fn);
1.45 +
1.46 + TBuf16<512> aBuf;
1.47 + aBuf.Copy(fn);
1.48 +
1.49 + if (aBuf.FindF(KBadDescriptor) >= 0)
1.50 + {
1.51 + const TDesC16 *pBuf = &aBuf;
1.52 +
1.53 + ((int*)pBuf)[0] = 0x7554444f; //malformed descriptor
1.54 +
1.55 + RDebug::Print(_L("Calling RLoader::Delete passing as an argument a malformed descriptor %S\n"),&fn );
1.56 +
1.57 + r = l.Delete(*pBuf);
1.58 +
1.59 + // panic with the reason from RLoader::Delete so t_loader_delete
1.60 + // can check for the right error code.
1.61 + p.Panic(KTldPanicCat, r);
1.62 +
1.63 + }
1.64 +
1.65 + // panic with the reason from RLoader::Delete so t_loader_delete
1.66 + // can check for the right error code.
1.67 + r = l.Delete(fn);
1.68 + p.Panic(KTldPanicCat, r);
1.69 +
1.70 + // unused return value - present to prevent compiler warning
1.71 + return KErrNone;
1.72 + }