- Support expanding environment variables in the setup command line.

svn path=/trunk/; revision=9612
This commit is contained in:
Filip Navara 2004-06-04 23:46:02 +00:00
parent a880f2ee82
commit fe2abd0550

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS winlogon
* FILE: subsys/system/winlogon/setup.h
@ -112,6 +112,7 @@ RunSetup (VOID)
{
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StartupInfo;
WCHAR Shell[MAX_PATH];
WCHAR CommandLine[MAX_PATH];
BOOLEAN Result;
DWORD dwError;
@ -122,7 +123,7 @@ RunSetup (VOID)
DPRINT ("RunSetup() called\n");
dwError = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
dwError = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SYSTEM\\Setup",
0,
KEY_QUERY_VALUE,
@ -133,19 +134,32 @@ RunSetup (VOID)
}
dwSize = MAX_PATH;
dwError = RegQueryValueEx (hKey,
dwError = RegQueryValueExW (hKey,
L"CmdLine",
NULL,
&dwType,
(LPBYTE)CommandLine,
(LPBYTE)Shell,
&dwSize);
RegCloseKey (hKey);
if (dwError != ERROR_SUCCESS || dwType != REG_SZ)
if (dwError != ERROR_SUCCESS)
{
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.lpReserved = NULL;
@ -157,7 +171,7 @@ RunSetup (VOID)
DPRINT ("Winlogon: Creating new setup process\n");
Result = CreateProcess (NULL,
Result = CreateProcessW (NULL,
CommandLine,
NULL,
NULL,