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 /* FUNCTIONS ****************************************************************/
24 TRACE("GetSetupType()\n");
27 dwError
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
32 if (dwError
!= ERROR_SUCCESS
)
36 dwSize
= sizeof(DWORD
);
37 dwError
= RegQueryValueExW(hKey
,
44 /* Close key, and check if returned values are correct */
46 if (dwError
!= ERROR_SUCCESS
|| dwType
!= REG_DWORD
|| dwSize
!= sizeof(DWORD
))
49 TRACE("GetSetupType() returns %lu\n", dwSetupType
);
58 IN LPVOID lpParameter
)
60 PROCESS_INFORMATION ProcessInformation
;
61 STARTUPINFOW StartupInfo
;
62 WCHAR Shell
[MAX_PATH
];
63 WCHAR CommandLine
[MAX_PATH
];
71 TRACE("RunSetup() called\n");
74 dwError
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
79 if (dwError
!= ERROR_SUCCESS
)
83 dwSize
= (sizeof(Shell
) / sizeof(Shell
[0])) - 1;
84 dwError
= RegQueryValueExW(hKey
,
91 if (dwError
!= ERROR_SUCCESS
)
95 Shell
[dwSize
/ sizeof(WCHAR
)] = UNICODE_NULL
;
97 /* Expand string (if applicable) */
98 if (dwType
== REG_EXPAND_SZ
)
99 ExpandEnvironmentStringsW(Shell
, CommandLine
, MAX_PATH
);
100 else if (dwType
== REG_SZ
)
101 wcscpy(CommandLine
, Shell
);
105 TRACE("Should run '%s' now\n", debugstr_w(CommandLine
));
108 StartupInfo
.cb
= sizeof(StartupInfo
);
109 StartupInfo
.lpReserved
= NULL
;
110 StartupInfo
.lpDesktop
= NULL
;
111 StartupInfo
.lpTitle
= NULL
;
112 StartupInfo
.dwFlags
= 0;
113 StartupInfo
.cbReserved2
= 0;
114 StartupInfo
.lpReserved2
= 0;
116 Result
= CreateProcessW(NULL
,
125 &ProcessInformation
);
128 TRACE("Failed to run setup process\n");
132 /* Wait for process termination */
133 WaitForSingleObject(ProcessInformation
.hProcess
, INFINITE
);
135 GetExitCodeProcess(ProcessInformation
.hProcess
, &dwExitCode
);
138 CloseHandle(ProcessInformation
.hThread
);
139 CloseHandle(ProcessInformation
.hProcess
);
141 TRACE ("RunSetup() done\n");
152 hThread
= CreateThread(NULL
,
159 return hThread
!= NULL
;