mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 16:31:07 +08:00
[UMPNPMGR] Fix the LiveCD check
This commit is contained in:
@@ -204,13 +204,49 @@ GetSuppressNewUIValue(VOID)
|
||||
BOOL
|
||||
RunningOnLiveMedium(VOID)
|
||||
{
|
||||
WCHAR LogPath[MAX_PATH];
|
||||
WCHAR CommandLine[MAX_PATH];
|
||||
HKEY hSetupKey;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
DWORD dwError;
|
||||
BOOL LiveMedium = FALSE;
|
||||
|
||||
GetSystemWindowsDirectoryW(LogPath, ARRAYSIZE(LogPath));
|
||||
if (GetDriveTypeW(LogPath) == DRIVE_FIXED)
|
||||
return FALSE;
|
||||
DPRINT("RunningOnLiveMedium()\n");
|
||||
|
||||
return TRUE;
|
||||
/* Open the Setup key */
|
||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"SYSTEM\\Setup",
|
||||
0,
|
||||
KEY_QUERY_VALUE,
|
||||
&hSetupKey);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
goto done;
|
||||
|
||||
/* Read the CmdLine value */
|
||||
dwSize = sizeof(CommandLine);
|
||||
dwError = RegQueryValueExW(hSetupKey,
|
||||
L"CmdLine",
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE)CommandLine,
|
||||
&dwSize);
|
||||
if (dwError != ERROR_SUCCESS ||
|
||||
(dwType != REG_SZ &&
|
||||
dwType != REG_EXPAND_SZ &&
|
||||
dwType != REG_MULTI_SZ))
|
||||
goto done;
|
||||
|
||||
/* Check for the '-mini' option */
|
||||
if (wcsstr(CommandLine, L" -mini") != NULL)
|
||||
{
|
||||
DPRINT("Running on LiveMedium\n");
|
||||
LiveMedium = TRUE;
|
||||
}
|
||||
|
||||
done:
|
||||
RegCloseKey(hSetupKey);
|
||||
|
||||
return LiveMedium;
|
||||
}
|
||||
|
||||
VOID WINAPI
|
||||
|
||||
Reference in New Issue
Block a user