summaryrefslogtreecommitdiffstats
path: root/src/pdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdb.c')
-rw-r--r--src/pdb.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/src/pdb.c b/src/pdb.c
index a189885..91c7ddb 100644
--- a/src/pdb.c
+++ b/src/pdb.c
@@ -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;