os/kernelhwsrv/kerneltest/f32test/loader/tld_helper.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 #include <e32ldr.h>
    21 #include <e32ldr_private.h>
    22 
    23 TInt E32Main()
    24 	{
    25 #ifdef __WINS__
    26 	// don't use JIT if running on emulator because don't want to halt
    27 	// t_loader_delete test run.
    28 	User::SetJustInTime(EFalse);
    29 #endif
    30 
    31 	TInt r;
    32 	RProcess p;
    33 
    34 	RLoader l;
    35 	r = l.Connect();
    36 	if (r != KErrNone)
    37 		p.Panic(_L("tldh-noconn"), 0);
    38 
    39 	
    40 	TFileName fn;
    41 	User::CommandLine(fn);
    42 
    43 	TBuf16<512> aBuf;
    44 	aBuf.Copy(fn);
    45 
    46 	if (aBuf.FindF(KBadDescriptor) >= 0)
    47 		{
    48 		const TDesC16 *pBuf = &aBuf;
    49 
    50 		((int*)pBuf)[0] = 0x7554444f; //malformed descriptor
    51 
    52 		RDebug::Print(_L("Calling RLoader::Delete passing as an argument a malformed descriptor %S\n"),&fn );
    53 		
    54 		r = l.Delete(*pBuf);
    55 		
    56 		// panic with the reason from RLoader::Delete so t_loader_delete
    57 		// can check for the right error code.
    58 		p.Panic(KTldPanicCat, r);
    59 
    60 		}
    61 	
    62 	// panic with the reason from RLoader::Delete so t_loader_delete
    63 	// can check for the right error code.
    64 	r = l.Delete(fn);
    65 	p.Panic(KTldPanicCat, r);
    66 
    67 	// unused return value - present to prevent compiler warning
    68 	return KErrNone;
    69 	}