Skip to content

Commit

Permalink
make QueryPerformanceCounter() success
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecat committed Feb 21, 2019
1 parent 9b21d23 commit 0927bdb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pe_libs.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,14 @@ static uint32_t exec_kernel32(uint32_t regs[], const char* func_name) {
regs[EAX] = 0;
return 0;
} else if (strcmp(func_name, "QueryPerformanceCounter") == 0) {
regs[EAX] = 0; /* 失敗 */
uint32_t outptr;
if (!dmem_get_args(regs[ESP], 1, &outptr) || !dmemory_is_allocated(outptr, 8)) {
regs[EAX] = 0; /* 失敗 */
} else {
dmem_write_uint(outptr, 0, 4);
dmem_write_uint(outptr + 4, 0, 4);
regs[EAX] = 1;
}
return 4;
} else {
fprintf(stderr, "unimplemented function %s() in kernel32.dll called.\n", func_name);
Expand Down

0 comments on commit 0927bdb

Please sign in to comment.