Skip to content

Commit

Permalink
Windows test
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Feb 26, 2024
1 parent 043a132 commit f7bc10d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gum/backend-windows/gumprocess-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <psapi.h>
#include <tchar.h>
#include <tlhelp32.h>
#include <inttypes.h>

#ifndef _MSC_VER
# pragma GCC diagnostic push
Expand Down Expand Up @@ -656,20 +657,22 @@ gum_thead_get_user_time (void)

mod = GetModuleHandle (_T ("kernel32.dll"));
if (mod == NULL)
return 0;
gum_panic ("Failed to GetModuleHandle: 0x%08x\n", GetLastError ());

get_thread_times =(GetThreadTimesFunc) GetProcAddress (mod,
"GetThreadTimes");
}

if (get_thread_times == NULL)
return 0;
gum_panic ("Failed to GetProcAddress: 0x%08x\n", GetLastError ());

if (!get_thread_times (GetCurrentThread (), NULL, NULL, NULL, &userTime))
return 0;
gum_panic ("Failed to GetThreadTimes: 0x%08x\n", GetLastError ());

result = (((guint64) userTime.dwHighDateTime) << 32) + userTime.dwLowDateTime;

g_print ("result: 0x%016" PRIx64 "x\n", result);

/* Timings on Windows are to 100-nanosecond granularity. Convert to u-secs */
return result / 10;
}
Expand Down

0 comments on commit f7bc10d

Please sign in to comment.