@@ -45,7 +45,7 @@ HKEY hEnumKey = NULL;
4545HKEY hClassKey = NULL ;
4646BOOL g_IsUISuppressed = FALSE;
4747BOOL g_ShuttingDown = FALSE;
48- BOOL g_IsLiveMedium = FALSE;
48+ BOOL g_IsMiniNT = FALSE;
4949
5050/* FUNCTIONS *****************************************************************/
5151
@@ -201,59 +201,25 @@ GetSuppressNewUIValue(VOID)
201201 return bSuppressNewHWUI ;
202202}
203203
204- BOOL
205- RunningOnLiveMedium (VOID )
204+ /**
205+ * @brief Check whether we are running in MiniNT mode (e.g. live medium).
206+ **/
207+ static BOOL
208+ IsMiniNT (VOID )
206209{
207- WCHAR Options [MAX_PATH ];
208- PWSTR CurrentOption , NextOption ;
209- HKEY hControlKey ;
210- DWORD dwType ;
211- DWORD dwSize ;
212- DWORD dwError ;
213- BOOL LiveMedium = FALSE;
214-
215- DPRINT ("RunningOnLiveMedium()\n" );
216-
217- /* Open the Setup key */
218- dwError = RegOpenKeyExW (HKEY_LOCAL_MACHINE ,
219- L"SYSTEM\\CurrentControlSet\\Control" ,
220- 0 ,
221- KEY_QUERY_VALUE ,
222- & hControlKey );
223- if (dwError != ERROR_SUCCESS )
224- goto done ;
225-
226- /* Read the CmdLine value */
227- dwSize = sizeof (Options );
228- dwError = RegQueryValueExW (hControlKey ,
229- L"SystemStartOptions" ,
230- NULL ,
231- & dwType ,
232- (LPBYTE )Options ,
233- & dwSize );
234- if ((dwError != ERROR_SUCCESS ) || (dwType != REG_SZ ))
235- goto done ;
236-
237- /* Check for the '-mini' option */
238- CurrentOption = Options ;
239- while (CurrentOption )
240- {
241- NextOption = wcschr (CurrentOption , L' ' );
242- if (NextOption )
243- * NextOption = L'\0' ;
244- if (_wcsicmp (CurrentOption , L"MININT" ) == 0 )
245- {
246- DPRINT ("Found 'MININT' boot option\n" );
247- LiveMedium = TRUE;
248- goto done ;
249- }
250- CurrentOption = NextOption ? NextOption + 1 : NULL ;
251- }
252-
253- done :
254- RegCloseKey (hControlKey );
255-
256- return LiveMedium ;
210+ HKEY hKey ;
211+ LONG rc ;
212+
213+ /* Check for the presence of the "MiniNT" registry key */
214+ rc = RegOpenKeyExW (HKEY_LOCAL_MACHINE ,
215+ L"SYSTEM\\CurrentControlSet\\Control\\MiniNT" ,
216+ 0 ,
217+ KEY_QUERY_VALUE ,
218+ & hKey );
219+ if (rc == ERROR_SUCCESS )
220+ RegCloseKey (hKey );
221+
222+ return (rc == ERROR_SUCCESS );
257223}
258224
259225VOID WINAPI
@@ -267,7 +233,7 @@ ServiceMain(DWORD argc, LPTSTR *argv)
267233
268234 DPRINT ("ServiceMain() called\n" );
269235
270- g_IsLiveMedium = RunningOnLiveMedium ();
236+ g_IsMiniNT = IsMiniNT ();
271237
272238 ServiceStatusHandle = RegisterServiceCtrlHandlerExW (ServiceName ,
273239 ServiceControlHandler ,
0 commit comments