diff --git a/gum/backend-windows/gumprocess-windows.c b/gum/backend-windows/gumprocess-windows.c index ccc2d8e6a..c1a1e483c 100644 --- a/gum/backend-windows/gumprocess-windows.c +++ b/gum/backend-windows/gumprocess-windows.c @@ -12,7 +12,6 @@ #include #include -#include #include #ifndef _MSC_VER @@ -282,7 +281,7 @@ gum_windows_get_thread_details (DWORD thread_id, if (g_once_init_enter (&initialized)) { get_thread_description = (GumGetThreadDescriptionFunc) GetProcAddress ( - GetModuleHandle (_T ("kernel32.dll")), + GetModuleHandleW (L"kernel32.dll"), "GetThreadDescription"); desired_access = THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME; @@ -537,7 +536,7 @@ gum_thread_try_get_ranges (GumMemoryRange * ranges, if (g_once_init_enter (&initialized)) { get_stack_limits = (GumGetCurrentThreadStackLimitsFunc) GetProcAddress ( - GetModuleHandle (_T ("kernel32.dll")), + GetModuleHandleW (L"kernel32.dll"), "GetCurrentThreadStackLimits"); g_once_init_leave (&initialized, TRUE); @@ -891,7 +890,7 @@ gum_windows_cpu_type_from_pid (guint pid, { HMODULE kernel32; - kernel32 = GetModuleHandle (_T ("kernel32.dll")); + kernel32 = GetModuleHandleW (L"kernel32.dll"); is_wow64_process = (GumIsWow64ProcessFunc) GetProcAddress (kernel32, "IsWow64Process"); diff --git a/gum/backend-x86/gumstalker-x86.c b/gum/backend-x86/gumstalker-x86.c index 4541ac271..4af087785 100644 --- a/gum/backend-x86/gumstalker-x86.c +++ b/gum/backend-x86/gumstalker-x86.c @@ -34,7 +34,6 @@ # define VC_EXTRALEAN # include # include -# include #endif #ifdef HAVE_LINUX # include @@ -974,8 +973,8 @@ gum_stalker_init (GumStalker * self) guint8 * p; GArray * impls; - ntmod = GetModuleHandle (_T ("ntdll.dll")); - usermod = GetModuleHandle (_T ("user32.dll")); + ntmod = GetModuleHandleW (L"ntdll.dll"); + usermod = GetModuleHandleW (L"user32.dll"); g_assert (ntmod != NULL && usermod != NULL); success = GetModuleInformation (GetCurrentProcess (), usermod, @@ -1014,9 +1013,9 @@ gum_stalker_init (GumStalker * self) self->wow_transition_impls = impls; gum_collect_export_by_handle (impls, ntmod, "Wow64Transition"); gum_collect_export_by_handle (impls, usermod, "Wow64Transition"); - gum_collect_export (impls, _T ("kernel32.dll"), "Wow64Transition"); - gum_collect_export (impls, _T ("kernelbase.dll"), "Wow64Transition"); - gum_collect_export (impls, _T ("win32u.dll"), "Wow64Transition"); + gum_collect_export (impls, L"kernel32.dll", "Wow64Transition"); + gum_collect_export (impls, L"kernelbase.dll", "Wow64Transition"); + gum_collect_export (impls, L"win32u.dll", "Wow64Transition"); } # endif #endif diff --git a/libs/gum/prof/gumbusycyclesampler-windows.c b/libs/gum/prof/gumbusycyclesampler-windows.c index 3d04b2b91..f02309885 100644 --- a/libs/gum/prof/gumbusycyclesampler-windows.c +++ b/libs/gum/prof/gumbusycyclesampler-windows.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * Copyright (C) 2008-2024 Ole André Vadla Ravnås * Copyright (C) 2008 Christian Berentsen * * Licence: wxWindows Library Licence, Version 3.1 @@ -13,7 +13,6 @@ #define WINVER 0x0600 #define _WIN32_WINNT 0x0600 #include -#include typedef BOOL (WINAPI * QueryThreadCycleTimeFunc) (HANDLE ThreadHandle, PULONG64 CycleTime); @@ -53,13 +52,8 @@ gum_busy_cycle_sampler_iface_init (gpointer g_iface, static void gum_busy_cycle_sampler_init (GumBusyCycleSampler * self) { - HMODULE mod; - - mod = GetModuleHandle (_T ("kernel32.dll")); - g_assert (mod != NULL); - - self->query_thread_cycle_time = - (QueryThreadCycleTimeFunc) GetProcAddress (mod, "QueryThreadCycleTime"); + self->query_thread_cycle_time = (QueryThreadCycleTimeFunc) GetProcAddress ( + GetModuleHandleW (L"kernel32.dll"), "QueryThreadCycleTime"); } GumSampler * diff --git a/tests/core/arch-x86/stalker-x86-fixture.c b/tests/core/arch-x86/stalker-x86-fixture.c index 8236686c9..68a3fa71f 100644 --- a/tests/core/arch-x86/stalker-x86-fixture.c +++ b/tests/core/arch-x86/stalker-x86-fixture.c @@ -18,7 +18,6 @@ #ifdef HAVE_WINDOWS # define VC_EXTRALEAN # include -# include #endif #ifdef HAVE_LINUX # include diff --git a/tests/core/arch-x86/stalker-x86.c b/tests/core/arch-x86/stalker-x86.c index 41fc84ae7..e29e9cf49 100644 --- a/tests/core/arch-x86/stalker-x86.c +++ b/tests/core/arch-x86/stalker-x86.c @@ -2673,7 +2673,7 @@ typedef void (* TestWindowMessageHandler) (TestWindow * window, struct _TestWindow { - LPTSTR klass; + ATOM klass; HWND handle; GumStalker * stalker; @@ -2803,7 +2803,7 @@ static TestWindow * create_test_window (GumStalker * stalker) { TestWindow * window; - WNDCLASS wc = { 0, }; + WNDCLASSW wc = { 0, }; window = g_slice_new (TestWindow); @@ -2811,17 +2811,17 @@ create_test_window (GumStalker * stalker) wc.lpfnWndProc = test_window_proc; wc.hInstance = GetModuleHandle (NULL); - wc.lpszClassName = _T ("GumTestWindowClass"); - window->klass = (LPTSTR) GSIZE_TO_POINTER (RegisterClass (&wc)); - g_assert_nonnull (window->klass); + wc.lpszClassName = L"GumTestWindowClass"; + window->klass = RegisterClassW (&wc); + g_assert_cmpuint (window->klass, !=, 0); #ifdef _MSC_VER # pragma warning (push) # pragma warning (disable: 4306) #endif - window->handle = CreateWindow (window->klass, _T ("GumTestWindow"), + window->handle = CreateWindowW ((LPCWSTR) window->klass, L"GumTestWindow", WS_CAPTION, 10, 10, 320, 240, HWND_MESSAGE, NULL, - GetModuleHandle (NULL), NULL); + GetModuleHandleW (NULL), NULL); #ifdef _MSC_VER # pragma warning (pop) #endif @@ -2836,7 +2836,8 @@ create_test_window (GumStalker * stalker) static void destroy_test_window (TestWindow * window) { - g_assert_true (UnregisterClass (window->klass, GetModuleHandle (NULL))); + g_assert_true (UnregisterClassW ((LPCWSTR) window->klass, + GetModuleHandleW (NULL))); g_slice_free (TestWindow, window); } diff --git a/tests/gumjs/script-fixture.c b/tests/gumjs/script-fixture.c index 476057d5a..08f93b8b4 100644 --- a/tests/gumjs/script-fixture.c +++ b/tests/gumjs/script-fixture.c @@ -27,7 +27,6 @@ # define WIN32_LEAN_AND_MEAN # endif # include -# include # include # include # include diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index 7711e98c2..d00639769 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -5872,7 +5872,7 @@ TESTCASE (module_export_can_be_found_by_name) gpointer actual_address; char actual_address_str[32]; - mod = GetModuleHandle (_T ("kernel32.dll")); + mod = GetModuleHandleW (L"kernel32.dll"); g_assert_nonnull (mod); actual_address = GetProcAddress (mod, "Sleep"); g_assert_nonnull (actual_address);