summaryrefslogtreecommitdiffstats
path: root/src/events.c
diff options
context:
space:
mode:
authorladevieq <ladevie.quentin@gmail.com>2026-07-09 00:58:20 +0200
committerladevieq <ladevie.quentin@gmail.com>2026-07-09 00:58:20 +0200
commit0379f7634200c35682adb53a6653d441849903ae (patch)
treeb927d39a662df77e0dc95dda109da1303d401e9b /src/events.c
parent3c091fe6eacd542a506a3f8adf1a8bd91e2e34b0 (diff)
Fixed compilation
Add disasm to compiled files Removed dependency to strsafe Detect SIB and displacement bytes correctly
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/events.c b/src/events.c
index 7492597..a1dd6ce 100644
--- a/src/events.c
+++ b/src/events.c
@@ -6,6 +6,8 @@
u8 expect_single_step = FALSE;
extern DEBUG_EVENT dbg_event;
+extern u8* string_stack_base;
+extern u8* string_stack_current;
const char* dummy_name = "Function_dummy_name";
@@ -58,8 +60,8 @@ void load_symbols(const void* base_addr, struct module* module) {
return;
}
- print("Module Base Address %xu\n", base_addr);
- print("Module Size %xu\n", module->nt_header.OptionalHeader.SizeOfImage);
+ print("Module Base Address %x\n", base_addr);
+ print("Module Size %x\n", module->nt_header.OptionalHeader.SizeOfImage);
#ifndef HASHMAP
// Exception directory
@@ -135,13 +137,13 @@ void load_symbols(const void* base_addr, struct module* module) {
assert(string_stack_current - 16U * 4096U < string_stack_base);
void* name_address = (void*)((u64)module->base_addr + names_address[name_index]);
read_memory(name_address, name, 256U);
- StringCchLengthA((PCNZCH)name, STRSAFE_MAX_CCH, &length);
+ length = str_len((const char*)name, 256U);
break;
}
}
if (name_index == export_dir.NumberOfNames) {
- print("%u : Function has no name, function address %xu\n", i, addresses[i]);
+ print("%u : Function has no name, function address %x\n", i, addresses[i]);
continue;
}
@@ -156,7 +158,7 @@ void load_symbols(const void* base_addr, struct module* module) {
string_stack_current[length] = '\0';
module->functions_name[global_functions_index] = name;
string_stack_current += length + 1U;
- print("%u : Function name : %s, function address %xu\n", i, name, addresses[i]);
+ print("%u : Function name : %s, function address %x\n", i, name, addresses[i]);
break;
}
}
@@ -185,10 +187,10 @@ void load_symbols(const void* base_addr, struct module* module) {
if (export_dir_start < (void*)func_address && (void*)func_address < export_dir_end) {
print("%u : Fowarded function : %s\n", i, func_name);
} else if (name_index && name_index < export_dir.NumberOfNames) {
- print("%u : Function name : %s, function address %xu\n", i, func_name, addresses[i]);
+ print("%u : Function name : %s, function address %x\n", i, func_name, addresses[i]);
insert_elem(&module->symbols, addresses[i], 0U, name_address);
} else {
- print("%u : Function has no name, function address %xu\n", i, addresses[i]);
+ print("%u : Function has no name, function address %x\n", i, addresses[i]);
insert_elem(&module->symbols, addresses[i], 0U, (u64)dummy_name);
}
}
@@ -282,17 +284,17 @@ void load_symbols(const void* base_addr, struct module* module) {
// if (cur_code->op_info == 0U) {
// u16 size = *(u16*)&u_info->unwind_code[code_index + 1U];
// if (u_info->frame_register) {
- // print("sub rbp %xu\n", size);
+ // print("sub rbp %x\n", size);
// } else {
- // print("sub rsp %xu\n", size);
+ // print("sub rsp %x\n", size);
// }
// code_index++;
// } else {
// u32 size = *(u32*)&u_info->unwind_code[code_index + 1U];
// if (u_info->frame_register) {
- // print("sub rbp %xu\n", size);
+ // print("sub rbp %x\n", size);
// } else {
- // print("sub rsp %xu\n", size);
+ // print("sub rsp %x\n", size);
// }
// code_index += 2U;
// }
@@ -301,14 +303,14 @@ void load_symbols(const void* base_addr, struct module* module) {
// print("alloc small\n");
// u32 size = cur_code->op_info * 8U + 8U;
// if (u_info->frame_register) {
- // print("sub rbp %xu\n", size);
+ // print("sub rbp %x\n", size);
// } else {
- // print("sub rsp %xu\n", size);
+ // print("sub rsp %u\n", size);
// }
// break;
// case UWOP_SET_FPREG:
// print("set frame point reg\n");
- // print("mov rbp rsp - %xu\n", u_info->frame_register_offset * 16U);
+ // print("mov rbp rsp - %u\n", u_info->frame_register_offset * 16U);
// break;
// case UWOP_SAVE_NONVOL:
// print("save non volatile\n");