8 #define DEF_PROC(proc) static proc##_t *w32_##proc
9 #define GET_PROC(proc) \
10 w32_##proc = (proc##_t *)GetProcAddress(dbghelp, #proc); \
17 _In_opt_ PCSTR UserSearchPath,
18 _In_ BOOL fInvadeProcess);
32 _In_
DWORD MachineType,
35 _Inout_ LPSTACKFRAME64 StackFrame,
36 _Inout_
PVOID ContextRecord,
37 _In_opt_ PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
38 _In_opt_ PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
39 _In_opt_ PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
40 _In_opt_ PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
53 HMODULE dbghelp = LoadLibrary(TEXT(
"DbgHelp"));
79 DWORD machine_type = IMAGE_FILE_MACHINE_ARMNT;
81 DWORD machine_type = IMAGE_FILE_MACHINE_AMD64;
83 DWORD machine_type = IMAGE_FILE_MACHINE_I386;
85 STACKFRAME64
stack = { 0 };
86 stack.AddrFrame.Mode = AddrModeFlat;
88 stack.AddrStack.Mode = AddrModeFlat;
90 stack.AddrPC.Mode = AddrModeFlat;
99 w32_SymInitialize(wrap->
pi.hProcess,
NULL,
TRUE);
100 while (w32_StackWalk64(machine_type, wrap->
pi.hProcess, wrap->
pi.hThread, &
stack,
ctx,
NULL, w32_SymFunctionTableAccess64, w32_SymGetModuleBase64,
NULL)) {
106 frame->
bp =
stack.AddrFrame.Offset;
107 frame->
sp =
stack.AddrStack.Offset;
108 frame->
size = frame->
bp - frame->
sp;
114 w32_SymCleanup(wrap->
pi.hProcess);
RZ_API ut8 * rz_reg_arena_peek(RzReg *reg)
#define IMAGE_FILE_MACHINE_ARM64
RZ_API void Ht_() free(HtName_(Ht) *ht)
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API ut64 rz_reg_getv(RzReg *reg, const char *name)
RZ_API const char * rz_reg_get_name(RzReg *reg, int role)
RZ_API void rz_th_lock_leave(RZ_NONNULL RzThreadLock *thl)
Releases a RzThreadLock structure.
RZ_API RZ_OWN RzThreadLock * rz_th_lock_new(bool recursive)
Allocates and initialize a RzThreadLock structure.
RZ_API void rz_th_lock_enter(RZ_NONNULL RzThreadLock *thl)
Acquires a RzThreadLock structure.
static void lock(volatile int *lk)
static bool initialize_sym_api(void)
BOOL __stdcall SymCleanup_t(_In_ HANDLE hProcess)
BOOL __stdcall StackWalk64_t(_In_ DWORD MachineType, _In_ HANDLE hProcess, _In_ HANDLE hThread, _Inout_ LPSTACKFRAME64 StackFrame, _Inout_ PVOID ContextRecord, _In_opt_ PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, _In_opt_ PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, _In_opt_ PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, _In_opt_ PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress)
static RzList * backtrace_windows(RzDebug *dbg, ut64 at)
BOOL __stdcall SymInitialize_t(_In_ HANDLE hProcess, _In_opt_ PCSTR UserSearchPath, _In_ BOOL fInvadeProcess)
DWORD64 __stdcall SymGetModuleBase64_t(_In_ HANDLE hProcess, _In_ DWORD64 qwAddr)
PVOID __stdcall SymFunctionTableAccess64_t(_In_ HANDLE hProcess, _In_ DWORD64 AddrBase)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()