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