[FORMATTING] Fix indentation

svn path=/trunk/; revision=31366
This commit is contained in:
Hervé Poussineau 2007-12-21 10:06:46 +00:00
parent e1c174281d
commit 0099292d68

View file

@ -19,135 +19,137 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
DWORD DWORD
GetSetupType(VOID) GetSetupType(VOID)
{ {
DWORD dwError; DWORD dwError;
HKEY hKey; HKEY hKey;
DWORD dwType; DWORD dwType;
DWORD dwSize; DWORD dwSize;
DWORD dwSetupType; DWORD dwSetupType;
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TRACE("GetSetupType()\n");
L"SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
0,
KEY_QUERY_VALUE,
&hKey);
if (dwError != ERROR_SUCCESS)
{
return 0;
}
dwSize = sizeof(DWORD); /* Open key */
dwError = RegQueryValueExW (hKey, dwError = RegOpenKeyExW(
L"SetupType", //TEXT("SetupType"), HKEY_LOCAL_MACHINE,
NULL, L"SYSTEM\\Setup",
&dwType, 0,
(LPBYTE)&dwSetupType, KEY_QUERY_VALUE,
&dwSize); &hKey);
RegCloseKey (hKey); if (dwError != ERROR_SUCCESS)
if (dwError != ERROR_SUCCESS || dwType != REG_DWORD) return 0;
{
return 0;
}
return dwSetupType; /* Read key */
dwSize = sizeof(DWORD);
dwError = RegQueryValueExW(
hKey,
L"SetupType",
NULL,
&dwType,
(LPBYTE)&dwSetupType,
&dwSize);
/* Close key, and check if returned values are correct */
RegCloseKey(hKey);
if (dwError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD))
return 0;
TRACE("GetSetupType() returns %lu\n", dwSetupType);
return dwSetupType;
} }
static DWORD WINAPI static DWORD WINAPI
RunSetupThreadProc (IN LPVOID lpParameter) RunSetupThreadProc(
IN LPVOID lpParameter)
{ {
PROCESS_INFORMATION ProcessInformation; PROCESS_INFORMATION ProcessInformation;
STARTUPINFOW StartupInfo; STARTUPINFOW StartupInfo;
WCHAR Shell[MAX_PATH]; WCHAR Shell[MAX_PATH];
WCHAR CommandLine[MAX_PATH]; WCHAR CommandLine[MAX_PATH];
BOOL Result; BOOL Result;
DWORD dwError; DWORD dwError;
HKEY hKey; HKEY hKey;
DWORD dwType; DWORD dwType;
DWORD dwSize; DWORD dwSize;
DWORD dwExitCode; DWORD dwExitCode;
TRACE ("RunSetup() called\n"); TRACE("RunSetup() called\n");
dwError = RegOpenKeyExW (HKEY_LOCAL_MACHINE, /* Open key */
L"SYSTEM\\Setup", dwError = RegOpenKeyExW(
0, HKEY_LOCAL_MACHINE,
KEY_QUERY_VALUE, L"SYSTEM\\Setup",
&hKey); 0,
if (dwError != ERROR_SUCCESS) KEY_QUERY_VALUE,
{ &hKey);
return FALSE; if (dwError != ERROR_SUCCESS)
} return FALSE;
dwSize = MAX_PATH; /* Read key */
dwError = RegQueryValueExW (hKey, dwSize = (sizeof(Shell) / sizeof(Shell[0])) - 1;
L"CmdLine", dwError = RegQueryValueExW(
NULL, hKey,
&dwType, L"CmdLine",
(LPBYTE)Shell, NULL,
&dwSize); &dwType,
RegCloseKey (hKey); (LPBYTE)Shell,
if (dwError != ERROR_SUCCESS) &dwSize);
{ RegCloseKey(hKey);
return FALSE; if (dwError != ERROR_SUCCESS)
} return FALSE;
if (dwType == REG_EXPAND_SZ) /* Finish string */
{ Shell[dwSize / sizeof(WCHAR)] = UNICODE_NULL;
ExpandEnvironmentStringsW(Shell, CommandLine, MAX_PATH);
}
else if (dwType == REG_SZ)
{
wcscpy(CommandLine, Shell);
}
else
{
return FALSE;
}
TRACE ("Should run '%S' now.\n", CommandLine); /* Expand string (if applicable) */
if (dwType == REG_EXPAND_SZ)
ExpandEnvironmentStringsW(Shell, CommandLine, MAX_PATH);
else if (dwType == REG_SZ)
wcscpy(CommandLine, Shell);
else
return FALSE;
StartupInfo.cb = sizeof(StartupInfo); TRACE("Should run '%s' now\n", debugstr_w(CommandLine));
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
TRACE ("Creating new setup process\n"); /* Start process */
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
Result = CreateProcessW(
NULL,
CommandLine,
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (!Result)
{
TRACE("Failed to run setup process\n");
return FALSE;
}
Result = CreateProcessW (NULL, /* Wait for process termination */
CommandLine, WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (!Result)
{
TRACE ("Failed to run setup process\n");
return FALSE;
}
/* Wait for process termination */ GetExitCodeProcess(ProcessInformation.hProcess, &dwExitCode);
WaitForSingleObject (ProcessInformation.hProcess, INFINITE);
GetExitCodeProcess (ProcessInformation.hProcess, &dwExitCode); /* Close handles */
CloseHandle(ProcessInformation.hThread);
CloseHandle(ProcessInformation.hProcess);
CloseHandle (ProcessInformation.hThread); TRACE ("RunSetup() done\n");
CloseHandle (ProcessInformation.hProcess);
TRACE ("RunSetup() done.\n"); return TRUE;
return TRUE;
} }
BOOL BOOL
RunSetup (VOID) RunSetup(VOID)
{ {
HANDLE hThread; HANDLE hThread;