/* FUNCTIONS ****************************************************************/
+
+extern void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow);
+
BOOL
GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax);
PROCESS_INFORMATION ProcInfo;
MSG msg;
DWORD ret;
- STARTUPINFOW si = {0};
+ STARTUPINFOW si;
WCHAR InstallName[] = L"vmwinst.exe";
- si.cb = sizeof(STARTUPINFO);
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
if(CreateProcessW(NULL, InstallName, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
NULL, NULL, &si, &ProcInfo))
if (HIWORD(wParam) == BN_CLICKED && IDC_VIEWGPL == LOWORD(wParam))
{
DialogBox(hDllInstance, MAKEINTRESOURCE(IDD_GPL), NULL, GplDlgProc);
+ SetForegroundWindow(GetParent(hwndDlg));
}
break;
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
if (SetupData.UnattendSetup)
{
- SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_OWNERPAGE);
+ SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_LOCALEPAGE);
return TRUE;
}
break;
{
WCHAR Title[64];
WCHAR ErrorComputerName[256];
+
if (!SetComputerNameW(ComputerName))
{
- if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
+ if (hwndDlg != NULL)
{
- wcscpy(Title, L"ReactOS Setup");
- }
- if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
- sizeof(ErrorComputerName) / sizeof(ErrorComputerName[0])))
- {
- wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
+ if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0])))
+ {
+ wcscpy(Title, L"ReactOS Setup");
+ }
+ if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
+ sizeof(ErrorComputerName) / sizeof(ErrorComputerName[0])))
+ {
+ wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
+ }
+ MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
}
- MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
return FALSE;
}
SendMessage(GetDlgItem(hwndDlg, IDC_COMPUTERNAME), WM_SETTEXT, 0, (LPARAM)SetupData.ComputerName);
SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD1), WM_SETTEXT, 0, (LPARAM)SetupData.AdminPassword);
SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD2), WM_SETTEXT, 0, (LPARAM)SetupData.AdminPassword);
+ WriteComputerSettings(SetupData.ComputerName, NULL);
+ SetAdministratorPassword(SetupData.AdminPassword);
}
}
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
if (SetupData.UnattendSetup && WriteComputerSettings(SetupData.ComputerName, hwndDlg))
{
- SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_LOCALEPAGE);
+ SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_DATETIMEPAGE);
return TRUE;
}
break;
Password++;
}
- /* FIXME: Set admin password */
+ /* Set admin password */
+ SetAdministratorPassword(Password1);
break;
case PSN_WIZBACK:
static BOOL
-RunControlPanelApplet(HWND hwnd, WCHAR *lpCommandLine)
+RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
{
- STARTUPINFOW StartupInfo;
- PROCESS_INFORMATION ProcessInformation;
+ if (pwszCPLParameters)
+ {
+ STARTUPINFOW StartupInfo;
+ PROCESS_INFORMATION ProcessInformation;
+ WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
- ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
- StartupInfo.cb = sizeof(STARTUPINFOW);
+ ZeroMemory(&StartupInfo, sizeof(StartupInfo));
+ StartupInfo.cb = sizeof(StartupInfo);
- if (!CreateProcessW(NULL,
- lpCommandLine,
- NULL,
- NULL,
- FALSE,
- 0,
- NULL,
- NULL,
- &StartupInfo,
- &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;
+ }
+
+ WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
+ CloseHandle(ProcessInformation.hThread);
+ CloseHandle(ProcessInformation.hProcess);
+ return TRUE;
+ }
+ else
{
- MessageBoxW(hwnd, L"Error: failed to launch rundll32", NULL, MB_ICONERROR);
+ MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
return FALSE;
}
-
- WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
- CloseHandle(ProcessInformation.hThread);
- CloseHandle(ProcessInformation.hProcess);
- return TRUE;
}
static VOID
switch (LOWORD(wParam))
{
case IDC_CUSTOMLOCALE:
- RunControlPanelApplet(hwndDlg, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5");
+ RunControlPanelApplet(hwndDlg, L"intl.cpl,,5");
/* FIXME: Update input locale name */
break;
case IDC_CUSTOMLAYOUT:
- RunControlPanelApplet(hwndDlg, L"rundll32.exe shell32.dll,Control_RunDLL input.dll,@1");
+ RunControlPanelApplet(hwndDlg, L"input.dll,@1");
break;
}
}
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
if (SetupData->UnattendSetup)
{
- WCHAR wszPath[MAX_PATH], wszBuf[1024];
+ WCHAR wszPath[MAX_PATH];
if (GetRosInstallCD(wszPath, _countof(wszPath)))
- swprintf(wszBuf, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"%sreactos\\unattend.inf\"", wszPath);
+ {
+ WCHAR wszParams[1024];
+ swprintf(wszParams, L"intl.cpl,,/f:\"%sreactos\\unattend.inf\"", wszPath);
+ RunControlPanelApplet(hwndDlg, wszParams);
+ }
else
- wcscpy(wszBuf, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"unattend.inf\"");
+ {
+ RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"unattend.inf\"");
+ }
- RunControlPanelApplet(hwndDlg, wszBuf);
- SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_DATETIMEPAGE);
+ SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_OWNERPAGE);
return TRUE;
}
break;
static BOOL
SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
{
- HANDLE hToken;
- DWORD PrevSize;
- TOKEN_PRIVILEGES priv, previouspriv;
BOOL Ret = FALSE;
/*
- * enable the SeSystemtimePrivilege privilege
+ * Call SetLocalTime twice to ensure correct results
*/
-
- if(OpenProcessToken(GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
- &hToken))
- {
- priv.PrivilegeCount = 1;
- priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
- if(LookupPrivilegeValue(NULL,
- SE_SYSTEMTIME_NAME,
- &priv.Privileges[0].Luid))
- {
- if(AdjustTokenPrivileges(hToken,
- FALSE,
- &priv,
- sizeof(previouspriv),
- &previouspriv,
- &PrevSize) &&
- GetLastError() == ERROR_SUCCESS)
- {
- /*
- * We successfully enabled it, we're permitted to change the system time
- * Call SetLocalTime twice to ensure correct results
- */
- Ret = SetLocalTime(&SetupData->SystemTime) &&
- SetLocalTime(&SetupData->SystemTime);
-
- /*
- * for the sake of security, restore the previous status again
- */
- if(previouspriv.PrivilegeCount > 0)
- {
- AdjustTokenPrivileges(hToken,
- FALSE,
- &previouspriv,
- 0,
- NULL,
- 0);
- }
- }
- }
- CloseHandle(hToken);
- }
+ Ret = SetLocalTime(&SetupData->SystemTime) &&
+ SetLocalTime(&SetupData->SystemTime);
return Ret;
}
SetupTermDefaultQueueCallback(RegistrationData->DefaultContext);
HeapFree(GetProcessHeap(), 0, RegistrationData);
+ RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
+
// FIXME: Move this call to a separate cleanup page!
RtlCreateBootStatusDataFile();
}
}
-
static INT_PTR CALLBACK
FinishDlgProc(HWND hwndDlg,
UINT uMsg,
{
case WM_INITDIALOG:
{
- PSETUPDATA SetupData;
-
/* Get pointer to the global setup data */
- SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
+ PSETUPDATA SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
+
+ /* Run the Wine Gecko prompt */
+ Control_RunDLLW(GetDesktopWindow(), 0, L"appwiz.cpl install_gecko", SW_SHOW);
/* Set title font */
SendDlgItemMessage(hwndDlg,
psp.pfnDlgProc = AckPageDlgProc;
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
+ /* Create the Locale page */
+ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
+ psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
+ psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
+ psp.pfnDlgProc = LocalePageDlgProc;
+ psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
+ ahpsp[nPages++] = CreatePropertySheetPage(&psp);
+
+
/* Create the Owner page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
- /* Create the Locale page */
- psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
- psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
- psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
- psp.pfnDlgProc = LocalePageDlgProc;
- psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
- ahpsp[nPages++] = CreatePropertySheetPage(&psp);
-
-
/* Create the DateTime page */
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);