kerneltest/f32test/loader/tld_helper.cpp
author John Imhofe
Mon, 19 Oct 2009 15:55:17 +0100
changeset 0 a41df078684a
child 6 0173bcd7697c
permissions -rw-r--r--
Convert Kernelhwsrv package from SFL to EPL kernel\eka\compsupp is subject to the ARM EABI LICENSE userlibandfileserver\fatfilenameconversionplugins\unicodeTables is subject to the Unicode license kernel\eka\kernel\zlib is subject to the zlib license

// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// \f32test\loader\tld_helper.cpp
// 
//

#include "t_loader_delete.h"
#include <e32debug.h>


TInt E32Main()
	{
#ifdef __WINS__
	// don't use JIT if running on emulator because don't want to halt
	// t_loader_delete test run.
	User::SetJustInTime(EFalse);
#endif

	TInt r;
	RProcess p;

	RLoader l;
	r = l.Connect();
	if (r != KErrNone)
		p.Panic(_L("tldh-noconn"), 0);

	
	TFileName fn;
	User::CommandLine(fn);

	TBuf16<512> aBuf;
	aBuf.Copy(fn);

	if (aBuf.FindF(KBadDescriptor) >= 0)
		{
		const TDesC16 *pBuf = &aBuf;

		((int*)pBuf)[0] = 0x7554444f; //malformed descriptor

		RDebug::Print(_L("Calling RLoader::Delete passing as an argument a malformed descriptor %S\n"),&fn );
		
		r = l.Delete(*pBuf);
		
		// panic with the reason from RLoader::Delete so t_loader_delete
		// can check for the right error code.
		p.Panic(KTldPanicCat, r);

		}
	
	// panic with the reason from RLoader::Delete so t_loader_delete
	// can check for the right error code.
	r = l.Delete(fn);
	p.Panic(KTldPanicCat, r);

	// unused return value - present to prevent compiler warning
	return KErrNone;
	}