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);
34 BOOL read_memory(PVOID user_context, LPCVOID base_address, PVOID buffer, SIZE_T size, SIZE_T* read)
36 return ReadProcessMemory((HANDLE)user_context, base_address, buffer, size, read);
39 MONO_API_EXPORT DWORD OutOfProcessFunctionTableCallbackEx (ReadMemoryFunction read_memory, PVOID user_context, PVOID table_address, PDWORD entries, PRUNTIME_FUNCTION *functions)
41 DYNAMIC_FUNCTION_TABLE func_table = { 0 };
42 DynamicFunctionTableEntry func_table_entry = { 0 };
43 PRUNTIME_FUNCTION rt_funcs = NULL;
45 DWORD result = 0xC0000001;
47 if (read_memory (user_context, table_address, &func_table, sizeof (func_table), &reads)) {
48 if (func_table.Context != NULL && read_memory (user_context, func_table.Context, &func_table_entry, sizeof (func_table_entry), &reads)) {
49 if (func_table_entry.rt_funcs_current_count != 0) {
50 rt_funcs = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, func_table_entry.rt_funcs_current_count * sizeof (RUNTIME_FUNCTION));
52 if (read_memory (user_context, func_table_entry.rt_funcs, rt_funcs, func_table_entry.rt_funcs_current_count * sizeof (RUNTIME_FUNCTION), &reads)) {
53 *entries = func_table_entry.rt_funcs_current_count;
54 *functions = rt_funcs;
65 MONO_API_EXPORT DWORD OutOfProcessFunctionTableCallback (HANDLE process, PVOID table_address, PDWORD entries, PRUNTIME_FUNCTION *functions)
67 return OutOfProcessFunctionTableCallbackEx (&read_memory, process, table_address, entries, functions);
69 #endif /* defined(TARGET_AMD64) && !defined(DISABLE_JIT) */
72 BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
80 MONO_EMPTY_SOURCE_FILE (mini_windows_dlldac);
81 #endif /* HOST_WIN32 */