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(HKEY_LOCAL_MACHINE
,
34 if (dwError
!= ERROR_SUCCESS
)
38 dwSize
= sizeof(DWORD
);
39 dwError
= RegQueryValueExW(hKey
,
46 /* Close key, and check if returned values are correct */
48 if (dwError
!= ERROR_SUCCESS
|| dwType
!= REG_DWORD
|| dwSize
!= sizeof(DWORD
))
51 TRACE("GetSetupType() returns %lu\n", dwSetupType
);
59 RunSetupThreadProc(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(HKEY_LOCAL_MACHINE
,
80 if (dwError
!= ERROR_SUCCESS
)
84 dwSize
= (sizeof(Shell
) / sizeof(Shell
[0])) - 1;
85 dwError
= RegQueryValueExW(hKey
,
92 if (dwError
!= ERROR_SUCCESS
)
96 Shell
[dwSize
/ sizeof(WCHAR
)] = UNICODE_NULL
;
98 /* Expand string (if applicable) */
99 if (dwType
== REG_EXPAND_SZ
)
100 ExpandEnvironmentStringsW(Shell
, CommandLine
, MAX_PATH
);
101 else if (dwType
== REG_SZ
)
102 wcscpy(CommandLine
, Shell
);
106 TRACE("Should run '%s' now\n", debugstr_w(CommandLine
));
109 StartupInfo
.cb
= sizeof(StartupInfo
);
110 StartupInfo
.lpReserved
= NULL
;
111 StartupInfo
.lpDesktop
= NULL
;
112 StartupInfo
.lpTitle
= NULL
;
113 StartupInfo
.dwFlags
= 0;
114 StartupInfo
.cbReserved2
= 0;
115 StartupInfo
.lpReserved2
= 0;
117 Result
= CreateProcessW(NULL
,
126 &ProcessInformation
);
129 TRACE("Failed to run setup process\n");
133 /* Wait for process termination */
134 WaitForSingleObject(ProcessInformation
.hProcess
, INFINITE
);
136 GetExitCodeProcess(ProcessInformation
.hProcess
, &dwExitCode
);
139 CloseHandle(ProcessInformation
.hThread
);
140 CloseHandle(ProcessInformation
.hProcess
);
142 TRACE ("RunSetup() done\n");
153 hThread
= CreateThread(NULL
,
160 return hThread
!= NULL
;