diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2026-07-12 23:26:58 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2026-07-12 23:26:58 +0200 |
| commit | cee4c6d1c8cbf898d6aa9ad555d8dfcece4c7d96 (patch) | |
| tree | a5c9710ca65e4bc1183d365a013d4494882e0eb3 /src/pdb.c | |
| parent | 7b6964eb1bcf30a0ae7ed3391adce30565b262b4 (diff) | |
Fix runtime crashes due to loaded functions
Diffstat (limited to 'src/pdb.c')
| -rw-r--r-- | src/pdb.c | 38 |
1 files changed, 5 insertions, 33 deletions
@@ -2,33 +2,13 @@ #include "cvinfo.h" #include "utils.h" +#include "win_funcs.h" + // ======================= // ====== windows.h ====== // ======================= -extern u32 GetLastError(void); - -typedef struct _SECURITY_ATTRIBUTES { - u32 nLength; - void* lpSecurityDescriptor; - i32 bInheritHandle; -} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; - -typedef struct _OVERLAPPED { - u64* Internal; - u64* InternalHigh; - union { - struct { - u32 Offset; - u32 OffsetHigh; - }; - void* Pointer; - }; - - void* hEvent; -} OVERLAPPED, *LPOVERLAPPED; - // // Define access rights to files and directories // @@ -197,14 +177,6 @@ typedef struct _OVERLAPPED { // #define INVALID_HANDLE_VALUE ((void*)(i64*)-1) -extern void* CreateFileA(const i8* lpFileName, u32 dwDesiredAccess, u32 dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, u32 dwCreationDisposition, u32 dwFlagsAndAttributes, void* hTemplateFile); - -extern u32 SetFilePointer(void* hFile, i32 lDistanceToMove, i32* lpDistanceToMoveHigh, u32 dwMoveMethod); - -extern i32 ReadFile(void* hFile, void* lpBuffer, u32 nNumberOfBytesToRead, u32* lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); - -extern i32 CloseHandle(void* hObject); - // ======================== // ====== !windows.h ====== // ======================== @@ -349,11 +321,11 @@ void open_pdb(const i8* pdb_path, struct module* module) { print("Module symbol stream index %x\n", modules_info[module_index]->ModuleSymStream); print("Module name : %s\n", modules_name[module_index]); size_t module_name_length = 0U; - module_name_length = str_len((const char*)modules_name[module_index], 256U); + module_name_length = str_len((const char*)modules_name[module_index]); obj_files_name[module_index] = &DBI_block[byte_index + sizeof(struct mod_info) + module_name_length + 1U]; print("Obj file name : %s\n", obj_files_name[module_index]); - size_t obj_file_name_length = str_len((const char*)obj_files_name[module_index], 256U); + size_t obj_file_name_length = str_len((const char*)obj_files_name[module_index]); u32 module_info_size = sizeof(*modules_info[0U]) + (i32)module_name_length + 1 + (i32)obj_file_name_length + 1; module_info_size = ((module_info_size + 3U) / 4U) * 4U; @@ -388,7 +360,7 @@ void open_pdb(const i8* pdb_path, struct module* module) { print("PROC32 SYMBOL %s\n", proc->name); // TODO: Add string management code assert(string_stack_current - 16U * 4096U < string_stack_base); - size_t length = str_len((const char*)proc->name, 256U); + size_t length = str_len((const char*)proc->name); str_cat((char*)string_stack_current, (const char*)proc->name, length); string_stack_current[length] = '\0'; u32 start_address = proc->off + module->nt_header.OptionalHeader.BaseOfCode; |
