1 | // |
2 | // Copyright (c) Microsoft. All rights reserved. |
3 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
4 | // |
5 | |
6 | //---------------------------------------------------------- |
7 | // IExecutionEngine.h - core shim implementation for IEE stuff |
8 | //---------------------------------------------------------- |
9 | #ifndef _IExecutionEngine |
10 | #define _IExecutionEngine |
11 | |
12 | #include "ieememorymanager.h" |
13 | |
14 | class interceptor_IEE : public IExecutionEngine |
15 | { |
16 | private: |
17 | //*************************************************************************** |
18 | // IUnknown methods |
19 | //*************************************************************************** |
20 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface); |
21 | ULONG STDMETHODCALLTYPE AddRef(); |
22 | ULONG STDMETHODCALLTYPE Release(); |
23 | |
24 | //*************************************************************************** |
25 | // IExecutionEngine methods for TLS |
26 | //*************************************************************************** |
27 | // Associate a callback for cleanup with a TLS slot |
28 | VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback); |
29 | // Get the TLS block for fast Get/Set operations |
30 | LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock(); |
31 | // Get the value at a slot |
32 | LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot); |
33 | // Get the value at a slot, return FALSE if TLS info block doesn't exist |
34 | BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue); |
35 | // Set the value at a slot |
36 | VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData); |
37 | // Free TLS memory block and make callback |
38 | VOID STDMETHODCALLTYPE TLS_ThreadDetaching(); |
39 | |
40 | //*************************************************************************** |
41 | // IExecutionEngine methods for locking |
42 | //*************************************************************************** |
43 | CRITSEC_COOKIE STDMETHODCALLTYPE CreateLock(LPCSTR szTag, LPCSTR level, CrstFlags flags); |
44 | void STDMETHODCALLTYPE DestroyLock(CRITSEC_COOKIE lock); |
45 | void STDMETHODCALLTYPE AcquireLock(CRITSEC_COOKIE lock); |
46 | void STDMETHODCALLTYPE ReleaseLock(CRITSEC_COOKIE lock); |
47 | EVENT_COOKIE STDMETHODCALLTYPE CreateAutoEvent(BOOL bInitialState); |
48 | EVENT_COOKIE STDMETHODCALLTYPE CreateManualEvent(BOOL bInitialState); |
49 | void STDMETHODCALLTYPE CloseEvent(EVENT_COOKIE event); |
50 | BOOL STDMETHODCALLTYPE ClrSetEvent(EVENT_COOKIE event); |
51 | BOOL STDMETHODCALLTYPE ClrResetEvent(EVENT_COOKIE event); |
52 | DWORD STDMETHODCALLTYPE WaitForEvent(EVENT_COOKIE event, DWORD dwMilliseconds, BOOL bAlertable); |
53 | DWORD STDMETHODCALLTYPE WaitForSingleObject(HANDLE handle, DWORD dwMilliseconds); |
54 | SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax); |
55 | void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore); |
56 | DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable); |
57 | BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount); |
58 | MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, |
59 | BOOL bInitialOwner, |
60 | LPCTSTR lpName); |
61 | void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex); |
62 | BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex); |
63 | DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable); |
64 | DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable); |
65 | BOOL STDMETHODCALLTYPE ClrAllocationDisallowed(); |
66 | void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException); |
67 | |
68 | public: |
69 | IExecutionEngine* original_IEE; // Our extra value that holds a pointer to the original IEE we'll pass calls along |
70 | // to |
71 | }; |
72 | |
73 | #endif |