From 4aa642aef02e46accec98458ef69ea7d64cc9b54 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Wed, 31 May 2023 21:51:01 +0200 Subject: [PATCH] you can push anything now please work --- examples/keylogger.pasm | 4 ++++ src/api.c | 2 +- src/instructions.c | 29 +++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/examples/keylogger.pasm b/examples/keylogger.pasm index b63d367..5a89457 100644 --- a/examples/keylogger.pasm +++ b/examples/keylogger.pasm @@ -54,4 +54,8 @@ je numbers ; if GetAsyncKeyState was false, jump to numbers push a1 ; push char call put + +push \n ; push char +call put + jmp numbers diff --git a/src/api.c b/src/api.c index 480c4bb..52986ce 100644 --- a/src/api.c +++ b/src/api.c @@ -4,7 +4,7 @@ #include void api_put() { - printf("%c\n", stack[top--]); + printf("%c", stack[top--]); } void api_getasynckeystate() { diff --git a/src/instructions.c b/src/instructions.c index 2183742..f370a24 100644 --- a/src/instructions.c +++ b/src/instructions.c @@ -184,17 +184,34 @@ void call() { } void push() { - if (!((is_num(args->arg1) || (is_reg(args->arg1))))) { - last_check_args_code = ARG1_WRONG; - return; - } - if (top == STACK_SIZE) { //stack overflow last_stack_code = OVERFLOW; return; } - stack[++top] = get_value(args->arg1); + int value = get_value(args->arg1); + if (value == 0) { + if (args->arg1[0] == '\\') { + switch (args->arg1[1]) { + case 'n': + value = (int)'\n'; + break; + case 't': + value = (int)'\t'; + break; + case 'r': + value = (int)'\r'; + break; + default: + break; + } + } + else { + value = (int)args->arg1[0]; + } + } + + stack[++top] = value; } void pop() {