mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
- Support expanding environment variables in the setup command line.
svn path=/trunk/; revision=9612
This commit is contained in:
parent
a880f2ee82
commit
fe2abd0550
1 changed files with 38 additions and 24 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: setup.c,v 1.2 2003/12/01 18:21:04 weiden Exp $
|
/* $Id: setup.c,v 1.3 2004/06/04 23:46:02 navaraf Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS winlogon
|
* PROJECT: ReactOS winlogon
|
||||||
* FILE: subsys/system/winlogon/setup.h
|
* FILE: subsys/system/winlogon/setup.h
|
||||||
|
@ -112,6 +112,7 @@ RunSetup (VOID)
|
||||||
{
|
{
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
STARTUPINFO StartupInfo;
|
STARTUPINFO StartupInfo;
|
||||||
|
WCHAR Shell[MAX_PATH];
|
||||||
WCHAR CommandLine[MAX_PATH];
|
WCHAR CommandLine[MAX_PATH];
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
@ -122,30 +123,43 @@ RunSetup (VOID)
|
||||||
|
|
||||||
DPRINT ("RunSetup() called\n");
|
DPRINT ("RunSetup() called\n");
|
||||||
|
|
||||||
dwError = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
|
dwError = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
|
||||||
L"SYSTEM\\Setup",
|
L"SYSTEM\\Setup",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey);
|
&hKey);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwSize = MAX_PATH;
|
dwSize = MAX_PATH;
|
||||||
dwError = RegQueryValueEx (hKey,
|
dwError = RegQueryValueExW (hKey,
|
||||||
L"CmdLine",
|
L"CmdLine",
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
(LPBYTE)CommandLine,
|
(LPBYTE)Shell,
|
||||||
&dwSize);
|
&dwSize);
|
||||||
RegCloseKey (hKey);
|
RegCloseKey (hKey);
|
||||||
if (dwError != ERROR_SUCCESS || dwType != REG_SZ)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("Winlogon: Should run '%s' now.\n", CommandLine);
|
if (dwType == REG_EXPAND_SZ)
|
||||||
|
{
|
||||||
|
ExpandEnvironmentStringsW(Shell, CommandLine, MAX_PATH);
|
||||||
|
}
|
||||||
|
else if (dwType == REG_SZ)
|
||||||
|
{
|
||||||
|
wcscpy(CommandLine, Shell);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT ("Winlogon: Should run '%S' now.\n", CommandLine);
|
||||||
|
|
||||||
StartupInfo.cb = sizeof(StartupInfo);
|
StartupInfo.cb = sizeof(StartupInfo);
|
||||||
StartupInfo.lpReserved = NULL;
|
StartupInfo.lpReserved = NULL;
|
||||||
|
@ -157,16 +171,16 @@ RunSetup (VOID)
|
||||||
|
|
||||||
DPRINT ("Winlogon: Creating new setup process\n");
|
DPRINT ("Winlogon: Creating new setup process\n");
|
||||||
|
|
||||||
Result = CreateProcess (NULL,
|
Result = CreateProcessW (NULL,
|
||||||
CommandLine,
|
CommandLine,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
DETACHED_PROCESS,
|
DETACHED_PROCESS,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
DPRINT ("Winlogon: Failed to run setup process\n");
|
DPRINT ("Winlogon: Failed to run setup process\n");
|
||||||
|
|
Loading…
Reference in a new issue