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);
42 OutOfProcessFunctionTableCallbackEx (ReadMemoryFunction read_memory, PVOID user_context, PVOID table_address, PDWORD entries, PRUNTIME_FUNCTION *functions)
44 DYNAMIC_FUNCTION_TABLE func_table = { 0 };
45 DynamicFunctionTableEntry func_table_entry = { 0 };
46 PRUNTIME_FUNCTION rt_funcs = NULL;
48 DWORD result = 0xC0000001;
50 if (read_memory (user_context, table_address, &func_table, sizeof (func_table), &reads)) {
51 if (func_table.Context != NULL && read_memory (user_context, func_table.Context, &func_table_entry, sizeof (func_table_entry), &reads)) {
52 if (func_table_entry.rt_funcs_current_count != 0) {
53 rt_funcs = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, func_table_entry.rt_funcs_current_count * sizeof (RUNTIME_FUNCTION));
55 if (read_memory (user_context, func_table_entry.rt_funcs, rt_funcs, func_table_entry.rt_funcs_current_count * sizeof (RUNTIME_FUNCTION), &reads)) {
56 *entries = func_table_entry.rt_funcs_current_count;
57 *functions = rt_funcs;
69 OutOfProcessFunctionTableCallback (HANDLE process, PVOID table_address, PDWORD entries, PRUNTIME_FUNCTION *functions)
71 return OutOfProcessFunctionTableCallbackEx (&read_memory, process, table_address, entries, functions);
73 #endif /* defined(TARGET_AMD64) && !defined(DISABLE_JIT) */
77 DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
85 MONO_EMPTY_SOURCE_FILE (mini_windows_dlldac);
86 #endif /* HOST_WIN32 */