[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.
This commit is contained in:
Quantum 2021-07-19 22:03:05 -04:00 committed by Geoffrey McRae
parent 2fc1d3cae6
commit 88fc1a6d24
2 changed files with 3 additions and 15 deletions

View File

@ -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")

View File

@ -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;