| 1003 | |
| 1004 | #elif defined CC_BUILD_WIN |
| 1005 | static void DumpStack(void) { |
| 1006 | static const cc_string stack = String_FromConst("-- stack --\r\n"); |
| 1007 | cc_string str; char strBuffer[128]; |
| 1008 | cc_uint8 buffer[0x10]; |
| 1009 | SIZE_T numRead; |
| 1010 | int i, j; |
| 1011 | |
| 1012 | Logger_Log(&stack); |
| 1013 | spRegister &= ~0x0F; |
| 1014 | spRegister -= 0x40; |
| 1015 | |
| 1016 | /* Dump 128 bytes near stack pointer */ |
| 1017 | for (i = 0; i < 8; i++, spRegister += 0x10) |
| 1018 | { |
| 1019 | String_InitArray(str, strBuffer); |
| 1020 | String_Format1(&str, "0x%x)", &spRegister); |
| 1021 | ReadProcessMemory(CUR_PROCESS_HANDLE, (LPCVOID)spRegister, buffer, 0x10, &numRead); |
| 1022 | |
| 1023 | for (j = 0; j < 0x10; j++) |
| 1024 | { |
| 1025 | if ((j & 0x03) == 0) String_Append(&str, ' '); |
| 1026 | String_AppendHex(&str, buffer[j]); |
| 1027 | String_Append(&str, ' '); |
| 1028 | } |
| 1029 | String_AppendConst(&str, "\r\n"); |
| 1030 | Logger_Log(&str); |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | static BOOL WINAPI DumpModule(const char* name, ULONG_PTR base, ULONG size, void* userCtx) { |
| 1035 | cc_string str; char strBuffer[256]; |
no test coverage detected