From b8c5e9c209447d877a2e41057724d5be172d8a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Mon, 9 Jun 2025 18:14:06 +0200 Subject: [PATCH] [WINLOGON] Check whether error popups should be shown if loading user profile fails (#8139) Respect the `"NoPopupsOnBoot"` REG_DWORD value in `HKLM\System\CurrentControlSet\Control\Windows` https://www.visualautomation.com/comprod/secure6/nopopups.htm --- base/system/winlogon/sas.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/base/system/winlogon/sas.c b/base/system/winlogon/sas.c index e1570d0b8ad..9ea8c426a3b 100644 --- a/base/system/winlogon/sas.c +++ b/base/system/winlogon/sas.c @@ -501,9 +501,14 @@ HandleLogon( /* Loading personal settings */ DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS); + ProfileInfo.hProfile = INVALID_HANDLE_VALUE; - if (0 == (Session->Options & WLX_LOGON_OPT_NO_PROFILE)) + if (!(Session->Options & WLX_LOGON_OPT_NO_PROFILE)) { + HKEY hKey; + LONG lError; + BOOL bNoPopups = FALSE; + if (Session->Profile == NULL || (Session->Profile->dwType != WLX_PROFILE_TYPE_V1_0 && Session->Profile->dwType != WLX_PROFILE_TYPE_V2_0)) @@ -512,10 +517,28 @@ HandleLogon( goto cleanup; } + /* Check whether error messages may be displayed when loading the user profile */ + lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Control\\Windows", + 0, + KEY_QUERY_VALUE, + &hKey); + if (lError == ERROR_SUCCESS) + { + DWORD dwValue, dwType, cbData = sizeof(dwValue); + lError = RegQueryValueExW(hKey, L"NoPopupsOnBoot", NULL, + &dwType, (PBYTE)&dwValue, &cbData); + if ((lError == ERROR_SUCCESS) && (dwType == REG_DWORD) && (cbData == sizeof(dwValue))) + bNoPopups = !!dwValue; + + RegCloseKey(hKey); + } + /* Load the user profile */ - ZeroMemory(&ProfileInfo, sizeof(PROFILEINFOW)); - ProfileInfo.dwSize = sizeof(PROFILEINFOW); - ProfileInfo.dwFlags = 0; + ZeroMemory(&ProfileInfo, sizeof(ProfileInfo)); + ProfileInfo.dwSize = sizeof(ProfileInfo); + if (bNoPopups) + ProfileInfo.dwFlags |= PI_NOUI; ProfileInfo.lpUserName = Session->MprNotifyInfo.pszUserName; ProfileInfo.lpProfilePath = Session->Profile->pszProfile; if (Session->Profile->dwType >= WLX_PROFILE_TYPE_V2_0)