[SYSSETUP] Code formatting.

svn path=/branches/setup_improvements/; revision=75522
This commit is contained in:
Hermès Bélusca-Maïto 2017-08-10 18:56:15 +00:00
parent 8d78897384
commit e9893906a7
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -296,7 +296,7 @@ AckPageDlgProc(HWND hwndDlg,
Projects = NULL; Projects = NULL;
ProjectsSize = 256; ProjectsSize = 256;
do while (TRUE)
{ {
Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR)); Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR));
if (NULL == Projects) if (NULL == Projects)
@ -316,9 +316,9 @@ AckPageDlgProc(HWND hwndDlg,
HeapFree(GetProcessHeap(), 0, Projects); HeapFree(GetProcessHeap(), 0, Projects);
ProjectsSize *= 2; ProjectsSize *= 2;
} }
while (1);
CurrentProject = Projects; CurrentProject = Projects;
while (L'\0' != *CurrentProject) while (*CurrentProject != L'\0')
{ {
End = wcschr(CurrentProject, L'\n'); End = wcschr(CurrentProject, L'\n');
if (NULL != End) if (NULL != End)
@ -388,8 +388,6 @@ WriteOwnerSettings(WCHAR * OwnerName,
HKEY hKey; HKEY hKey;
LONG res; LONG res;
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\Windows NT\\CurrentVersion", L"Software\\Microsoft\\Windows NT\\CurrentVersion",
0, 0,
@ -867,50 +865,49 @@ static BOOL
RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters) RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
{ {
MSG msg; MSG msg;
if (pwszCPLParameters) STARTUPINFOW StartupInfo;
{ PROCESS_INFORMATION ProcessInformation;
STARTUPINFOW StartupInfo; WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
PROCESS_INFORMATION ProcessInformation;
WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
ZeroMemory(&StartupInfo, sizeof(StartupInfo)); if (!pwszCPLParameters)
StartupInfo.cb = sizeof(StartupInfo);
ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
wcscat(CmdLine, pwszCPLParameters);
if (!CreateProcessW(NULL,
CmdLine,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&StartupInfo,
&ProcessInformation))
{
MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
return FALSE;
}
while((MsgWaitForMultipleObjects(1, &ProcessInformation.hProcess, FALSE, INFINITE, QS_ALLINPUT|QS_ALLPOSTMESSAGE )) != WAIT_OBJECT_0)
{
while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
CloseHandle(ProcessInformation.hThread);
CloseHandle(ProcessInformation.hProcess);
return TRUE;
}
else
{ {
MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR); MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
return FALSE; return FALSE;
} }
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
wcscat(CmdLine, pwszCPLParameters);
if (!CreateProcessW(NULL,
CmdLine,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&StartupInfo,
&ProcessInformation))
{
MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
return FALSE;
}
while ((MsgWaitForMultipleObjects(1, &ProcessInformation.hProcess, FALSE, INFINITE, QS_ALLINPUT|QS_ALLPOSTMESSAGE )) != WAIT_OBJECT_0)
{
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
CloseHandle(ProcessInformation.hThread);
CloseHandle(ProcessInformation.hProcess);
return TRUE;
} }
static VOID static VOID
@ -1501,7 +1498,7 @@ WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
SetupData); SetupData);
SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT)); SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT));
if(!SetSystemLocalTime(hwndDlg, SetupData)) if (!SetSystemLocalTime(hwndDlg, SetupData))
{ {
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
{ {
@ -1894,15 +1891,15 @@ StartComponentRegistration(HWND hwndDlg, PULONG MaxProgress)
PREGISTRATIONDATA RegistrationData; PREGISTRATIONDATA RegistrationData;
DllCount = -1; DllCount = -1;
if (! SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2", if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
L"RegisterDlls", &Context)) L"RegisterDlls", &Context))
{ {
DPRINT1("No RegistrationPhase2 section found\n"); DPRINT1("No RegistrationPhase2 section found\n");
return FALSE; return FALSE;
} }
if (! SetupGetStringFieldW(&Context, 1, SectionName, if (!SetupGetStringFieldW(&Context, 1, SectionName,
sizeof(SectionName) / sizeof(SectionName[0]), sizeof(SectionName) / sizeof(SectionName[0]),
NULL)) NULL))
{ {
DPRINT1("Unable to retrieve section name\n"); DPRINT1("Unable to retrieve section name\n");
return FALSE; return FALSE;
@ -2196,7 +2193,7 @@ ProcessUnattendInf(
L"UnattendSetupEnabled", L"UnattendSetupEnabled",
&InfContext)) &InfContext))
{ {
DPRINT1("Error: Cant find UnattendSetupEnabled Key! %d\n", GetLastError()); DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
return; return;
} }
@ -2288,13 +2285,12 @@ ProcessUnattendInf(
else if (!wcscmp(szName, L"DisableGeckoInst")) else if (!wcscmp(szName, L"DisableGeckoInst"))
{ {
if(!wcscmp(szValue, L"yes")) if(!wcscmp(szValue, L"yes"))
pSetupData->DisableGeckoInst = 1; pSetupData->DisableGeckoInst = TRUE;
else else
pSetupData->DisableGeckoInst = 0; pSetupData->DisableGeckoInst = FALSE;
} }
} } while (SetupFindNextLine(&InfContext, &InfContext));
while (SetupFindNextLine(&InfContext, &InfContext));
if (SetupFindFirstLineW(pSetupData->hUnattendedInf, if (SetupFindFirstLineW(pSetupData->hUnattendedInf,
L"Display", L"Display",
@ -2353,8 +2349,7 @@ ProcessUnattendInf(
dm.dmFields |= DM_DISPLAYFREQUENCY; dm.dmFields |= DM_DISPLAYFREQUENCY;
dm.dmDisplayFrequency = iValue; dm.dmDisplayFrequency = iValue;
} }
} } while (SetupFindNextLine(&InfContext, &InfContext));
while (SetupFindNextLine(&InfContext, &InfContext));
ChangeDisplaySettingsW(&dm, CDS_UPDATEREGISTRY); ChangeDisplaySettingsW(&dm, CDS_UPDATEREGISTRY);
} }
@ -2375,15 +2370,14 @@ ProcessUnattendInf(
NULL, NULL,
&InfContext)) &InfContext))
{ {
int i = 0; int i = 0;
do do
{ {
if(SetupGetStringFieldW(&InfContext, if (SetupGetStringFieldW(&InfContext,
0, 0,
szValue, szValue,
sizeof(szValue) / sizeof(WCHAR), sizeof(szValue) / sizeof(WCHAR),
NULL)) NULL))
{ {
WCHAR szPath[MAX_PATH]; WCHAR szPath[MAX_PATH];
swprintf(szName, L"%d", i); swprintf(szName, L"%d", i);
@ -2403,7 +2397,7 @@ ProcessUnattendInf(
} }
} }
} }
} while(SetupFindNextLine(&InfContext, &InfContext)); } while (SetupFindNextLine(&InfContext, &InfContext));
} }
RegCloseKey(hKey); RegCloseKey(hKey);
@ -2578,7 +2572,6 @@ InstallWizard(VOID)
psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE); psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
phpage[nPages++] = CreatePropertySheetPage(&psp); phpage[nPages++] = CreatePropertySheetPage(&psp);
/* Create the Owner page */ /* Create the Owner page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE); psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
@ -2595,7 +2588,6 @@ InstallWizard(VOID)
psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE); psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
phpage[nPages++] = CreatePropertySheetPage(&psp); phpage[nPages++] = CreatePropertySheetPage(&psp);
/* Create the DateTime page */ /* Create the DateTime page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE); psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
@ -2629,7 +2621,6 @@ InstallWizard(VOID)
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE); psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
phpage[nPages++] = CreatePropertySheetPage(&psp); phpage[nPages++] = CreatePropertySheetPage(&psp);
/* Create the Finish page */ /* Create the Finish page */
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
psp.pfnDlgProc = FinishDlgProc; psp.pfnDlgProc = FinishDlgProc;
@ -2651,7 +2642,7 @@ InstallWizard(VOID)
/* Create title font */ /* Create title font */
pSetupData->hTitleFont = CreateTitleFont(); pSetupData->hTitleFont = CreateTitleFont();
pSetupData->hBoldFont = CreateBoldFont(); pSetupData->hBoldFont = CreateBoldFont();
/* Display the wizard */ /* Display the wizard */
hWnd = (HWND)PropertySheet(&psh); hWnd = (HWND)PropertySheet(&psh);