Commit e1259ff9 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

win32u: Return ERROR_ACCESS_DENIED for WH_JOURNALRECORD and WH_JOURNALPLAYBACK.

On > XP, settings WH_JOURNALRECORD or WH_JOURNALPLAYBACK hooks report ERROR_ACCESS_DENIED according to tests, even with administrator rights. PCSE_TERM depends on this to not crash. MSDN also says that journaling hooks APIs are unsupported starting in Windows 11. Reject journalling hooks unconditionally here because they have been broken for a long time.
parent 6dfeab55
......@@ -12271,7 +12271,6 @@ static void test_set_hook(void)
SetLastError(0xdeadbeef);
hhook = SetWindowsHookExA(WH_JOURNALRECORD, cbt_hook_proc, 0, 0);
ok(!hhook, "global hook requires hModule != 0\n");
todo_wine
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected error %ld\n", GetLastError());
SetLastError(0xdeadbeef);
......@@ -12297,9 +12296,7 @@ static void test_set_hook(void)
error = GetLastError();
if (i == WH_JOURNALRECORD || i == WH_JOURNALPLAYBACK)
{
todo_wine
ok(!hhook, "SetWinEventHook succeeded.\n");
todo_wine
ok(error == ERROR_ACCESS_DENIED, "Got unexpected error %ld.\n", GetLastError());
}
else
......
......@@ -97,6 +97,11 @@ HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWO
}
else /* system-global hook */
{
if (id == WH_JOURNALRECORD || id == WH_JOURNALPLAYBACK)
{
RtlSetLastWin32Error( ERROR_ACCESS_DENIED );
return 0;
}
if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;
else if (!inst)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment