From c6fecdda65e21ac16731e208c66b259e0b4b4f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Mon, 1 Sep 2025 11:37:17 +0200 Subject: [PATCH] [NTUSER] NtUserSetLogonNotifyWindow(): Lock-protect access to global data (#8369) Like with all the other win32k NtUser* functions, acquire on entry and release on exit the global lock, since the function is reading/writing to global variables. Also, set the last-error to ERROR_ACCESS_DENIED if the caller isn't the registered logon process. --- win32ss/user/ntuser/winsta.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index 4e9a52692b9..0b8d11e1e05 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -1963,19 +1963,25 @@ NtUserBuildNameList( BOOL APIENTRY NtUserSetLogonNotifyWindow(HWND hWnd) { - if (gpidLogon != PsGetCurrentProcessId()) - { - return FALSE; - } + BOOL Ret = FALSE; + + UserEnterExclusive(); if (!IntIsWindow(hWnd)) + goto Leave; + + if (gpidLogon != PsGetCurrentProcessId()) { - return FALSE; + EngSetLastError(ERROR_ACCESS_DENIED); + goto Leave; } hwndSAS = hWnd; + Ret = TRUE; - return TRUE; +Leave: + UserLeave(); + return Ret; } BOOL