First public contribution.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\misc\int_svr_calls.cpp
19 #include <e32def_private.h>
21 #include <e32cmn_private.h>
27 #include <e32std_private.h>
30 // NB: The following is a straight rip from the win32 uc_exec.cpp
33 typedef TInt (__fastcall *TDispatcher)(TInt, TInt*);
34 TInt __fastcall LazyDispatch(TInt aFunction, TInt* aArgs);
36 #pragma data_seg(".data2")
38 #pragma bss_seg(".data2")
40 static TDispatcher TheDispatcher = &LazyDispatch;
46 TInt __fastcall LazyDispatch(TInt aFunction, TInt* aArgs)
48 HINSTANCE kernel = GetModuleHandleA("ekern.exe");
51 TDispatcher dispatcher = (TDispatcher)Emulator::GetProcAddress(kernel, (LPCSTR)1);
54 TheDispatcher = dispatcher;
55 return dispatcher(aFunction, aArgs);
61 // Do the exec stuff in a cpp file for WINS
62 #define __GEN_USER_EXEC_CODE__
67 #define EXPORT_C __declspec(dllexport)
69 // ripped from e32\euser\epoc\x86\uc_exec.cpp
71 __NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
73 // Send a blind message to the server.
76 SLOW_EXEC4(EExecSessionSend);
79 __NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
81 // Send a blind message to the server using thread's dedicated message slot.
84 SLOW_EXEC4(EExecSessionSendSync);
87 EXPORT_C TInt SessionCreate(const TDesC8& aName, TInt aMsgSlots, const TSecurityPolicy* aPolicy, TInt aType)
89 return Exec::SessionCreate(aName, aMsgSlots, aPolicy, aType);
92 EXPORT_C TInt SessionSend(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
94 return Exec::SessionSend(aHandle, aFunction, aArgs, aStatus);
97 EXPORT_C TInt SessionSendSync(TInt aHandle, TInt aFunction, TAny* aArgs, TRequestStatus* aStatus)
99 return Exec::SessionSendSync(aHandle, aFunction, aArgs, aStatus);
102 EXPORT_C void SetSessionPtr(TInt aHandle, const TAny* aPtr)
104 Exec::SetSessionPtr(aHandle, aPtr);