mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Reprotect WindowFromPoint after patching
This commit is contained in:
parent
aa77c1e34b
commit
47a45386e9
@ -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<unsigned char *>(&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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user