add: writing to arrays, hex in arrays fix: arguments parsing, show_error on windows

This commit is contained in:
2024-08-19 13:05:48 +02:00
parent a6e8d0d0f0
commit 5df51d811b
11 changed files with 121 additions and 29 deletions

View File

@@ -43,3 +43,34 @@ void api_getasynckeystate() {
state->registers->eax = 1;
#endif
}
void api_virtualalloc() {
#ifdef _WIN32
long long address = state->STACK[state->STACK_IDX--];
long long size = state->STACK[state->STACK_IDX--];
long long alloctype = state->STACK[state->STACK_IDX--];
long long flprotect = state->STACK[state->STACK_IDX--];
state->registers->eax = (long long)VirtualAlloc((LPVOID)address, (SIZE_T)size, (DWORD)alloctype, (DWORD)flprotect);
#else
state->STACK_IDX -= 4;
state->registers->eax = 1;
#endif
}
void api_virtualfree() {
#ifdef _WIN32
long long address = state->STACK[state->STACK_IDX--];
long long size = state->STACK[state->STACK_IDX--];
long long freetype = state->STACK[state->STACK_IDX--];
state->registers->eax = VirtualFree((LPVOID)address, (SIZE_T)size, (DWORD)freetype);
#else
state->STACK_IDX -= 3;
state->registers->eax = 1;
#endif
}
void api_callrawaddr() {
long long address = state->STACK[state->STACK_IDX--];
((void (*)())address)();
}