diff -r 000000000000 -r a41df078684a kerneltest/e32test/system/t_xprot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/system/t_xprot.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,575 @@ +// Copyright (c) 1998-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: +// e32test\system\t_xprot.cpp +// +// + +#include +#include "execinfo.h" +#include + +const TInt KSupervisorAddress=0x80000000; +const TInt KGarbageAddress=0xeeddbbcc; + +TInt Handles[MAX_HANDLE]; +TInt DataArea[1024]; +TBuf8<1024> Buf8; +TBuf<1024> Buf; +TPtrC8 PtrC8(Buf8.Ptr(),10); +TPtrC8 PtrC(Buf.Ptr(),10); +TPtrC8 Ptr8(Buf8.Ptr(),10,1024); +TPtrC8 Ptr(Buf.Ptr(),10,1024); +TPtrC8 Ptr8N(NULL,10,1024); +TPtrC8 PtrN(NULL,10,1024); +TPtrC8 Ptr8I((TUint8*)KGarbageAddress,10,1024); +TPtrC8 PtrI((TText*)KGarbageAddress,10,1024); +TPtrC8 Ptr8S((TUint8*)KSupervisorAddress,10,1024); +TPtrC8 PtrS((TText*)KSupervisorAddress,10,1024); +TInt MessageHandle; + +TInt Args[4]; + +TInt GetHandle(TInt& aState, TInt aHandleType) + { + TInt r; + TInt t=aHandleType?aHandleType-1:ELibrary; + switch(aState) + { + case 0: r=0; break; + case 1: r=0xdeaddead; break; + case 2: r=Handles[EThread]; break; + case 3: r=Handles[t]; break; + case 4: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetAnyInt(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=1; break; + case 2: r=2; break; + case 3: r=-1; break; + case 4: r=299792458; break; + case 5: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetAnyPtr(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)DataArea; break; + case 4: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetIntPtr(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=((TInt)DataArea)+1; break; + case 3: r=KSupervisorAddress; break; + case 4: r=(TInt)DataArea; break; + case 5: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetDes8(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)&Ptr8N; break; + case 4: r=(TInt)&Ptr8I; break; + case 5: r=(TInt)&Ptr8S; break; + case 6: r=(TInt)&Ptr8; break; + case 7: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetWDes8(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)&Ptr8N; break; + case 4: r=(TInt)&Ptr8I; break; + case 5: r=(TInt)&Ptr8S; break; + case 6: r=(TInt)&PtrC8; break; + case 7: r=(TInt)&Ptr8; break; + case 8: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetDes(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)&PtrN; break; + case 4: r=(TInt)&PtrI; break; + case 5: r=(TInt)&PtrS; break; + case 6: r=(TInt)&Ptr; break; + case 7: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetWDes(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)&PtrN; break; + case 4: r=(TInt)&PtrI; break; + case 5: r=(TInt)&PtrS; break; + case 6: r=(TInt)&PtrC; break; + case 7: r=(TInt)&Ptr; break; + case 8: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetBool(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=1; break; + case 2: r=299792458; break; + case 3: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetObjectType(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=EThread; break; + case 1: r=ELibrary; break; + case 2: r=ENumObjectType; break; + case 3: r=20000; break; + case 4: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetDevUnit(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=1; break; + case 2: r=20000; break; + case 3: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetMsgHandle(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=(TInt)DataArea; break; + case 3: r=KSupervisorAddress; break; + case 4: r=MessageHandle; break; + case 5: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetModuleHandle(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=ModuleHandle; break; + case 3: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetSessionHandlePtr(TInt& aState) + { + TInt r; + switch(aState) + { + case 0: r=0; break; + case 1: r=KGarbageAddress; break; + case 2: r=KSupervisorAddress; break; + case 3: r=(TInt)&Handles[ESession]; break; + case 4: aState=0; return 0; + } + ++aState; + return r; + } + +TInt GetArgument(TInt& aState, TInt aArgType) + { + if (aArgType==NO_PAR) + return 0; + if (aArgType