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#include "standardpch.h"
7#include "iexecutionengine.h"
8#include "superpmi-shim-counter.h"
9
10//***************************************************************************
11// IUnknown methods
12//***************************************************************************
13HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void** pInterface)
14{
15 return original_IEE->QueryInterface(id, pInterface);
16}
17ULONG STDMETHODCALLTYPE interceptor_IEE::AddRef()
18{
19 return original_IEE->AddRef();
20}
21ULONG STDMETHODCALLTYPE interceptor_IEE::Release()
22{
23 return original_IEE->Release();
24}
25
26//***************************************************************************
27// IExecutionEngine methods for TLS
28//***************************************************************************
29// Associate a callback for cleanup with a TLS slot
30VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
31{
32 original_IEE->TLS_AssociateCallback(slot, callback);
33}
34// Get the TLS block for fast Get/Set operations
35LPVOID* STDMETHODCALLTYPE interceptor_IEE::TLS_GetDataBlock()
36{
37 return original_IEE->TLS_GetDataBlock();
38}
39// Get the value at a slot
40LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot)
41{
42 return original_IEE->TLS_GetValue(slot);
43}
44
45// Get the value at a slot, return FALSE if TLS info block doesn't exist
46BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
47{
48 return original_IEE->TLS_CheckValue(slot, pValue);
49}
50// Set the value at a slot
51VOID STDMETHODCALLTYPE interceptor_IEE::TLS_SetValue(DWORD slot, LPVOID pData)
52{
53 original_IEE->TLS_SetValue(slot, pData);
54}
55// Free TLS memory block and make callback
56VOID STDMETHODCALLTYPE interceptor_IEE::TLS_ThreadDetaching()
57{
58 original_IEE->TLS_ThreadDetaching();
59}
60
61//***************************************************************************
62// IExecutionEngine methods for locking
63//***************************************************************************
64CRITSEC_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateLock(LPCSTR szTag, LPCSTR level, CrstFlags flags)
65{
66 return original_IEE->CreateLock(szTag, level, flags);
67}
68void STDMETHODCALLTYPE interceptor_IEE::DestroyLock(CRITSEC_COOKIE lock)
69{
70 original_IEE->DestroyLock(lock);
71}
72void STDMETHODCALLTYPE interceptor_IEE::AcquireLock(CRITSEC_COOKIE lock)
73{
74 original_IEE->AcquireLock(lock);
75}
76void STDMETHODCALLTYPE interceptor_IEE::ReleaseLock(CRITSEC_COOKIE lock)
77{
78 original_IEE->ReleaseLock(lock);
79}
80
81EVENT_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateAutoEvent(BOOL bInitialState)
82{
83 return original_IEE->CreateAutoEvent(bInitialState);
84}
85EVENT_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateManualEvent(BOOL bInitialState)
86{
87 return original_IEE->CreateManualEvent(bInitialState);
88}
89void STDMETHODCALLTYPE interceptor_IEE::CloseEvent(EVENT_COOKIE event)
90{
91 original_IEE->CloseEvent(event);
92}
93BOOL STDMETHODCALLTYPE interceptor_IEE::ClrSetEvent(EVENT_COOKIE event)
94{
95 return original_IEE->ClrSetEvent(event);
96}
97BOOL STDMETHODCALLTYPE interceptor_IEE::ClrResetEvent(EVENT_COOKIE event)
98{
99 return original_IEE->ClrResetEvent(event);
100}
101DWORD STDMETHODCALLTYPE interceptor_IEE::WaitForEvent(EVENT_COOKIE event, DWORD dwMilliseconds, BOOL bAlertable)
102{
103 return original_IEE->WaitForEvent(event, dwMilliseconds, bAlertable);
104}
105DWORD STDMETHODCALLTYPE interceptor_IEE::WaitForSingleObject(HANDLE handle, DWORD dwMilliseconds)
106{
107 return original_IEE->WaitForSingleObject(handle, dwMilliseconds);
108}
109SEMAPHORE_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax)
110{
111 return original_IEE->ClrCreateSemaphore(dwInitial, dwMax);
112}
113void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore)
114{
115 original_IEE->ClrCloseSemaphore(semaphore);
116}
117DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore,
118 DWORD dwMilliseconds,
119 BOOL bAlertable)
120{
121 return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable);
122}
123BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore,
124 LONG lReleaseCount,
125 LONG* lpPreviousCount)
126{
127 return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount);
128}
129MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
130 BOOL bInitialOwner,
131 LPCTSTR lpName)
132{
133 return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName);
134}
135void STDMETHODCALLTYPE interceptor_IEE::ClrCloseMutex(MUTEX_COOKIE mutex)
136{
137 original_IEE->ClrCloseMutex(mutex);
138}
139BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseMutex(MUTEX_COOKIE mutex)
140{
141 return original_IEE->ClrReleaseMutex(mutex);
142}
143DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable)
144{
145 return original_IEE->ClrWaitForMutex(mutex, dwMilliseconds, bAlertable);
146}
147
148DWORD STDMETHODCALLTYPE interceptor_IEE::ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
149{
150 return original_IEE->ClrSleepEx(dwMilliseconds, bAlertable);
151}
152BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed()
153{
154 return original_IEE->ClrAllocationDisallowed();
155}
156void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
157{
158 original_IEE->GetLastThrownObjectExceptionFromThread(ppvException);
159}
160