From 0fa2d82c678c6961e777e201e8aebf90f3f50203 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Wed, 21 Aug 2019 10:46:58 +0200 Subject: [PATCH] Fixed overlay on x64 They are not longer available with GetWindowLong. There is a new function GetWindowLongPtr. GWLP* must be used. --- overlay_experimental/Hook_Manager.cpp | 2 +- overlay_experimental/Windows_Hook.cpp | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/overlay_experimental/Hook_Manager.cpp b/overlay_experimental/Hook_Manager.cpp index 6398e74..a6458e7 100644 --- a/overlay_experimental/Hook_Manager.cpp +++ b/overlay_experimental/Hook_Manager.cpp @@ -396,7 +396,7 @@ void Hook_Manager::create_hook(const char* libname) bool Hook_Manager::stop_retry() { - // Retry 200 times, we look for rendering functions so its actually: "retry for 200 frames" + // Retry or not bool stop = ++_hook_retries >= max_hook_retries; if (stop) diff --git a/overlay_experimental/Windows_Hook.cpp b/overlay_experimental/Windows_Hook.cpp index 6218b00..55530e3 100644 --- a/overlay_experimental/Windows_Hook.cpp +++ b/overlay_experimental/Windows_Hook.cpp @@ -14,16 +14,13 @@ HWND GetGameWindow() { if (!GetParent(hWnd)) { -#if defined(_WIN64) - if (GetModuleHandle(NULL) == (HINSTANCE)GetWindowLong(hWnd, GWLP_HINSTANCE)) + if (GetModuleHandle(NULL) == (HMODULE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE)) break; -#elif defined(_WIN32) - if (GetModuleHandle(NULL) == (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE)) - break; -#endif } hWnd = GetWindow(hWnd, GW_HWNDNEXT); } + if (!hWnd) + PRINT_DEBUG("Failed to get game window HWND\n"); return hWnd; }