8 #if defined(TARGET_AMD64) && !defined(DISABLE_JIT)
9 #include "mono/mini/mini.h"
10 #include "mono/mini/mini-amd64.h"
11 #include "mono/utils/mono-publib.h"
13 typedef enum _FUNCTION_TABLE_TYPE
{
17 } FUNCTION_TABLE_TYPE
;
19 typedef struct _DYNAMIC_FUNCTION_TABLE
{
21 PRUNTIME_FUNCTION FunctionTable
;
22 LARGE_INTEGER TimeStamp
;
23 ULONG64 MinimumAddress
;
24 ULONG64 MaximumAddress
;
26 PGET_RUNTIME_FUNCTION_CALLBACK Callback
;
28 PWSTR OutOfProcessCallbackDll
;
29 FUNCTION_TABLE_TYPE Type
;
31 } DYNAMIC_FUNCTION_TABLE
, *PDYNAMIC_FUNCTION_TABLE
;
33 typedef BOOL (ReadMemoryFunction
)(PVOID user_context
, LPCVOID base_address
, PVOID buffer
, SIZE_T size
, SIZE_T
*read
);
36 read_memory(PVOID user_context
, LPCVOID base_address
, PVOID buffer
, SIZE_T size
, SIZE_T
* read
)
38 return ReadProcessMemory ((HANDLE
)user_context
, base_address
, buffer
, size
, read
);
43 OutOfProcessFunctionTableCallbackEx (ReadMemoryFunction read_memory
, PVOID user_context
, PVOID table_address
, PDWORD entries
, PRUNTIME_FUNCTION
*functions
)
45 DYNAMIC_FUNCTION_TABLE func_table
= { 0 };
46 DynamicFunctionTableEntry func_table_entry
= { 0 };
47 PRUNTIME_FUNCTION rt_funcs
= NULL
;
49 DWORD result
= 0xC0000001;
51 if (read_memory (user_context
, table_address
, &func_table
, sizeof (func_table
), &reads
)) {
52 if (func_table
.Context
!= NULL
&& read_memory (user_context
, func_table
.Context
, &func_table_entry
, sizeof (func_table_entry
), &reads
)) {
53 if (func_table_entry
.rt_funcs_current_count
!= 0) {
54 rt_funcs
= (PRUNTIME_FUNCTION
)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, func_table_entry
.rt_funcs_current_count
* sizeof (RUNTIME_FUNCTION
));
56 if (read_memory (user_context
, func_table_entry
.rt_funcs
, rt_funcs
, func_table_entry
.rt_funcs_current_count
* sizeof (RUNTIME_FUNCTION
), &reads
)) {
57 *entries
= func_table_entry
.rt_funcs_current_count
;
58 *functions
= rt_funcs
;
71 OutOfProcessFunctionTableCallback (HANDLE process
, PVOID table_address
, PDWORD entries
, PRUNTIME_FUNCTION
*functions
)
73 return OutOfProcessFunctionTableCallbackEx (&read_memory
, process
, table_address
, entries
, functions
);
75 #endif /* defined(TARGET_AMD64) && !defined(DISABLE_JIT) */
80 DllMain (HMODULE module_handle
, DWORD reason
, LPVOID reserved
)
88 MONO_EMPTY_SOURCE_FILE (mini_windows_dlldac
);
89 #endif /* HOST_WIN32 */