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 WINE_DEFAULT_DEBUG_CHANNEL(winlogon
);
15 /* FUNCTIONS ****************************************************************/
26 TRACE("GetSetupType()\n");
29 dwError
= RegOpenKeyExW(
35 if (dwError
!= ERROR_SUCCESS
)
39 dwSize
= sizeof(DWORD
);
40 dwError
= RegQueryValueExW(
48 /* Close key, and check if returned values are correct */
50 if (dwError
!= ERROR_SUCCESS
|| dwType
!= REG_DWORD
|| dwSize
!= sizeof(DWORD
))
53 TRACE("GetSetupType() returns %lu\n", dwSetupType
);
59 IN LPVOID lpParameter
)
61 PROCESS_INFORMATION ProcessInformation
;
62 STARTUPINFOW StartupInfo
;
63 WCHAR Shell
[MAX_PATH
];
64 WCHAR CommandLine
[MAX_PATH
];
72 TRACE("RunSetup() called\n");
75 dwError
= RegOpenKeyExW(
81 if (dwError
!= ERROR_SUCCESS
)
85 dwSize
= (sizeof(Shell
) / sizeof(Shell
[0])) - 1;
86 dwError
= RegQueryValueExW(
94 if (dwError
!= ERROR_SUCCESS
)
98 Shell
[dwSize
/ sizeof(WCHAR
)] = UNICODE_NULL
;
100 /* Expand string (if applicable) */
101 if (dwType
== REG_EXPAND_SZ
)
102 ExpandEnvironmentStringsW(Shell
, CommandLine
, MAX_PATH
);
103 else if (dwType
== REG_SZ
)
104 wcscpy(CommandLine
, Shell
);
108 TRACE("Should run '%s' now\n", debugstr_w(CommandLine
));
111 StartupInfo
.cb
= sizeof(StartupInfo
);
112 StartupInfo
.lpReserved
= NULL
;
113 StartupInfo
.lpDesktop
= NULL
;
114 StartupInfo
.lpTitle
= NULL
;
115 StartupInfo
.dwFlags
= 0;
116 StartupInfo
.cbReserved2
= 0;
117 StartupInfo
.lpReserved2
= 0;
118 Result
= CreateProcessW(
128 &ProcessInformation
);
131 TRACE("Failed to run setup process\n");
135 /* Wait for process termination */
136 WaitForSingleObject(ProcessInformation
.hProcess
, INFINITE
);
138 GetExitCodeProcess(ProcessInformation
.hProcess
, &dwExitCode
);
141 CloseHandle(ProcessInformation
.hThread
);
142 CloseHandle(ProcessInformation
.hProcess
);
144 TRACE ("RunSetup() done\n");
154 hThread
= CreateThread(NULL
, 0, RunSetupThreadProc
, NULL
, 0, NULL
);
155 return hThread
!= NULL
;