3 * Copyright (C) 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS winlogon
22 * FILE: subsys/system/winlogon/setup.h
23 * PURPOSE: Setup support functions
24 * PROGRAMMER: Eric Kohl
27 /* INCLUDES *****************************************************************/
31 #include <lsass/ntsecapi.h>
40 /* FUNCTIONS ****************************************************************/
51 dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
52 "SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
56 if (dwError != ERROR_SUCCESS)
61 dwSize = sizeof(DWORD);
62 dwError = RegQueryValueEx (hKey,
63 "SetupType", //TEXT("SetupType"),
69 if (dwError != ERROR_SUCCESS || dwType != REG_DWORD)
79 SetSetupType (DWORD dwSetupType)
84 dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
85 "SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
89 if (dwError != ERROR_SUCCESS)
94 dwError = RegSetValueEx (hKey,
95 "SetupType", //TEXT("SetupType"),
101 if (dwError != ERROR_SUCCESS)
113 PROCESS_INFORMATION ProcessInformation;
114 STARTUPINFO StartupInfo;
115 CHAR CommandLine[MAX_PATH];
123 DPRINT ("RunSetup() called\n");
125 dwError = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
130 if (dwError != ERROR_SUCCESS)
136 dwError = RegQueryValueEx (hKey,
143 if (dwError != ERROR_SUCCESS || dwType != REG_SZ)
148 DPRINT ("Winlogon: Should run '%s' now.\n", CommandLine);
150 StartupInfo.cb = sizeof(StartupInfo);
151 StartupInfo.lpReserved = NULL;
152 StartupInfo.lpDesktop = NULL;
153 StartupInfo.lpTitle = NULL;
154 StartupInfo.dwFlags = 0;
155 StartupInfo.cbReserved2 = 0;
156 StartupInfo.lpReserved2 = 0;
158 DPRINT ("Winlogon: Creating new setup process\n");
160 Result = CreateProcess (NULL,
169 &ProcessInformation);
172 DPRINT ("Winlogon: Failed to run setup process\n");
176 /* Wait for process termination */
177 WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
179 GetExitCodeProcess (ProcessInformation.hProcess, &dwExitCode);
181 CloseHandle (ProcessInformation.hThread);
182 CloseHandle (ProcessInformation.hProcess);
189 DPRINT ("Winlogon: RunSetup() done.\n");