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-simple.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
40// Get the value at a slot
41LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot)
42{
43 return original_IEE->TLS_GetValue(slot);
44}
45
46// Get the value at a slot, return FALSE if TLS info block doesn't exist
47BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
48{
49 return original_IEE->TLS_CheckValue(slot, pValue);
50}
51// Set the value at a slot
52VOID STDMETHODCALLTYPE interceptor_IEE::TLS_SetValue(DWORD slot, LPVOID pData)
53{
54 original_IEE->TLS_SetValue(slot, pData);
55}
56// Free TLS memory block and make callback
57VOID STDMETHODCALLTYPE interceptor_IEE::TLS_ThreadDetaching()
58{
59 original_IEE->TLS_ThreadDetaching();
60}
61
62//***************************************************************************
63// IExecutionEngine methods for locking
64//***************************************************************************
65CRITSEC_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateLock(LPCSTR szTag, LPCSTR level, CrstFlags flags)
66{
67 return original_IEE->CreateLock(szTag, level, flags);
68}
69void STDMETHODCALLTYPE interceptor_IEE::DestroyLock(CRITSEC_COOKIE lock)
70{
71 original_IEE->DestroyLock(lock);
72}
73void STDMETHODCALLTYPE interceptor_IEE::AcquireLock(CRITSEC_COOKIE lock)
74{
75 original_IEE->AcquireLock(lock);
76}
77void STDMETHODCALLTYPE interceptor_IEE::ReleaseLock(CRITSEC_COOKIE lock)
78{
79 original_IEE->ReleaseLock(lock);
80}
81
82EVENT_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateAutoEvent(BOOL bInitialState)
83{
84 return original_IEE->CreateAutoEvent(bInitialState);
85}
86EVENT_COOKIE STDMETHODCALLTYPE interceptor_IEE::CreateManualEvent(BOOL bInitialState)
87{
88 return original_IEE->CreateManualEvent(bInitialState);
89}
90void STDMETHODCALLTYPE interceptor_IEE::CloseEvent(EVENT_COOKIE event)
91{
92 original_IEE->CloseEvent(event);
93}
94BOOL STDMETHODCALLTYPE interceptor_IEE::ClrSetEvent(EVENT_COOKIE event)
95{
96 return original_IEE->ClrSetEvent(event);
97}
98BOOL STDMETHODCALLTYPE interceptor_IEE::ClrResetEvent(EVENT_COOKIE event)
99{
100 return original_IEE->ClrResetEvent(event);
101}
102DWORD STDMETHODCALLTYPE interceptor_IEE::WaitForEvent(EVENT_COOKIE event, DWORD dwMilliseconds, BOOL bAlertable)
103{
104 return original_IEE->WaitForEvent(event, dwMilliseconds, bAlertable);
105}
106DWORD STDMETHODCALLTYPE interceptor_IEE::WaitForSingleObject(HANDLE handle, DWORD dwMilliseconds)
107{
108 return original_IEE->WaitForSingleObject(handle, dwMilliseconds);
109}
110SEMAPHORE_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax)
111{
112 return original_IEE->ClrCreateSemaphore(dwInitial, dwMax);
113}
114void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore)
115{
116 original_IEE->ClrCloseSemaphore(semaphore);
117}
118DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore,
119 DWORD dwMilliseconds,
120 BOOL bAlertable)
121{
122 return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable);
123}
124BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore,
125 LONG lReleaseCount,
126 LONG* lpPreviousCount)
127{
128 return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount);
129}
130MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
131 BOOL bInitialOwner,
132 LPCTSTR lpName)
133{
134 return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName);
135}
136void STDMETHODCALLTYPE interceptor_IEE::ClrCloseMutex(MUTEX_COOKIE mutex)
137{
138 original_IEE->ClrCloseMutex(mutex);
139}
140BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseMutex(MUTEX_COOKIE mutex)
141{
142 return original_IEE->ClrReleaseMutex(mutex);
143}
144DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable)
145{
146 return original_IEE->ClrWaitForMutex(mutex, dwMilliseconds, bAlertable);
147}
148
149DWORD STDMETHODCALLTYPE interceptor_IEE::ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
150{
151 return original_IEE->ClrSleepEx(dwMilliseconds, bAlertable);
152}
153BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed()
154{
155 return original_IEE->ClrAllocationDisallowed();
156}
157void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
158{
159 original_IEE->GetLastThrownObjectExceptionFromThread(ppvException);
160}
161