diff --git a/src/mumble/GlobalShortcut_win.cpp b/src/mumble/GlobalShortcut_win.cpp index 7dd78ceb8..4273c50f2 100644 --- a/src/mumble/GlobalShortcut_win.cpp +++ b/src/mumble/GlobalShortcut_win.cpp @@ -74,6 +74,7 @@ GlobalShortcutWin::GlobalShortcutWin() { f[i] = ucWindowFromPointNew[i]; FlushInstructionCache(GetCurrentProcess(), f, 6); + VirtualProtect(f, 6, oldProtect, &oldProtect); } else { qWarning("GlobalShortcutWin: Failed to patch WindowFromPoint"); } @@ -95,8 +96,11 @@ HWND WINAPI GlobalShortcutWin::HookWindowFromPoint(POINT p) { if (g.ocIntercept) return g.ocIntercept->qgv.winId(); + DWORD oldProtect; unsigned char *f = reinterpret_cast(&WindowFromPoint); + VirtualProtect(f, 6, PAGE_EXECUTE_READWRITE, &oldProtect); + for (int i=0;i<6;++i) f[i] = ucWindowFromPointOrig[i]; FlushInstructionCache(GetCurrentProcess(), f, 6); @@ -107,6 +111,8 @@ HWND WINAPI GlobalShortcutWin::HookWindowFromPoint(POINT p) { f[i] = ucWindowFromPointNew[i]; FlushInstructionCache(GetCurrentProcess(), f, 6); + VirtualProtect(f, 6, oldProtect, &oldProtect); + return hwnd; } #endif