From 0379f7634200c35682adb53a6653d441849903ae Mon Sep 17 00:00:00 2001 From: ladevieq Date: Thu, 9 Jul 2026 00:58:20 +0200 Subject: Fixed compilation Add disasm to compiled files Removed dependency to strsafe Detect SIB and displacement bytes correctly --- src/pdb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/pdb.c') diff --git a/src/pdb.c b/src/pdb.c index 0d6617a..955e3be 100644 --- a/src/pdb.c +++ b/src/pdb.c @@ -1,6 +1,5 @@ #include "pdb.h" -#include #include "cvinfo.h" #include "utils.h" @@ -142,15 +141,14 @@ void open_pdb(const char* pdb_path, struct module* module) { for (u32 module_index = 0U; byte_index < DBI_stream_header->mod_info_size; module_index++) { modules_info[module_index] = (struct mod_info*)&DBI_block[byte_index]; modules_name[module_index] = &DBI_block[byte_index + sizeof(struct mod_info)]; - print("Module symbol stream index %xu\n", modules_info[module_index]->ModuleSymStream); + 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; - StringCchLengthA((STRSAFE_LPSTR)modules_name[module_index], STRSAFE_MAX_CCH, &module_name_length); + module_name_length = str_len((const char*)modules_name[module_index], 256U); 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 = 0U; - StringCchLengthA((STRSAFE_LPSTR)obj_files_name[module_index], STRSAFE_MAX_CCH, &obj_file_name_length); + size_t obj_file_name_length = str_len((const char*)obj_files_name[module_index], 256U); 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; @@ -185,9 +183,8 @@ void open_pdb(const char* 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 = 0U; - StringCchLengthA((PCNZCH)proc->name, STRSAFE_MAX_CCH, &length); - StringCchCopyA((LPSTR)string_stack_current, STRSAFE_MAX_CCH, (LPCSTR)proc->name); + size_t length = str_len((const char*)proc->name, 256U); + 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; #ifdef HASHMAP @@ -226,7 +223,7 @@ void open_pdb(const char* pdb_path, struct module* module) { buildinfo; print("BUILDINFO SYMBOL\n"); } else { - print("Unknown symbol kind %xu\n", rec->rectyp); + print("Unknown symbol kind %x\n", rec->rectyp); } cur_sym = (u8*)NextSym((SYMTYPE*)cur_sym); } -- cgit v1.3