diff --git a/base/services/umpnpmgr/precomp.h b/base/services/umpnpmgr/precomp.h index e687bb19bcf..11f89c46c8e 100644 --- a/base/services/umpnpmgr/precomp.h +++ b/base/services/umpnpmgr/precomp.h @@ -105,7 +105,7 @@ extern HKEY hEnumKey; extern HKEY hClassKey; extern BOOL g_IsUISuppressed; extern BOOL g_ShuttingDown; -extern BOOL g_IsLiveMedium; +extern BOOL g_IsMiniNT; BOOL GetSuppressNewUIValue(VOID); diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 435dbdd56f3..34624ef13cc 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -791,7 +791,7 @@ PNP_ReportLogOn( hBinding, Admin, ProcessId); /* Fail, if the caller is not an interactive user */ - if ((g_IsLiveMedium == FALSE) && (IsCallerInteractive(hBinding) == FALSE)) + if ((g_IsMiniNT == FALSE) && (IsCallerInteractive(hBinding) == FALSE)) goto cleanup; /* Get the users token */ diff --git a/base/services/umpnpmgr/umpnpmgr.c b/base/services/umpnpmgr/umpnpmgr.c index 518d91a5dcd..d3db636eee0 100644 --- a/base/services/umpnpmgr/umpnpmgr.c +++ b/base/services/umpnpmgr/umpnpmgr.c @@ -45,7 +45,7 @@ HKEY hEnumKey = NULL; HKEY hClassKey = NULL; BOOL g_IsUISuppressed = FALSE; BOOL g_ShuttingDown = FALSE; -BOOL g_IsLiveMedium = FALSE; +BOOL g_IsMiniNT = FALSE; /* FUNCTIONS *****************************************************************/ @@ -201,59 +201,25 @@ GetSuppressNewUIValue(VOID) return bSuppressNewHWUI; } -BOOL -RunningOnLiveMedium(VOID) +/** + * @brief Check whether we are running in MiniNT mode (e.g. live medium). + **/ +static BOOL +IsMiniNT(VOID) { - WCHAR Options[MAX_PATH]; - PWSTR CurrentOption, NextOption; - HKEY hControlKey; - DWORD dwType; - DWORD dwSize; - DWORD dwError; - BOOL LiveMedium = FALSE; + HKEY hKey; + LONG rc; - DPRINT("RunningOnLiveMedium()\n"); + /* Check for the presence of the "MiniNT" registry key */ + rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\MiniNT", + 0, + KEY_QUERY_VALUE, + &hKey); + if (rc == ERROR_SUCCESS) + RegCloseKey(hKey); - /* Open the Setup key */ - dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control", - 0, - KEY_QUERY_VALUE, - &hControlKey); - if (dwError != ERROR_SUCCESS) - goto done; - - /* Read the CmdLine value */ - dwSize = sizeof(Options); - dwError = RegQueryValueExW(hControlKey, - L"SystemStartOptions", - NULL, - &dwType, - (LPBYTE)Options, - &dwSize); - if ((dwError != ERROR_SUCCESS) || (dwType != REG_SZ)) - goto done; - - /* Check for the '-mini' option */ - CurrentOption = Options; - while (CurrentOption) - { - NextOption = wcschr(CurrentOption, L' '); - if (NextOption) - *NextOption = L'\0'; - if (_wcsicmp(CurrentOption, L"MININT") == 0) - { - DPRINT("Found 'MININT' boot option\n"); - LiveMedium = TRUE; - goto done; - } - CurrentOption = NextOption ? NextOption + 1 : NULL; - } - -done: - RegCloseKey(hControlKey); - - return LiveMedium; + return (rc == ERROR_SUCCESS); } VOID WINAPI @@ -267,7 +233,7 @@ ServiceMain(DWORD argc, LPTSTR *argv) DPRINT("ServiceMain() called\n"); - g_IsLiveMedium = RunningOnLiveMedium(); + g_IsMiniNT = IsMiniNT(); ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, ServiceControlHandler,