summaryrefslogtreecommitdiffstats
path: root/src/parser.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/parser.c
parent3c091fe6eacd542a506a3f8adf1a8bd91e2e34b0 (diff)
Fixed compilation
Add disasm to compiled files Removed dependency to strsafe Detect SIB and displacement bytes correctly
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/parser.c b/src/parser.c
index 985543b..f6dd074 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1,10 +1,9 @@
#include "parser.h"
-#include <Windows.h>
-
#include "utils.h"
#include "module.h"
#include "stack_walk.h"
+#include "disasm.h"
extern u8 expect_single_step;
extern DWORD continue_status;
@@ -243,19 +242,19 @@ void run(struct ast_node* root) {
if (((1ULL << index) & modules_list) == 0U) {
struct module* module = &modules[index];
print("Module Name : %s\n", module->name);
- print("Module Base : %xu\n", module->base_addr);
- print("Module Size : %xu\n\n", module->nt_header.OptionalHeader.SizeOfImage);
+ print("Module Base : %x\n", module->base_addr);
+ print("Module Size : %x\n\n", module->nt_header.OptionalHeader.SizeOfImage);
}
}
} else if (cur_node.token->type == TOKEN_PRINT_REG) {
- print("RIP : %xu\n", ctx.Rip);
- print("RCX : %xu\n", ctx.Rcx);
- print("RDX : %xu\n", ctx.Rdx);
- print("RBX : %xu\n", ctx.Rbx);
- print("RSP : %xu\n", ctx.Rsp);
- print("RBP : %xu\n", ctx.Rbp);
- print("RSI : %xu\n", ctx.Rsi);
- print("RDI : %xu\n", ctx.Rdi);
+ print("RIP : %.12x\n", ctx.Rip);
+ print("RCX : %.12x\n", ctx.Rcx);
+ print("RDX : %.12x\n", ctx.Rdx);
+ print("RBX : %.12x\n", ctx.Rbx);
+ print("RSP : %.12x\n", ctx.Rsp);
+ print("RBP : %.12x\n", ctx.Rbp);
+ print("RSI : %.12x\n", ctx.Rsi);
+ print("RDI : %.12x\n", ctx.Rdi);
process_commands = TRUE;
} else if (cur_node.token->type == TOKEN_STEP_INTO) {
ctx.EFlags |= 0x100; // TRAP_FLAG
@@ -279,7 +278,7 @@ void run(struct ast_node* root) {
if(read_memory((const void*)addr, (void*)buf, size)) {
for (u32 index = 0U; index < size; index += 8U) {
- print("%xb %xb %xb %xb %xb %xb %xb %xb\n", buf[index], buf[index + 1U], buf[index + 2U], buf[index + 3U], buf[index + 4U], buf[index + 5U], buf[index + 6U], buf[index + 7U]);
+ print("%.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", buf[index], buf[index + 1U], buf[index + 2U], buf[index + 3U], buf[index + 4U], buf[index + 5U], buf[index + 6U], buf[index + 7U]);
}
print("\n");
} else {
@@ -309,7 +308,7 @@ void run(struct ast_node* root) {
u32 end = module->functions_end[sym_index];
unassemble((u8*)module->base_addr + start, end - start);
} else {
- print("No symbol found at address %xu\n", ctx.Rip);
+ print("No symbol found at address %x\n", ctx.Rip);
}
} else {
print("Command unknown\n");