From 88fc1a6d242cfff3314a0eb6d86a06800494555d Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 19 Jul 2021 22:03:05 -0400 Subject: [PATCH] [host] windows: directly invoke ChangeWindowMessageFilterEx This requires bumping the minimum Windows version to Windows 7, but I don't think we care about Vista anyways. --- host/platform/Windows/CMakeLists.txt | 4 ++-- host/platform/Windows/src/platform.c | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/host/platform/Windows/CMakeLists.txt b/host/platform/Windows/CMakeLists.txt index a30b8037..32b93c75 100644 --- a/host/platform/Windows/CMakeLists.txt +++ b/host/platform/Windows/CMakeLists.txt @@ -13,8 +13,8 @@ add_library(platform_Windows STATIC src/delay.c ) -# allow use of functions for Windows Vista or later -add_compile_definitions(WINVER=0x0600 _WIN32_WINNT=0x0600) +# allow use of functions for Windows 7 or later +add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601) add_subdirectory("capture") diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index 3b6834be..9cab4cbe 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -65,15 +65,6 @@ struct AppState static struct AppState app = {0}; HWND MessageHWND; -// linux mingw64 is missing this -#ifndef MSGFLT_RESET - #define MSGFLT_RESET (0) - #define MSGFLT_ALLOW (1) - #define MSGFLT_DISALLOW (2) -#endif -typedef WINBOOL WINAPI (*PChangeWindowMessageFilterEx)(HWND hwnd, UINT message, DWORD action, void * pChangeFilterStruct); -PChangeWindowMessageFilterEx _ChangeWindowMessageFilterEx = NULL; - CreateProcessAsUserA_t f_CreateProcessAsUserA = NULL; bool windowsSetupAPI(void) @@ -425,10 +416,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine app.exitThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL); // this is needed so that unprivileged processes can send us this message - HMODULE user32 = GetModuleHandle("user32.dll"); - _ChangeWindowMessageFilterEx = (PChangeWindowMessageFilterEx)GetProcAddress(user32, "ChangeWindowMessageFilterEx"); - if (_ChangeWindowMessageFilterEx) - _ChangeWindowMessageFilterEx(app.messageWnd, app.trayRestartMsg, MSGFLT_ALLOW, NULL); + ChangeWindowMessageFilterEx(app.messageWnd, app.trayRestartMsg, MSGFLT_ALLOW, NULL); // set the global MessageHWND = app.messageWnd;