2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Winlogon
4 * FILE: base/system/winlogon/setup.c
5 * PURPOSE: Setup support functions
6 * PROGRAMMERS: Eric Kohl
9 /* INCLUDES *****************************************************************/
13 #include <wine/debug.h>
15 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
17 /* FUNCTIONS ****************************************************************/
28 TRACE("GetSetupType()\n");
31 dwError
= RegOpenKeyExW(
37 if (dwError
!= ERROR_SUCCESS
)
41 dwSize
= sizeof(DWORD
);
42 dwError
= RegQueryValueExW(
50 /* Close key, and check if returned values are correct */
52 if (dwError
!= ERROR_SUCCESS
|| dwType
!= REG_DWORD
|| dwSize
!= sizeof(DWORD
))
55 TRACE("GetSetupType() returns %lu\n", dwSetupType
);
61 IN LPVOID lpParameter
)
63 PROCESS_INFORMATION ProcessInformation
;
64 STARTUPINFOW StartupInfo
;
65 WCHAR Shell
[MAX_PATH
];
66 WCHAR CommandLine
[MAX_PATH
];
74 TRACE("RunSetup() called\n");
77 dwError
= RegOpenKeyExW(
83 if (dwError
!= ERROR_SUCCESS
)
87 dwSize
= (sizeof(Shell
) / sizeof(Shell
[0])) - 1;
88 dwError
= RegQueryValueExW(
96 if (dwError
!= ERROR_SUCCESS
)
100 Shell
[dwSize
/ sizeof(WCHAR
)] = UNICODE_NULL
;
102 /* Expand string (if applicable) */
103 if (dwType
== REG_EXPAND_SZ
)
104 ExpandEnvironmentStringsW(Shell
, CommandLine
, MAX_PATH
);
105 else if (dwType
== REG_SZ
)
106 wcscpy(CommandLine
, Shell
);
110 TRACE("Should run '%s' now\n", debugstr_w(CommandLine
));
113 StartupInfo
.cb
= sizeof(StartupInfo
);
114 StartupInfo
.lpReserved
= NULL
;
115 StartupInfo
.lpDesktop
= NULL
;
116 StartupInfo
.lpTitle
= NULL
;
117 StartupInfo
.dwFlags
= 0;
118 StartupInfo
.cbReserved2
= 0;
119 StartupInfo
.lpReserved2
= 0;
120 Result
= CreateProcessW(
130 &ProcessInformation
);
133 TRACE("Failed to run setup process\n");
137 /* Wait for process termination */
138 WaitForSingleObject(ProcessInformation
.hProcess
, INFINITE
);
140 GetExitCodeProcess(ProcessInformation
.hProcess
, &dwExitCode
);
143 CloseHandle(ProcessInformation
.hThread
);
144 CloseHandle(ProcessInformation
.hProcess
);
146 TRACE ("RunSetup() done\n");
156 hThread
= CreateThread(NULL
, 0, RunSetupThreadProc
, NULL
, 0, NULL
);
157 return hThread
!= NULL
;