From e51e5de1f856e69eb4cdb8d39e1b6aa847cf038c Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Mon, 2 Dec 2024 20:42:46 +0100 Subject: [PATCH] [EXPLORER] Remove redundant bIsSystemShell assignments (#7542) Addendum to commit df197bc42 (PR #7502) CORE-19887 --- base/shell/explorer/explorer.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/base/shell/explorer/explorer.cpp b/base/shell/explorer/explorer.cpp index d51a32976cc..140a1e93ffa 100644 --- a/base/shell/explorer/explorer.cpp +++ b/base/shell/explorer/explorer.cpp @@ -99,13 +99,9 @@ IsExplorerSystemShell() LPWSTR szExplorer = PathFindFileNameW(szPath); HKEY hKeyWinlogon; - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", - 0, KEY_READ, &hKeyWinlogon) != ERROR_SUCCESS) - { - // No registry access. - bIsSystemShell = TRUE; - } - else + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", + 0, KEY_READ, &hKeyWinlogon) == ERROR_SUCCESS) { LSTATUS Status; DWORD dwType; @@ -116,9 +112,7 @@ IsExplorerSystemShell() Status = RegQueryValueExW(hKeyWinlogon, L"Shell", 0, &dwType, (LPBYTE)szShell, &cbShell); if (Status == ERROR_SUCCESS) { - if ((dwType == REG_SZ || dwType == REG_EXPAND_SZ) && StrStrI(szShell, szExplorer)) - bIsSystemShell = TRUE; - else + if ((dwType != REG_SZ && dwType != REG_EXPAND_SZ) || !StrStrIW(szShell, szExplorer)) bIsSystemShell = FALSE; }