2004-04-16 13:37:18 +00:00
|
|
|
/*
|
2007-05-31 20:52:44 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: System setup
|
|
|
|
* FILE: dll/win32/syssetup/wizard.c
|
|
|
|
* PURPOSE: GUI controls
|
|
|
|
* PROGRAMMERS: Eric Kohl
|
|
|
|
* Pierre Schweitzer <heis_spiter@hotmail.com>
|
2015-12-07 23:21:49 +00:00
|
|
|
* Ismael Ferreras Morezuelas <swyterzone+ros@gmail.com>
|
2020-05-19 06:41:26 +00:00
|
|
|
* Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
2004-04-16 13:37:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2011-07-28 15:57:04 +00:00
|
|
|
#include "precomp.h"
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2014-01-25 19:51:44 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <winnls.h>
|
|
|
|
#include <windowsx.h>
|
2017-08-06 09:18:19 +00:00
|
|
|
#include <wincon.h>
|
|
|
|
#include <shlobj.h>
|
2020-04-19 15:48:25 +00:00
|
|
|
#include <tzlib.h>
|
2020-05-19 06:41:26 +00:00
|
|
|
#include <strsafe.h>
|
2020-04-19 15:48:25 +00:00
|
|
|
|
2005-11-27 22:27:35 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
#define PM_REGISTRATION_NOTIFY (WM_APP + 1)
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Private Message used to communicate progress from the background
|
|
|
|
registration thread to the main thread.
|
|
|
|
wParam = 0 Registration in progress
|
|
|
|
= 1 Registration completed
|
|
|
|
lParam = Pointer to a REGISTRATIONNOTIFY structure */
|
2005-11-27 22:27:35 +00:00
|
|
|
|
|
|
|
typedef struct _REGISTRATIONNOTIFY
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
ULONG Progress;
|
|
|
|
UINT ActivityID;
|
|
|
|
LPCWSTR CurrentItem;
|
|
|
|
LPCWSTR ErrorMessage;
|
2005-11-27 22:27:35 +00:00
|
|
|
} REGISTRATIONNOTIFY, *PREGISTRATIONNOTIFY;
|
|
|
|
|
|
|
|
typedef struct _REGISTRATIONDATA
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HWND hwndDlg;
|
|
|
|
ULONG DllCount;
|
|
|
|
ULONG Registered;
|
|
|
|
PVOID DefaultContext;
|
2005-11-27 22:27:35 +00:00
|
|
|
} REGISTRATIONDATA, *PREGISTRATIONDATA;
|
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
typedef struct _TIMEZONE_ENTRY
|
|
|
|
{
|
|
|
|
struct _TIMEZONE_ENTRY *Prev;
|
|
|
|
struct _TIMEZONE_ENTRY *Next;
|
|
|
|
WCHAR Description[128]; /* 'Display' */
|
|
|
|
WCHAR StandardName[32]; /* 'Std' */
|
|
|
|
WCHAR DaylightName[32]; /* 'Dlt' */
|
|
|
|
REG_TZI_FORMAT TimezoneInfo; /* 'TZI' */
|
|
|
|
ULONG Index;
|
|
|
|
} TIMEZONE_ENTRY, *PTIMEZONE_ENTRY;
|
|
|
|
|
2004-04-16 13:37:18 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
2013-10-06 16:51:45 +00:00
|
|
|
|
|
|
|
extern void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow);
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
|
2004-05-22 12:04:10 +00:00
|
|
|
static VOID
|
|
|
|
CenterWindow(HWND hWnd)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HWND hWndParent;
|
|
|
|
RECT rcParent;
|
|
|
|
RECT rcWindow;
|
|
|
|
|
|
|
|
hWndParent = GetParent(hWnd);
|
|
|
|
if (hWndParent == NULL)
|
|
|
|
hWndParent = GetDesktopWindow();
|
|
|
|
|
|
|
|
GetWindowRect(hWndParent, &rcParent);
|
|
|
|
GetWindowRect(hWnd, &rcWindow);
|
|
|
|
|
|
|
|
SetWindowPos(hWnd,
|
|
|
|
HWND_TOP,
|
|
|
|
((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
|
|
|
|
((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
SWP_NOSIZE);
|
2004-05-22 12:04:10 +00:00
|
|
|
}
|
|
|
|
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2004-09-24 18:52:29 +00:00
|
|
|
static HFONT
|
|
|
|
CreateTitleFont(VOID)
|
|
|
|
{
|
2016-05-17 22:38:58 +00:00
|
|
|
LOGFONTW LogFont = {0};
|
2011-11-15 08:44:37 +00:00
|
|
|
HDC hdc;
|
|
|
|
HFONT hFont;
|
|
|
|
|
2019-08-06 02:09:56 +00:00
|
|
|
LogFont.lfWeight = FW_BOLD;
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
|
|
|
|
|
|
|
|
hdc = GetDC(NULL);
|
2016-05-17 22:38:58 +00:00
|
|
|
LogFont.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
hFont = CreateFontIndirectW(&LogFont);
|
2016-05-17 22:38:58 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
ReleaseDC(NULL, hdc);
|
|
|
|
|
|
|
|
return hFont;
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-17 22:38:58 +00:00
|
|
|
static HFONT
|
|
|
|
CreateBoldFont(VOID)
|
|
|
|
{
|
|
|
|
LOGFONTW tmpFont = {0};
|
|
|
|
HFONT hBoldFont;
|
|
|
|
HDC hDc;
|
|
|
|
|
|
|
|
/* Grabs the Drawing Context */
|
|
|
|
hDc = GetDC(NULL);
|
|
|
|
|
|
|
|
tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDc, LOGPIXELSY), 72);
|
2019-08-05 00:44:25 +00:00
|
|
|
tmpFont.lfWeight = FW_BOLD;
|
2016-05-17 22:38:58 +00:00
|
|
|
wcscpy(tmpFont.lfFaceName, L"MS Shell Dlg");
|
|
|
|
|
|
|
|
hBoldFont = CreateFontIndirectW(&tmpFont);
|
|
|
|
|
|
|
|
ReleaseDC(NULL, hDc);
|
|
|
|
|
|
|
|
return hBoldFont;
|
|
|
|
}
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-11-22 11:01:45 +00:00
|
|
|
GplDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HRSRC GplTextResource;
|
|
|
|
HGLOBAL GplTextMem;
|
|
|
|
PVOID GplTextLocked;
|
|
|
|
PCHAR GplText;
|
|
|
|
DWORD Size;
|
2005-05-09 01:46:46 +00:00
|
|
|
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
GplTextResource = FindResourceW(hDllInstance, MAKEINTRESOURCE(IDR_GPL), L"RT_TEXT");
|
|
|
|
if (NULL == GplTextResource)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Size = SizeofResource(hDllInstance, GplTextResource);
|
|
|
|
if (0 == Size)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GplText = HeapAlloc(GetProcessHeap(), 0, Size + 1);
|
|
|
|
if (NULL == GplText)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GplTextMem = LoadResource(hDllInstance, GplTextResource);
|
|
|
|
if (NULL == GplTextMem)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, GplText);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GplTextLocked = LockResource(GplTextMem);
|
|
|
|
if (NULL == GplTextLocked)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, GplText);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
memcpy(GplText, GplTextLocked, Size);
|
|
|
|
GplText[Size] = '\0';
|
|
|
|
SendMessageA(GetDlgItem(hwndDlg, IDC_GPL_TEXT), WM_SETTEXT, 0, (LPARAM) GplText);
|
2004-11-22 11:01:45 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, GplText);
|
2011-11-15 08:44:37 +00:00
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDOK));
|
|
|
|
return FALSE;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_CLOSE:
|
|
|
|
EndDialog(hwndDlg, IDCANCEL);
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED && IDOK == LOWORD(wParam))
|
|
|
|
{
|
|
|
|
EndDialog(hwndDlg, IDOK);
|
|
|
|
}
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-04-16 13:37:18 +00:00
|
|
|
WelcomeDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
PSETUPDATA pSetupData;
|
|
|
|
|
|
|
|
pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HWND hwndControl;
|
|
|
|
DWORD dwStyle;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Get pointer to the global setup data */
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
hwndControl = GetParent(hwndDlg);
|
2004-05-22 12:04:10 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Center the wizard window */
|
|
|
|
CenterWindow (hwndControl);
|
2004-05-22 12:04:10 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Hide the system menu */
|
|
|
|
dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
|
|
|
|
SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Hide and disable the 'Cancel' button */
|
|
|
|
hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
|
|
|
|
ShowWindow (hwndControl, SW_HIDE);
|
|
|
|
EnableWindow (hwndControl, FALSE);
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Set title font */
|
|
|
|
SendDlgItemMessage(hwndDlg,
|
|
|
|
IDC_WELCOMETITLE,
|
|
|
|
WM_SETFONT,
|
2015-12-08 15:57:47 +00:00
|
|
|
(WPARAM)pSetupData->hTitleFont,
|
2011-11-15 08:44:37 +00:00
|
|
|
(LPARAM)TRUE);
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
2015-12-31 22:17:45 +00:00
|
|
|
LogItem(L"BEGIN", L"WelcomePage");
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Enable the Next button */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
|
2015-12-08 15:57:47 +00:00
|
|
|
if (pSetupData->UnattendSetup)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_ACKPAGE);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2015-12-31 22:17:45 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
LogItem(L"END", L"WelcomePage");
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->UnattendSetup = FALSE;
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
2004-05-22 12:04:10 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-11-22 11:01:45 +00:00
|
|
|
AckPageDlgProc(HWND hwndDlg,
|
2011-11-15 08:44:37 +00:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LPNMHDR lpnm;
|
|
|
|
PWCHAR Projects;
|
|
|
|
PWCHAR End, CurrentProject;
|
|
|
|
INT ProjectsSize, ProjectsCount;
|
2015-12-08 15:57:47 +00:00
|
|
|
PSETUPDATA pSetupData;
|
|
|
|
|
|
|
|
pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
Projects = NULL;
|
|
|
|
ProjectsSize = 256;
|
2017-08-10 18:56:15 +00:00
|
|
|
while (TRUE)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR));
|
|
|
|
if (NULL == Projects)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
ProjectsCount = LoadStringW(hDllInstance, IDS_ACKPROJECTS, Projects, ProjectsSize);
|
|
|
|
if (0 == ProjectsCount)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Projects);
|
|
|
|
return FALSE;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
if (ProjectsCount < ProjectsSize - 1)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Projects);
|
|
|
|
ProjectsSize *= 2;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
CurrentProject = Projects;
|
2017-08-10 18:56:15 +00:00
|
|
|
while (*CurrentProject != L'\0')
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
End = wcschr(CurrentProject, L'\n');
|
|
|
|
if (NULL != End)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
*End = L'\0';
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
(void)ListBox_AddString(GetDlgItem(hwndDlg, IDC_PROJECTS), CurrentProject);
|
|
|
|
if (NULL != End)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
CurrentProject = End + 1;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
CurrentProject += wcslen(CurrentProject);
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Projects);
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED && IDC_VIEWGPL == LOWORD(wParam))
|
|
|
|
{
|
|
|
|
DialogBox(hDllInstance, MAKEINTRESOURCE(IDD_GPL), NULL, GplDlgProc);
|
2013-01-01 12:12:19 +00:00
|
|
|
SetForegroundWindow(GetParent(hwndDlg));
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
lpnm = (LPNMHDR)lParam;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-11-22 11:01:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
2015-12-08 15:57:47 +00:00
|
|
|
if (pSetupData->UnattendSetup)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2020-02-10 02:10:42 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PRODUCT);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
pSetupData->UnattendSetup = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
static const WCHAR s_szProductOptions[] = L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions";
|
|
|
|
static const WCHAR s_szRosVersion[] = L"SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version";
|
|
|
|
static const WCHAR s_szControlWindows[] = L"SYSTEM\\CurrentControlSet\\Control\\Windows";
|
2020-05-09 12:54:52 +00:00
|
|
|
static const WCHAR s_szWinlogon[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon";
|
2020-05-19 06:41:26 +00:00
|
|
|
|
2020-05-21 16:52:50 +00:00
|
|
|
typedef struct _PRODUCT_OPTION_DATA
|
2020-05-19 06:41:26 +00:00
|
|
|
{
|
|
|
|
LPCWSTR ProductSuite;
|
|
|
|
LPCWSTR ProductType;
|
|
|
|
DWORD ReportAsWorkstation;
|
|
|
|
DWORD CSDVersion;
|
2020-05-09 12:54:52 +00:00
|
|
|
DWORD LogonType;
|
2020-05-21 16:52:50 +00:00
|
|
|
} PRODUCT_OPTION_DATA;
|
2020-05-19 06:41:26 +00:00
|
|
|
|
|
|
|
static const PRODUCT_OPTION_DATA s_ProductOptionData[] =
|
|
|
|
{
|
2020-05-09 12:54:52 +00:00
|
|
|
{ L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 },
|
|
|
|
{ L"\0", L"WinNT", 1, 0x300, 1 }
|
2020-05-19 06:41:26 +00:00
|
|
|
};
|
|
|
|
|
2020-02-10 02:10:42 +00:00
|
|
|
static BOOL
|
|
|
|
DoWriteProductOption(PRODUCT_OPTION nOption)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
|
|
|
LONG error;
|
2020-05-19 06:41:26 +00:00
|
|
|
LPCWSTR pszData;
|
|
|
|
DWORD dwValue, cbData;
|
|
|
|
const PRODUCT_OPTION_DATA *pData = &s_ProductOptionData[nOption];
|
|
|
|
ASSERT(0 <= nOption && nOption < _countof(s_ProductOptionData));
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* open ProductOptions key */
|
2020-02-10 02:10:42 +00:00
|
|
|
error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, s_szProductOptions, 0, KEY_WRITE, &hKey);
|
|
|
|
if (error)
|
|
|
|
{
|
2020-05-19 06:41:26 +00:00
|
|
|
DPRINT1("RegOpenKeyExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* write ProductSuite */
|
|
|
|
pszData = pData->ProductSuite;
|
|
|
|
cbData = (lstrlenW(pszData) + 2) * sizeof(WCHAR);
|
2020-05-21 16:52:50 +00:00
|
|
|
error = RegSetValueExW(hKey, L"ProductSuite", 0, REG_MULTI_SZ, (const BYTE *)pszData, cbData);
|
2020-05-19 06:41:26 +00:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* write ProductType */
|
|
|
|
pszData = pData->ProductType;
|
|
|
|
cbData = (lstrlenW(pszData) + 1) * sizeof(WCHAR);
|
2020-05-21 16:52:50 +00:00
|
|
|
error = RegSetValueExW(hKey, L"ProductType", 0, REG_SZ, (const BYTE *)pszData, cbData);
|
2020-05-19 06:41:26 +00:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueExW failed\n");
|
|
|
|
goto Error;
|
2020-02-10 02:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
2020-02-12 00:03:14 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* open ReactOS version key */
|
2020-02-12 00:03:14 +00:00
|
|
|
error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, s_szRosVersion, 0, KEY_WRITE, &hKey);
|
|
|
|
if (error)
|
2020-05-19 06:41:26 +00:00
|
|
|
{
|
|
|
|
DPRINT1("RegOpenKeyExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-12 00:03:14 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* write ReportAsWorkstation */
|
|
|
|
dwValue = pData->ReportAsWorkstation;
|
2020-02-12 00:03:14 +00:00
|
|
|
cbData = sizeof(dwValue);
|
2020-05-19 06:41:26 +00:00
|
|
|
error = RegSetValueExW(hKey, L"ReportAsWorkstation", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-12 00:03:14 +00:00
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* open Control Windows key */
|
|
|
|
error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, s_szControlWindows, 0, KEY_WRITE, &hKey);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegOpenKeyExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
/* write Control Windows CSDVersion */
|
|
|
|
dwValue = pData->CSDVersion;
|
|
|
|
cbData = sizeof(dwValue);
|
|
|
|
error = RegSetValueExW(hKey, L"CSDVersion", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-09 12:54:52 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
/* open Winlogon key */
|
|
|
|
error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, s_szWinlogon, 0, KEY_WRITE, &hKey);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegOpenKeyExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write LogonType */
|
|
|
|
dwValue = pData->LogonType;
|
|
|
|
cbData = sizeof(dwValue);
|
|
|
|
error = RegSetValueExW(hKey, L"LogonType", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueExW failed\n");
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
Error:
|
|
|
|
if (hKey)
|
|
|
|
RegCloseKey(hKey);
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
return error == ERROR_SUCCESS;
|
2020-02-10 02:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-05-19 06:41:26 +00:00
|
|
|
OnChooseOption(HWND hwndDlg, PRODUCT_OPTION nOption)
|
2020-02-10 02:10:42 +00:00
|
|
|
{
|
|
|
|
WCHAR szText[256];
|
2020-05-19 06:41:26 +00:00
|
|
|
ASSERT(0 <= nOption && nOption < _countof(s_ProductOptionData));
|
|
|
|
|
|
|
|
switch (nOption)
|
|
|
|
{
|
|
|
|
case PRODUCT_OPTION_SERVER:
|
|
|
|
LoadStringW(hDllInstance, IDS_PRODUCTSERVERINFO, szText, _countof(szText));
|
|
|
|
break;
|
2020-02-10 02:10:42 +00:00
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
case PRODUCT_OPTION_WORKSTATION:
|
|
|
|
LoadStringW(hDllInstance, IDS_PRODUCTWORKSTATIONINFO, szText, _countof(szText));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_PRODUCT_DESCRIPTION, szText);
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT_PTR CALLBACK
|
|
|
|
ProductPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
LPNMHDR lpnm;
|
|
|
|
PSETUPDATA pSetupData;
|
|
|
|
INT iItem;
|
2020-05-19 18:32:21 +00:00
|
|
|
WCHAR szText[64], szDefault[64];
|
2020-02-10 02:10:42 +00:00
|
|
|
HICON hIcon;
|
|
|
|
|
|
|
|
pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
|
|
|
pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
|
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
LoadStringW(hDllInstance, IDS_DEFAULT, szDefault, _countof(szDefault));
|
|
|
|
|
2020-02-10 02:10:42 +00:00
|
|
|
LoadStringW(hDllInstance, IDS_PRODUCTSERVERNAME, szText, _countof(szText));
|
2020-05-19 06:41:26 +00:00
|
|
|
if (PRODUCT_OPTION_DEFAULT == PRODUCT_OPTION_SERVER)
|
|
|
|
{
|
|
|
|
StringCchCatW(szText, _countof(szText), L" ");
|
|
|
|
StringCchCatW(szText, _countof(szText), szDefault);
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_OPTIONS, CB_ADDSTRING, 0, (LPARAM)szText);
|
|
|
|
|
|
|
|
LoadStringW(hDllInstance, IDS_PRODUCTWORKSTATIONNAME, szText, _countof(szText));
|
2020-05-19 06:41:26 +00:00
|
|
|
if (PRODUCT_OPTION_DEFAULT == PRODUCT_OPTION_WORKSTATION)
|
|
|
|
{
|
|
|
|
StringCchCatW(szText, _countof(szText), L" ");
|
|
|
|
StringCchCatW(szText, _countof(szText), szDefault);
|
|
|
|
}
|
2020-02-10 02:10:42 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_OPTIONS, CB_ADDSTRING, 0, (LPARAM)szText);
|
|
|
|
|
2020-05-19 06:41:26 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_OPTIONS, CB_SETCURSEL, PRODUCT_OPTION_DEFAULT, 0);
|
|
|
|
OnChooseOption(hwndDlg, PRODUCT_OPTION_DEFAULT);
|
2020-02-10 02:10:42 +00:00
|
|
|
|
|
|
|
hIcon = LoadIcon(NULL, IDI_WINLOGO);
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_ICON, STM_SETICON, (WPARAM)hIcon, 0);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
if (HIWORD(wParam) == CBN_SELCHANGE && IDC_PRODUCT_OPTIONS == LOWORD(wParam))
|
|
|
|
{
|
|
|
|
iItem = SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_OPTIONS, CB_GETCURSEL, 0, 0);
|
2020-05-19 06:41:26 +00:00
|
|
|
OnChooseOption(hwndDlg, (PRODUCT_OPTION)iItem);
|
2020-02-10 02:10:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
lpnm = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
switch (lpnm->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
|
|
|
if (pSetupData->UnattendSetup)
|
|
|
|
{
|
2020-05-19 06:41:26 +00:00
|
|
|
OnChooseOption(hwndDlg, pSetupData->ProductOption);
|
2020-02-10 02:10:42 +00:00
|
|
|
DoWriteProductOption(pSetupData->ProductOption);
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_LOCALEPAGE);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2020-02-10 02:10:42 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
iItem = SendDlgItemMessageW(hwndDlg, IDC_PRODUCT_OPTIONS, CB_GETCURSEL, 0, 0);
|
|
|
|
pSetupData->ProductOption = (PRODUCT_OPTION)iItem;
|
|
|
|
DoWriteProductOption(pSetupData->ProductOption);
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->UnattendSetup = FALSE;
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-22 11:01:45 +00:00
|
|
|
}
|
|
|
|
|
2006-08-07 13:31:11 +00:00
|
|
|
static
|
|
|
|
BOOL
|
2008-12-11 11:24:32 +00:00
|
|
|
WriteOwnerSettings(WCHAR * OwnerName,
|
|
|
|
WCHAR * OwnerOrganization)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HKEY hKey;
|
|
|
|
LONG res;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
0,
|
|
|
|
KEY_ALL_ACCESS,
|
|
|
|
&hKey);
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (res != ERROR_SUCCESS)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
res = RegSetValueExW(hKey,
|
|
|
|
L"RegisteredOwner",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)OwnerName,
|
|
|
|
(wcslen(OwnerName) + 1) * sizeof(WCHAR));
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (res != ERROR_SUCCESS)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
return FALSE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
res = RegSetValueExW(hKey,
|
|
|
|
L"RegisteredOrganization",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)OwnerOrganization,
|
|
|
|
(wcslen(OwnerOrganization) + 1) * sizeof(WCHAR));
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
return (res == ERROR_SUCCESS);
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2004-11-22 11:01:45 +00:00
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-04-16 13:37:18 +00:00
|
|
|
OwnerPageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
WCHAR OwnerName[51];
|
|
|
|
WCHAR OwnerOrganization[51];
|
|
|
|
WCHAR Title[64];
|
|
|
|
WCHAR ErrorName[256];
|
|
|
|
LPNMHDR lpnm;
|
2015-12-08 15:57:47 +00:00
|
|
|
PSETUPDATA pSetupData;
|
|
|
|
|
|
|
|
pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
|
|
|
|
|
2015-12-07 23:21:49 +00:00
|
|
|
/* set a localized ('Owner') placeholder string as default */
|
|
|
|
if (LoadStringW(hDllInstance, IDS_MACHINE_OWNER_NAME, OwnerName, _countof(OwnerName)))
|
|
|
|
{
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, WM_SETTEXT, 0, (LPARAM)OwnerName);
|
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, EM_LIMITTEXT, 50, 0);
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_OWNERORGANIZATION, EM_LIMITTEXT, 50, 0);
|
2004-06-17 21:23:50 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Set focus to owner name */
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_OWNERNAME));
|
2015-12-07 23:21:49 +00:00
|
|
|
|
|
|
|
/* Select the default text to quickly overwrite it by typing */
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, EM_SETSEL, 0, -1);
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
lpnm = (LPNMHDR)lParam;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
2015-12-08 15:57:47 +00:00
|
|
|
if (pSetupData->UnattendSetup)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_OWNERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->OwnerName);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_OWNERORGANIZATION), WM_SETTEXT, 0, (LPARAM)pSetupData->OwnerOrganization);
|
|
|
|
if (WriteOwnerSettings(pSetupData->OwnerName, pSetupData->OwnerOrganization))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_COMPUTERPAGE);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-04-17 17:11:51 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
OwnerName[0] = 0;
|
|
|
|
if (GetDlgItemTextW(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0)
|
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(Title, L"ReactOS Setup");
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, ARRAYSIZE(ErrorName)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(ErrorName, L"Setup cannot continue until you enter your name.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, ErrorName, Title, MB_ICONERROR | MB_OK);
|
|
|
|
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_OWNERNAME));
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
OwnerOrganization[0] = 0;
|
|
|
|
GetDlgItemTextW(hwndDlg, IDC_OWNERORGANIZATION, OwnerOrganization, 50);
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!WriteOwnerSettings(OwnerName, OwnerOrganization))
|
|
|
|
{
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_OWNERNAME));
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->UnattendSetup = FALSE;
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
2011-09-21 20:53:46 +00:00
|
|
|
|
2006-08-07 13:31:11 +00:00
|
|
|
static
|
|
|
|
BOOL
|
2008-12-11 11:24:32 +00:00
|
|
|
WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
WCHAR Title[64];
|
|
|
|
WCHAR ErrorComputerName[256];
|
2019-05-29 10:59:40 +00:00
|
|
|
LONG lError;
|
|
|
|
HKEY hKey = NULL;
|
2014-01-18 18:28:01 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!SetComputerNameW(ComputerName))
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2014-01-18 18:28:01 +00:00
|
|
|
if (hwndDlg != NULL)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title)))
|
2014-01-18 18:28:01 +00:00
|
|
|
{
|
|
|
|
wcscpy(Title, L"ReactOS Setup");
|
|
|
|
}
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(ErrorComputerName)))
|
2014-01-18 18:28:01 +00:00
|
|
|
{
|
|
|
|
wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
|
|
|
|
2020-01-19 12:33:15 +00:00
|
|
|
/* Set the physical DNS domain */
|
|
|
|
SetComputerNameExW(ComputerNamePhysicalDnsDomain, L"");
|
|
|
|
|
|
|
|
/* Set the physical DNS hostname */
|
2011-11-15 08:44:37 +00:00
|
|
|
SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2016-04-24 11:29:40 +00:00
|
|
|
/* Set the accounts domain name */
|
|
|
|
SetAccountsDomainSid(NULL, ComputerName);
|
2011-09-21 20:53:46 +00:00
|
|
|
|
2019-05-29 10:59:40 +00:00
|
|
|
/* Now we need to set the Hostname */
|
|
|
|
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
|
|
|
|
0,
|
|
|
|
KEY_SET_VALUE,
|
|
|
|
&hKey);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("RegOpenKeyExW for Tcpip\\Parameters failed (%08lX)\n", lError);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lError = RegSetValueEx(hKey,
|
|
|
|
L"Hostname",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)ComputerName,
|
|
|
|
(wcslen(ComputerName) + 1) * sizeof(WCHAR));
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueEx(\"Hostname\") failed (%08lX)\n", lError);
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2014-03-29 17:18:14 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
BOOL
|
|
|
|
WriteDefaultLogonData(LPWSTR Domain)
|
|
|
|
{
|
|
|
|
WCHAR szAdministratorName[256];
|
|
|
|
HKEY hKey = NULL;
|
|
|
|
LONG lError;
|
|
|
|
|
|
|
|
if (LoadStringW(hDllInstance,
|
|
|
|
IDS_ADMINISTRATOR_NAME,
|
|
|
|
szAdministratorName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szAdministratorName)) == 0)
|
2014-03-29 17:18:14 +00:00
|
|
|
{
|
|
|
|
wcscpy(szAdministratorName, L"Administrator");
|
|
|
|
}
|
|
|
|
|
|
|
|
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
|
|
|
|
0,
|
|
|
|
KEY_SET_VALUE,
|
|
|
|
&hKey);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
lError = RegSetValueEx(hKey,
|
2018-05-22 09:30:27 +00:00
|
|
|
L"DefaultDomainName",
|
2014-03-29 17:18:14 +00:00
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)Domain,
|
|
|
|
(wcslen(Domain)+ 1) * sizeof(WCHAR));
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
{
|
2018-05-22 09:30:27 +00:00
|
|
|
DPRINT1("RegSetValueEx(\"DefaultDomainName\") failed!\n");
|
2014-03-29 17:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lError = RegSetValueEx(hKey,
|
|
|
|
L"DefaultUserName",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)szAdministratorName,
|
|
|
|
(wcslen(szAdministratorName)+ 1) * sizeof(WCHAR));
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("RegSetValueEx(\"DefaultUserName\") failed!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-15 20:42:07 +00:00
|
|
|
/* lpBuffer will be filled with a 15-char string (plus the null terminator) */
|
|
|
|
static void
|
|
|
|
GenerateComputerName(LPWSTR lpBuffer)
|
|
|
|
{
|
|
|
|
static const WCHAR Chars[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
|
|
static const unsigned cChars = sizeof(Chars) / sizeof(WCHAR) - 1;
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
wcscpy(lpBuffer, L"REACTOS-");
|
|
|
|
|
|
|
|
srand(GetTickCount());
|
|
|
|
|
|
|
|
/* fill in 7 characters */
|
|
|
|
for (i = 8; i < 15; i++)
|
|
|
|
lpBuffer[i] = Chars[rand() % cChars];
|
|
|
|
|
|
|
|
lpBuffer[15] = UNICODE_NULL; /* NULL-terminate */
|
|
|
|
}
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-04-16 13:37:18 +00:00
|
|
|
ComputerPageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
2014-03-29 17:18:14 +00:00
|
|
|
WCHAR Password1[128];
|
|
|
|
WCHAR Password2[128];
|
2011-11-15 08:44:37 +00:00
|
|
|
PWCHAR Password;
|
|
|
|
WCHAR Title[64];
|
|
|
|
WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
|
|
|
|
LPNMHDR lpnm;
|
2015-12-08 15:57:47 +00:00
|
|
|
PSETUPDATA pSetupData;
|
|
|
|
|
|
|
|
pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2017-08-10 18:59:26 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title)))
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscpy(Title, L"ReactOS Setup");
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Generate a new pseudo-random computer name */
|
|
|
|
GenerateComputerName(ComputerName);
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Display current computer name */
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Set text limits */
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_COMPUTERNAME, EM_LIMITTEXT, MAX_COMPUTERNAME_LENGTH, 0);
|
2014-03-29 17:18:14 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_ADMINPASSWORD1, EM_LIMITTEXT, 127, 0);
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_ADMINPASSWORD2, EM_LIMITTEXT, 127, 0);
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Set focus to computer name */
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME));
|
2015-12-08 15:57:47 +00:00
|
|
|
if (pSetupData->UnattendSetup)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_COMPUTERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->ComputerName);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD1), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword);
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_ADMINPASSWORD2), WM_SETTEXT, 0, (LPARAM)pSetupData->AdminPassword);
|
|
|
|
WriteComputerSettings(pSetupData->ComputerName, NULL);
|
|
|
|
SetAdministratorPassword(pSetupData->AdminPassword);
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
|
|
|
|
2014-03-29 17:18:14 +00:00
|
|
|
/* Store the administrator account name as the default user name */
|
2015-12-08 15:57:47 +00:00
|
|
|
WriteDefaultLogonData(pSetupData->ComputerName);
|
2014-03-29 17:18:14 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
lpnm = (LPNMHDR)lParam;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
2015-12-08 15:57:47 +00:00
|
|
|
if (pSetupData->UnattendSetup && WriteComputerSettings(pSetupData->ComputerName, hwndDlg))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_THEMEPAGE);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
if (0 == GetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName, MAX_COMPUTERNAME_LENGTH + 1))
|
|
|
|
{
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_COMPUTERNAME, EmptyComputerName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(EmptyComputerName)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK);
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME));
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* No need to check computer name for invalid characters,
|
|
|
|
* SetComputerName() will do it for us */
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!WriteComputerSettings(ComputerName, hwndDlg))
|
|
|
|
{
|
|
|
|
SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME));
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2020-04-15 10:50:36 +00:00
|
|
|
#ifdef PASSWORDS_MANDATORY
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Check if admin passwords have been entered */
|
2014-03-29 17:18:14 +00:00
|
|
|
if ((GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128) == 0) ||
|
|
|
|
(GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128) == 0))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDEMPTY, EmptyPassword,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(EmptyPassword)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(EmptyPassword, L"You must enter a password !");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK);
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2007-06-04 08:23:45 +00:00
|
|
|
#else
|
2014-03-29 17:18:14 +00:00
|
|
|
GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128);
|
|
|
|
GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128);
|
2007-06-04 08:23:45 +00:00
|
|
|
#endif
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Check if passwords match */
|
|
|
|
if (wcscmp(Password1, Password2))
|
|
|
|
{
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDMATCH, NotMatchPassword,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(NotMatchPassword)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK);
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Check password for invalid characters */
|
|
|
|
Password = (PWCHAR)Password1;
|
|
|
|
while (*Password)
|
2007-05-31 20:52:44 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!isprint(*Password))
|
|
|
|
{
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDCHAR, WrongPassword,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(WrongPassword)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK);
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
Password++;
|
2007-05-31 20:52:44 +00:00
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2013-05-27 13:34:59 +00:00
|
|
|
/* Set admin password */
|
|
|
|
SetAdministratorPassword(Password1);
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->UnattendSetup = FALSE;
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-03 13:43:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-03 13:43:00 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-08-03 13:43:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 15:42:09 +00:00
|
|
|
static VOID
|
|
|
|
SetKeyboardLayoutName(HWND hwnd)
|
|
|
|
{
|
|
|
|
#if 0
|
2011-11-15 08:44:37 +00:00
|
|
|
TCHAR szLayoutPath[256];
|
|
|
|
TCHAR szLocaleName[32];
|
|
|
|
DWORD dwLocaleSize;
|
|
|
|
HKEY hKey;
|
|
|
|
|
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
|
|
_T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Locale"),
|
|
|
|
0,
|
|
|
|
KEY_ALL_ACCESS,
|
|
|
|
&hKey))
|
|
|
|
return;
|
|
|
|
|
|
|
|
dwValueSize = 16 * sizeof(TCHAR);
|
|
|
|
if (RegQueryValueEx(hKey,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
szLocaleName,
|
|
|
|
&dwLocaleSize))
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
return;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
_tcscpy(szLayoutPath,
|
|
|
|
_T("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"));
|
|
|
|
_tcscat(szLayoutPath,
|
|
|
|
szLocaleName);
|
|
|
|
|
|
|
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
|
|
szLayoutPath,
|
|
|
|
0,
|
|
|
|
KEY_ALL_ACCESS,
|
|
|
|
&hKey))
|
|
|
|
return;
|
|
|
|
|
|
|
|
dwValueSize = 32 * sizeof(TCHAR);
|
|
|
|
if (RegQueryValueEx(hKey,
|
|
|
|
_T("Layout Text"),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
szLocaleName,
|
|
|
|
&dwLocaleSize))
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
return;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegCloseKey(hKey);
|
2004-11-02 15:42:09 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-11-27 13:33:40 +00:00
|
|
|
|
2006-08-07 13:31:11 +00:00
|
|
|
static BOOL
|
2012-09-11 17:08:38 +00:00
|
|
|
RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2015-10-16 02:18:13 +00:00
|
|
|
MSG msg;
|
2017-08-10 18:56:15 +00:00
|
|
|
STARTUPINFOW StartupInfo;
|
|
|
|
PROCESS_INFORMATION ProcessInformation;
|
|
|
|
WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
|
|
|
|
|
|
|
|
if (!pwszCPLParameters)
|
2012-09-11 17:08:38 +00:00
|
|
|
{
|
2017-08-10 18:56:15 +00:00
|
|
|
MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-09-11 17:08:38 +00:00
|
|
|
|
2017-08-10 18:56:15 +00:00
|
|
|
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
|
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
|
|
ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
|
2012-09-11 17:08:38 +00:00
|
|
|
|
2017-08-10 18:56:15 +00:00
|
|
|
ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
|
|
|
|
wcscat(CmdLine, pwszCPLParameters);
|
2012-09-11 17:08:38 +00:00
|
|
|
|
2017-08-10 18:56:15 +00:00
|
|
|
if (!CreateProcessW(NULL,
|
|
|
|
CmdLine,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&StartupInfo,
|
|
|
|
&ProcessInformation))
|
2006-08-12 14:14:52 +00:00
|
|
|
{
|
2012-09-11 17:08:38 +00:00
|
|
|
MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2006-08-12 14:14:52 +00:00
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
|
|
|
|
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;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2008-01-07 17:36:02 +00:00
|
|
|
static VOID
|
|
|
|
WriteUserLocale(VOID)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HKEY hKey;
|
|
|
|
LCID lcid;
|
|
|
|
WCHAR Locale[12];
|
2008-01-07 17:36:02 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
lcid = GetSystemDefaultLCID();
|
2008-01-07 17:36:02 +00:00
|
|
|
|
2017-08-10 18:59:26 +00:00
|
|
|
if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, ARRAYSIZE(Locale)) != 0)
|
2008-01-07 20:07:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
|
|
|
|
0, NULL, REG_OPTION_NON_VOLATILE,
|
|
|
|
KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
RegSetValueExW(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (wcslen(Locale) + 1) * sizeof(WCHAR));
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
2008-01-07 17:36:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-08-03 13:43:00 +00:00
|
|
|
LocalePageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PSETUPDATA SetupData;
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Retrieve pointer to the global setup data */
|
2018-02-05 01:42:14 +00:00
|
|
|
SetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-08-03 13:43:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2004-08-03 13:43:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Save pointer to the global setup data */
|
|
|
|
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
2018-02-05 01:42:14 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)SetupData);
|
2011-11-15 08:44:37 +00:00
|
|
|
WriteUserLocale();
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SetKeyboardLayoutName(GetDlgItem(hwndDlg, IDC_LAYOUTTEXT));
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
{
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_CUSTOMLOCALE:
|
2012-09-11 17:08:38 +00:00
|
|
|
RunControlPanelApplet(hwndDlg, L"intl.cpl,,5");
|
2011-11-15 08:44:37 +00:00
|
|
|
/* FIXME: Update input locale name */
|
2012-01-15 13:24:26 +00:00
|
|
|
break;
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
case IDC_CUSTOMLAYOUT:
|
2012-09-11 17:08:38 +00:00
|
|
|
RunControlPanelApplet(hwndDlg, L"input.dll,@1");
|
2012-01-15 13:24:26 +00:00
|
|
|
break;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
|
|
|
if (SetupData->UnattendSetup)
|
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
// if (!*SetupData->SourcePath)
|
2012-09-11 17:08:38 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"$winnt$.inf\""); // Should be in System32
|
2012-09-11 17:08:38 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OWNERPAGE);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
break;
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
|
|
|
SetupData->UnattendSetup = FALSE;
|
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-05 11:48:45 +00:00
|
|
|
static PTIMEZONE_ENTRY
|
|
|
|
GetLargerTimeZoneEntry(PSETUPDATA SetupData, DWORD Index)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PTIMEZONE_ENTRY Entry;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
Entry = SetupData->TimeZoneListHead;
|
|
|
|
while (Entry != NULL)
|
2004-11-05 11:48:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (Entry->Index >= Index)
|
|
|
|
return Entry;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
Entry = Entry->Next;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return NULL;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
static LONG
|
|
|
|
RetrieveTimeZone(
|
|
|
|
IN HKEY hZoneKey,
|
|
|
|
IN PVOID Context)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LONG lError;
|
2020-04-19 15:48:25 +00:00
|
|
|
PSETUPDATA SetupData = (PSETUPDATA)Context;
|
2011-11-15 08:44:37 +00:00
|
|
|
PTIMEZONE_ENTRY Entry;
|
|
|
|
PTIMEZONE_ENTRY Current;
|
2020-04-19 15:48:25 +00:00
|
|
|
ULONG DescriptionSize;
|
|
|
|
ULONG StandardNameSize;
|
|
|
|
ULONG DaylightNameSize;
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
Entry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TIMEZONE_ENTRY));
|
|
|
|
if (Entry == NULL)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2020-04-19 15:48:25 +00:00
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
DescriptionSize = sizeof(Entry->Description);
|
|
|
|
StandardNameSize = sizeof(Entry->StandardName);
|
|
|
|
DaylightNameSize = sizeof(Entry->DaylightName);
|
|
|
|
|
|
|
|
lError = QueryTimeZoneData(hZoneKey,
|
|
|
|
&Entry->Index,
|
|
|
|
&Entry->TimezoneInfo,
|
|
|
|
Entry->Description,
|
|
|
|
&DescriptionSize,
|
|
|
|
Entry->StandardName,
|
|
|
|
&StandardNameSize,
|
|
|
|
Entry->DaylightName,
|
|
|
|
&DaylightNameSize);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, Entry);
|
|
|
|
return lError;
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
if (SetupData->TimeZoneListHead == NULL &&
|
|
|
|
SetupData->TimeZoneListTail == NULL)
|
|
|
|
{
|
|
|
|
Entry->Prev = NULL;
|
|
|
|
Entry->Next = NULL;
|
|
|
|
SetupData->TimeZoneListHead = Entry;
|
|
|
|
SetupData->TimeZoneListTail = Entry;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Current = GetLargerTimeZoneEntry(SetupData, Entry->Index);
|
|
|
|
if (Current != NULL)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2020-04-19 15:48:25 +00:00
|
|
|
if (Current == SetupData->TimeZoneListHead)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2020-04-19 15:48:25 +00:00
|
|
|
/* Prepend to head */
|
|
|
|
Entry->Prev = NULL;
|
|
|
|
Entry->Next = SetupData->TimeZoneListHead;
|
|
|
|
SetupData->TimeZoneListHead->Prev = Entry;
|
|
|
|
SetupData->TimeZoneListHead = Entry;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-19 15:48:25 +00:00
|
|
|
/* Insert before current */
|
|
|
|
Entry->Prev = Current->Prev;
|
|
|
|
Entry->Next = Current;
|
|
|
|
Current->Prev->Next = Entry;
|
|
|
|
Current->Prev = Entry;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-19 15:48:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Append to tail */
|
|
|
|
Entry->Prev = SetupData->TimeZoneListTail;
|
|
|
|
Entry->Next = NULL;
|
|
|
|
SetupData->TimeZoneListTail->Next = Entry;
|
|
|
|
SetupData->TimeZoneListTail = Entry;
|
|
|
|
}
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
return ERROR_SUCCESS;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
static VOID
|
|
|
|
CreateTimeZoneList(PSETUPDATA SetupData)
|
|
|
|
{
|
|
|
|
EnumerateTimeZoneList(RetrieveTimeZone, SetupData);
|
|
|
|
}
|
2004-11-05 11:48:45 +00:00
|
|
|
|
|
|
|
static VOID
|
|
|
|
DestroyTimeZoneList(PSETUPDATA SetupData)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PTIMEZONE_ENTRY Entry;
|
2004-11-11 12:24:56 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
while (SetupData->TimeZoneListHead != NULL)
|
2004-11-11 12:24:56 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
Entry = SetupData->TimeZoneListHead;
|
2004-11-11 12:24:56 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SetupData->TimeZoneListHead = Entry->Next;
|
|
|
|
if (SetupData->TimeZoneListHead != NULL)
|
|
|
|
{
|
|
|
|
SetupData->TimeZoneListHead->Prev = NULL;
|
|
|
|
}
|
2004-11-11 12:24:56 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, Entry);
|
2004-11-11 12:24:56 +00:00
|
|
|
}
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SetupData->TimeZoneListTail = NULL;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2004-11-24 23:09:46 +00:00
|
|
|
|
2004-11-05 11:48:45 +00:00
|
|
|
static VOID
|
2006-08-07 13:31:11 +00:00
|
|
|
ShowTimeZoneList(HWND hwnd, PSETUPDATA SetupData, DWORD dwEntryIndex)
|
2004-11-05 11:48:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PTIMEZONE_ENTRY Entry;
|
|
|
|
DWORD dwIndex = 0;
|
|
|
|
DWORD dwCount;
|
2004-11-24 23:09:46 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
GetTimeZoneListIndex(&dwEntryIndex);
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
Entry = SetupData->TimeZoneListHead;
|
|
|
|
while (Entry != NULL)
|
2004-11-05 11:48:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
dwCount = SendMessage(hwnd,
|
|
|
|
CB_ADDSTRING,
|
|
|
|
0,
|
|
|
|
(LPARAM)Entry->Description);
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (dwEntryIndex != 0 && dwEntryIndex == Entry->Index)
|
|
|
|
dwIndex = dwCount;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
Entry = Entry->Next;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SendMessage(hwnd,
|
|
|
|
CB_SETCURSEL,
|
|
|
|
(WPARAM)dwIndex,
|
|
|
|
0);
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static VOID
|
2004-11-05 11:48:45 +00:00
|
|
|
SetLocalTimeZone(HWND hwnd, PSETUPDATA SetupData)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
TIME_ZONE_INFORMATION TimeZoneInformation;
|
|
|
|
PTIMEZONE_ENTRY Entry;
|
|
|
|
DWORD dwIndex;
|
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
dwIndex = SendMessage(hwnd,
|
|
|
|
CB_GETCURSEL,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
Entry = SetupData->TimeZoneListHead;
|
|
|
|
while (i < dwIndex)
|
2004-11-05 11:48:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (Entry == NULL)
|
|
|
|
return;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
i++;
|
|
|
|
Entry = Entry->Next;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscpy(TimeZoneInformation.StandardName,
|
|
|
|
Entry->StandardName);
|
|
|
|
wcscpy(TimeZoneInformation.DaylightName,
|
|
|
|
Entry->DaylightName);
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
TimeZoneInformation.Bias = Entry->TimezoneInfo.Bias;
|
|
|
|
TimeZoneInformation.StandardBias = Entry->TimezoneInfo.StandardBias;
|
|
|
|
TimeZoneInformation.DaylightBias = Entry->TimezoneInfo.DaylightBias;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
memcpy(&TimeZoneInformation.StandardDate,
|
|
|
|
&Entry->TimezoneInfo.StandardDate,
|
|
|
|
sizeof(SYSTEMTIME));
|
|
|
|
memcpy(&TimeZoneInformation.DaylightDate,
|
|
|
|
&Entry->TimezoneInfo.DaylightDate,
|
|
|
|
sizeof(SYSTEMTIME));
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Set time zone information */
|
|
|
|
SetTimeZoneInformation(&TimeZoneInformation);
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL
|
|
|
|
GetLocalSystemTime(HWND hwnd, PSETUPDATA SetupData)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
SYSTEMTIME Date;
|
|
|
|
SYSTEMTIME Time;
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (DateTime_GetSystemtime(GetDlgItem(hwnd, IDC_DATEPICKER), &Date) != GDT_VALID)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (DateTime_GetSystemtime(GetDlgItem(hwnd, IDC_TIMEPICKER), &Time) != GDT_VALID)
|
2004-11-05 11:48:45 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-11-05 11:48:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SetupData->SystemTime.wYear = Date.wYear;
|
|
|
|
SetupData->SystemTime.wMonth = Date.wMonth;
|
|
|
|
SetupData->SystemTime.wDayOfWeek = Date.wDayOfWeek;
|
|
|
|
SetupData->SystemTime.wDay = Date.wDay;
|
|
|
|
SetupData->SystemTime.wHour = Time.wHour;
|
|
|
|
SetupData->SystemTime.wMinute = Time.wMinute;
|
|
|
|
SetupData->SystemTime.wSecond = Time.wSecond;
|
|
|
|
SetupData->SystemTime.wMilliseconds = Time.wMilliseconds;
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
2004-11-02 15:42:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-25 23:57:57 +00:00
|
|
|
static BOOL
|
|
|
|
SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
BOOL Ret = FALSE;
|
|
|
|
|
|
|
|
/*
|
2013-05-05 22:31:17 +00:00
|
|
|
* Call SetLocalTime twice to ensure correct results
|
2011-11-15 08:44:37 +00:00
|
|
|
*/
|
2013-05-05 22:31:17 +00:00
|
|
|
Ret = SetLocalTime(&SetupData->SystemTime) &&
|
|
|
|
SetLocalTime(&SetupData->SystemTime);
|
2005-05-09 01:46:46 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return Ret;
|
2005-01-25 23:57:57 +00:00
|
|
|
}
|
|
|
|
|
2017-04-23 21:56:36 +00:00
|
|
|
|
|
|
|
static VOID
|
|
|
|
UpdateLocalSystemTime(HWND hwnd)
|
|
|
|
{
|
|
|
|
SYSTEMTIME LocalTime;
|
|
|
|
|
|
|
|
GetLocalTime(&LocalTime);
|
|
|
|
DateTime_SetSystemtime(GetDlgItem(hwnd, IDC_DATEPICKER), GDT_VALID, &LocalTime);
|
|
|
|
DateTime_SetSystemtime(GetDlgItem(hwnd, IDC_TIMEPICKER), GDT_VALID, &LocalTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-07 13:31:11 +00:00
|
|
|
static BOOL
|
|
|
|
WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
WCHAR Title[64];
|
|
|
|
WCHAR ErrorLocalTime[256];
|
2017-04-23 21:56:36 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
GetLocalSystemTime(hwndDlg, SetupData);
|
|
|
|
SetLocalTimeZone(GetDlgItem(hwndDlg, IDC_TIMEZONELIST),
|
|
|
|
SetupData);
|
|
|
|
|
2020-04-19 15:48:25 +00:00
|
|
|
SetAutoDaylight(SendDlgItemMessage(hwndDlg, IDC_AUTODAYLIGHT,
|
|
|
|
BM_GETCHECK, 0, 0) != BST_UNCHECKED);
|
2017-08-10 18:56:15 +00:00
|
|
|
if (!SetSystemLocalTime(hwndDlg, SetupData))
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(Title, L"ReactOS Setup");
|
|
|
|
}
|
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_WZD_LOCALTIME, ErrorLocalTime,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(ErrorLocalTime)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
wcscpy(ErrorLocalTime, L"Setup was unable to set the local time.");
|
|
|
|
}
|
|
|
|
MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
|
|
|
|
return FALSE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2005-01-25 23:57:57 +00:00
|
|
|
|
2017-04-23 21:56:36 +00:00
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-11-02 15:42:09 +00:00
|
|
|
DateTimePageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PSETUPDATA SetupData;
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Retrieve pointer to the global setup data */
|
2018-02-05 01:42:14 +00:00
|
|
|
SetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-11-02 15:42:09 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2020-04-19 15:48:25 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Save pointer to the global setup data */
|
|
|
|
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
2018-02-05 01:42:14 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)SetupData);
|
2004-11-02 15:42:09 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
CreateTimeZoneList(SetupData);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (SetupData->UnattendSetup)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST),
|
|
|
|
SetupData, SetupData->TimeZoneIndex);
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!SetupData->DisableAutoDaylightTimeSet)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_AUTODAYLIGHT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_TIMEZONELIST),
|
2015-05-02 19:48:26 +00:00
|
|
|
SetupData, -1);
|
2004-11-05 11:48:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_AUTODAYLIGHT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2017-04-23 21:56:36 +00:00
|
|
|
break;
|
2020-04-19 15:48:25 +00:00
|
|
|
}
|
2004-11-11 12:24:56 +00:00
|
|
|
|
2017-04-23 21:56:36 +00:00
|
|
|
case WM_TIMER:
|
|
|
|
UpdateLocalSystemTime(hwndDlg);
|
|
|
|
break;
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2017-04-23 21:56:36 +00:00
|
|
|
switch (((LPNMHDR)lParam)->code)
|
2004-08-03 13:43:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
|
|
|
if (SetupData->UnattendSetup && WriteDateTimeSettings(hwndDlg, SetupData))
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, SetupData->uFirstNetworkWizardPage);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2017-04-23 21:56:36 +00:00
|
|
|
SetTimer(hwndDlg, 1, 1000, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_KILLACTIVE:
|
|
|
|
case DTN_DATETIMECHANGE:
|
|
|
|
KillTimer(hwndDlg, 1);
|
2011-11-15 08:44:37 +00:00
|
|
|
break;
|
2004-08-03 13:43:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZNEXT:
|
2011-05-17 19:33:22 +00:00
|
|
|
WriteDateTimeSettings(hwndDlg, SetupData);
|
2017-04-23 21:56:36 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
|
|
|
SetupData->UnattendSetup = FALSE;
|
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
2017-04-23 21:56:36 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_DESTROY:
|
|
|
|
DestroyTimeZoneList(SetupData);
|
|
|
|
break;
|
2004-11-11 12:24:56 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
2004-05-22 12:04:10 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 22:44:02 +00:00
|
|
|
static struct ThemeInfo
|
|
|
|
{
|
|
|
|
LPCWSTR PreviewBitmap;
|
|
|
|
UINT DisplayName;
|
|
|
|
LPCWSTR ThemeFile;
|
|
|
|
|
|
|
|
} Themes[] = {
|
|
|
|
{ MAKEINTRESOURCE(IDB_CLASSIC), IDS_CLASSIC, NULL },
|
|
|
|
{ MAKEINTRESOURCE(IDB_LAUTUS), IDS_LAUTUS, L"themes\\lautus\\lautus.msstyles" },
|
2019-04-05 23:00:46 +00:00
|
|
|
{ MAKEINTRESOURCE(IDB_LUNAR), IDS_LUNAR, L"themes\\lunar\\lunar.msstyles" },
|
2019-04-06 02:10:59 +00:00
|
|
|
{ MAKEINTRESOURCE(IDB_MIZU), IDS_MIZU, L"themes\\mizu\\mizu.msstyles"},
|
2019-04-02 22:44:02 +00:00
|
|
|
};
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2017-08-06 09:18:19 +00:00
|
|
|
static INT_PTR CALLBACK
|
|
|
|
ThemePageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
PSETUPDATA SetupData;
|
2019-04-02 22:44:02 +00:00
|
|
|
LPNMLISTVIEW pnmv;
|
2017-08-06 09:18:19 +00:00
|
|
|
|
|
|
|
/* Retrieve pointer to the global setup data */
|
2018-02-05 01:42:14 +00:00
|
|
|
SetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
2017-08-06 09:18:19 +00:00
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
2019-04-02 22:44:02 +00:00
|
|
|
HWND hListView;
|
|
|
|
HIMAGELIST himl;
|
|
|
|
DWORD n;
|
|
|
|
LVITEM lvi = {0};
|
2018-02-07 00:26:28 +00:00
|
|
|
|
2017-08-06 09:18:19 +00:00
|
|
|
/* Save pointer to the global setup data */
|
|
|
|
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
2018-02-05 01:42:14 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)SetupData);
|
2018-02-07 00:26:28 +00:00
|
|
|
|
2019-04-02 22:44:02 +00:00
|
|
|
hListView = GetDlgItem(hwndDlg, IDC_THEMEPICKER);
|
2017-08-06 09:18:19 +00:00
|
|
|
|
2019-04-02 22:44:02 +00:00
|
|
|
/* Common */
|
|
|
|
himl = ImageList_Create(180, 163, ILC_COLOR32 | ILC_MASK, ARRAYSIZE(Themes), 1);
|
|
|
|
lvi.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE;
|
2018-02-07 00:26:28 +00:00
|
|
|
|
2019-04-02 22:44:02 +00:00
|
|
|
for (n = 0; n < ARRAYSIZE(Themes); ++n)
|
2017-08-06 09:18:19 +00:00
|
|
|
{
|
2019-04-02 22:44:02 +00:00
|
|
|
WCHAR DisplayName[100] = {0};
|
|
|
|
/* Load the bitmap */
|
|
|
|
HANDLE image = LoadImageW(hDllInstance, Themes[n].PreviewBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
|
|
|
|
ImageList_AddMasked(himl, image, RGB(255,0,255));
|
|
|
|
|
|
|
|
/* Load the string */
|
|
|
|
LoadStringW(hDllInstance, Themes[n].DisplayName, DisplayName, ARRAYSIZE(DisplayName));
|
|
|
|
DisplayName[ARRAYSIZE(DisplayName)-1] = UNICODE_NULL;
|
|
|
|
|
|
|
|
/* Add the listview item */
|
|
|
|
lvi.iItem = n;
|
|
|
|
lvi.iImage = n;
|
|
|
|
lvi.pszText = DisplayName;
|
|
|
|
ListView_InsertItem(hListView, &lvi);
|
2017-08-06 09:18:19 +00:00
|
|
|
}
|
2019-04-02 22:44:02 +00:00
|
|
|
|
|
|
|
/* Register the imagelist */
|
|
|
|
ListView_SetImageList(hListView, himl, LVSIL_NORMAL);
|
|
|
|
/* Transparant background */
|
|
|
|
ListView_SetBkColor(hListView, CLR_NONE);
|
|
|
|
ListView_SetTextBkColor(hListView, CLR_NONE);
|
|
|
|
/* Reduce the size between the items */
|
|
|
|
ListView_SetIconSpacing(hListView, 190, 173);
|
2019-04-02 19:23:58 +00:00
|
|
|
break;
|
2019-04-02 22:44:02 +00:00
|
|
|
}
|
2017-08-06 09:18:19 +00:00
|
|
|
case WM_NOTIFY:
|
|
|
|
switch (((LPNMHDR)lParam)->code)
|
|
|
|
{
|
2019-04-02 22:44:02 +00:00
|
|
|
//case LVN_ITEMCHANGING:
|
|
|
|
case LVN_ITEMCHANGED:
|
|
|
|
pnmv = (LPNMLISTVIEW)lParam;
|
|
|
|
if ((pnmv->uChanged & LVIF_STATE) && (pnmv->uNewState & LVIS_SELECTED))
|
|
|
|
{
|
|
|
|
int iTheme = pnmv->iItem;
|
2019-04-22 14:24:59 +00:00
|
|
|
DPRINT1("Selected theme: %u\n", Themes[iTheme].DisplayName);
|
2019-04-02 22:44:02 +00:00
|
|
|
|
|
|
|
if (Themes[iTheme].ThemeFile)
|
|
|
|
{
|
|
|
|
WCHAR wszParams[1024];
|
|
|
|
WCHAR wszTheme[MAX_PATH];
|
|
|
|
WCHAR* format = L"desk.cpl desk,@Appearance /Action:ActivateMSTheme /file:\"%s\"";
|
|
|
|
|
|
|
|
SHGetFolderPathAndSubDirW(0, CSIDL_RESOURCES, NULL, SHGFP_TYPE_DEFAULT, Themes[iTheme].ThemeFile, wszTheme);
|
|
|
|
swprintf(wszParams, format, wszTheme);
|
|
|
|
RunControlPanelApplet(hwndDlg, wszParams);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RunControlPanelApplet(hwndDlg, L"desk.cpl desk,@Appearance /Action:ActivateMSTheme");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2017-08-06 09:18:19 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
|
|
|
if (SetupData->UnattendSetup)
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, SetupData->uFirstNetworkWizardPage);
|
2017-08-06 09:18:19 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_WIZNEXT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_WIZBACK:
|
|
|
|
SetupData->UnattendSetup = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-11-27 22:27:35 +00:00
|
|
|
static UINT CALLBACK
|
|
|
|
RegistrationNotificationProc(PVOID Context,
|
|
|
|
UINT Notification,
|
|
|
|
UINT_PTR Param1,
|
|
|
|
UINT_PTR Param2)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PREGISTRATIONDATA RegistrationData;
|
|
|
|
REGISTRATIONNOTIFY RegistrationNotify;
|
|
|
|
PSP_REGISTER_CONTROL_STATUSW StatusInfo;
|
|
|
|
UINT MessageID;
|
|
|
|
WCHAR ErrorMessage[128];
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationData = (PREGISTRATIONDATA) Context;
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (SPFILENOTIFY_STARTREGISTRATION == Notification ||
|
|
|
|
SPFILENOTIFY_ENDREGISTRATION == Notification)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1;
|
|
|
|
RegistrationNotify.CurrentItem = wcsrchr(StatusInfo->FileName, L'\\');
|
|
|
|
if (NULL == RegistrationNotify.CurrentItem)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.CurrentItem = StatusInfo->FileName;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.CurrentItem++;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (SPFILENOTIFY_STARTREGISTRATION == Notification)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n",
|
|
|
|
StatusInfo->FileName);
|
|
|
|
RegistrationNotify.ErrorMessage = NULL;
|
|
|
|
RegistrationNotify.Progress = RegistrationData->Registered;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT("Received SPFILENOTIFY_ENDREGISTRATION notification for %S\n",
|
|
|
|
StatusInfo->FileName);
|
|
|
|
DPRINT("Win32Error %u FailureCode %u\n", StatusInfo->Win32Error,
|
|
|
|
StatusInfo->FailureCode);
|
|
|
|
if (SPREG_SUCCESS != StatusInfo->FailureCode)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
switch(StatusInfo->FailureCode)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case SPREG_LOADLIBRARY:
|
|
|
|
MessageID = IDS_LOADLIBRARY_FAILED;
|
|
|
|
break;
|
|
|
|
case SPREG_GETPROCADDR:
|
|
|
|
MessageID = IDS_GETPROCADDR_FAILED;
|
|
|
|
break;
|
|
|
|
case SPREG_REGSVR:
|
|
|
|
MessageID = IDS_REGSVR_FAILED;
|
|
|
|
break;
|
|
|
|
case SPREG_DLLINSTALL:
|
|
|
|
MessageID = IDS_DLLINSTALL_FAILED;
|
|
|
|
break;
|
|
|
|
case SPREG_TIMEOUT:
|
|
|
|
MessageID = IDS_TIMEOUT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
MessageID = IDS_REASON_UNKNOWN;
|
|
|
|
break;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, MessageID,
|
|
|
|
ErrorMessage,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(ErrorMessage)))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
ErrorMessage[0] = L'\0';
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
if (SPREG_TIMEOUT != StatusInfo->FailureCode)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
|
|
|
StatusInfo->Win32Error, 0,
|
|
|
|
ErrorMessage + wcslen(ErrorMessage),
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(ErrorMessage) - wcslen(ErrorMessage),
|
|
|
|
NULL);
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.ErrorMessage = ErrorMessage;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.ErrorMessage = NULL;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
if (RegistrationData->Registered < RegistrationData->DllCount)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationData->Registered++;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.Progress = RegistrationData->Registered;
|
|
|
|
RegistrationNotify.ActivityID = IDS_REGISTERING_COMPONENTS;
|
|
|
|
SendMessage(RegistrationData->hwndDlg, PM_REGISTRATION_NOTIFY,
|
|
|
|
0, (LPARAM) &RegistrationNotify);
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FILEOP_DOIT;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Received unexpected notification %u\n", Notification);
|
|
|
|
return SetupDefaultQueueCallback(RegistrationData->DefaultContext,
|
|
|
|
Notification, Param1, Param2);
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static DWORD CALLBACK
|
|
|
|
RegistrationProc(LPVOID Parameter)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PREGISTRATIONDATA RegistrationData;
|
|
|
|
REGISTRATIONNOTIFY RegistrationNotify;
|
|
|
|
DWORD LastError = NO_ERROR;
|
|
|
|
WCHAR UnknownError[84];
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationData = (PREGISTRATIONDATA) Parameter;
|
|
|
|
RegistrationData->Registered = 0;
|
|
|
|
RegistrationData->DefaultContext = SetupInitDefaultQueueCallback(RegistrationData->hwndDlg);
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
_SEH2_TRY
|
2005-12-01 15:37:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!SetupInstallFromInfSectionW(GetParent(RegistrationData->hwndDlg),
|
|
|
|
hSysSetupInf,
|
|
|
|
L"RegistrationPhase2",
|
|
|
|
SPINST_REGISTRY |
|
|
|
|
SPINST_REGISTERCALLBACKAWARE |
|
|
|
|
SPINST_REGSVR,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
RegistrationNotificationProc,
|
|
|
|
RegistrationData,
|
|
|
|
NULL,
|
|
|
|
NULL))
|
2005-12-01 15:37:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LastError = GetLastError();
|
2005-12-01 15:37:00 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-12-01 15:37:00 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT("Catching exception\n");
|
|
|
|
LastError = RtlNtStatusToDosError(_SEH2_GetExceptionCode());
|
2005-12-01 15:37:00 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
_SEH2_END;
|
2005-12-01 15:37:00 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (NO_ERROR == LastError)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.ErrorMessage = NULL;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("SetupInstallFromInfSection failed with error %u\n",
|
|
|
|
LastError);
|
|
|
|
if (0 == FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
|
|
|
FORMAT_MESSAGE_FROM_SYSTEM, NULL, LastError, 0,
|
|
|
|
(LPWSTR) &RegistrationNotify.ErrorMessage, 0,
|
|
|
|
NULL))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_UNKNOWN_ERROR,
|
|
|
|
UnknownError,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(UnknownError) - 20))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscpy(UnknownError, L"Unknown error");
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscat(UnknownError, L" ");
|
|
|
|
_ultow(LastError, UnknownError + wcslen(UnknownError), 10);
|
|
|
|
RegistrationNotify.ErrorMessage = UnknownError;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationNotify.Progress = RegistrationData->DllCount;
|
|
|
|
RegistrationNotify.ActivityID = IDS_REGISTERING_COMPONENTS;
|
|
|
|
RegistrationNotify.CurrentItem = NULL;
|
|
|
|
SendMessage(RegistrationData->hwndDlg, PM_REGISTRATION_NOTIFY,
|
|
|
|
1, (LPARAM) &RegistrationNotify);
|
|
|
|
if (NULL != RegistrationNotify.ErrorMessage &&
|
|
|
|
UnknownError != RegistrationNotify.ErrorMessage)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LocalFree((PVOID) RegistrationNotify.ErrorMessage);
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SetupTermDefaultQueueCallback(RegistrationData->DefaultContext);
|
|
|
|
HeapFree(GetProcessHeap(), 0, RegistrationData);
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2013-05-17 21:40:46 +00:00
|
|
|
RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
|
|
|
|
|
2012-04-06 18:25:18 +00:00
|
|
|
// FIXME: Move this call to a separate cleanup page!
|
|
|
|
RtlCreateBootStatusDataFile();
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return 0;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL
|
|
|
|
StartComponentRegistration(HWND hwndDlg, PULONG MaxProgress)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HANDLE RegistrationThread;
|
|
|
|
LONG DllCount;
|
|
|
|
INFCONTEXT Context;
|
|
|
|
WCHAR SectionName[512];
|
|
|
|
PREGISTRATIONDATA RegistrationData;
|
|
|
|
|
|
|
|
DllCount = -1;
|
2017-08-10 18:56:15 +00:00
|
|
|
if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
|
|
|
|
L"RegisterDlls", &Context))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("No RegistrationPhase2 section found\n");
|
|
|
|
return FALSE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
if (!SetupGetStringFieldW(&Context, 1, SectionName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(SectionName),
|
2017-08-10 18:56:15 +00:00
|
|
|
NULL))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Unable to retrieve section name\n");
|
|
|
|
return FALSE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
|
|
|
|
DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
|
|
|
|
if (DllCount < 0)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
SetLastError(STATUS_NOT_FOUND);
|
|
|
|
return FALSE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
*MaxProgress = (ULONG) DllCount;
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/*
|
|
|
|
* Create a background thread to do the actual registrations, so the
|
|
|
|
* main thread can just run its message loop.
|
|
|
|
*/
|
|
|
|
RegistrationThread = NULL;
|
|
|
|
RegistrationData = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
sizeof(REGISTRATIONDATA));
|
2011-12-20 14:56:22 +00:00
|
|
|
if (RegistrationData != NULL)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
RegistrationData->hwndDlg = hwndDlg;
|
|
|
|
RegistrationData->DllCount = DllCount;
|
|
|
|
RegistrationThread = CreateThread(NULL, 0, RegistrationProc,
|
2015-04-20 09:35:39 +00:00
|
|
|
RegistrationData, 0, NULL);
|
2011-12-20 14:56:22 +00:00
|
|
|
if (RegistrationThread != NULL)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
CloseHandle(RegistrationThread);
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("CreateThread failed, error %u\n", GetLastError());
|
2011-12-20 14:56:22 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, RegistrationData);
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
else
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("HeapAlloc() failed, error %u\n", GetLastError());
|
|
|
|
return FALSE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-09-24 18:52:29 +00:00
|
|
|
ProcessPageDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
PSETUPDATA SetupData;
|
|
|
|
PREGISTRATIONNOTIFY RegistrationNotify;
|
|
|
|
static UINT oldActivityID = -1;
|
|
|
|
WCHAR Title[64];
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Retrieve pointer to the global setup data */
|
2018-02-05 01:42:14 +00:00
|
|
|
SetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-09-24 18:52:29 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
2004-09-24 18:52:29 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Save pointer to the global setup data */
|
|
|
|
SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
2018-02-05 01:42:14 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)SetupData);
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
2004-09-24 18:52:29 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
|
|
|
ULONG MaxProgress = 0;
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
2004-09-24 18:52:29 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Disable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
StartComponentRegistration(hwndDlg, &MaxProgress);
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETRANGE,
|
|
|
|
0, MAKELPARAM(0, MaxProgress));
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS,
|
|
|
|
0, 0);
|
|
|
|
break;
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZNEXT:
|
|
|
|
break;
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PSN_WIZBACK:
|
|
|
|
SetupData->UnattendSetup = FALSE;
|
|
|
|
break;
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case PM_REGISTRATION_NOTIFY:
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
WCHAR Activity[64];
|
|
|
|
RegistrationNotify = (PREGISTRATIONNOTIFY) lParam;
|
|
|
|
// update if necessary only
|
|
|
|
if (oldActivityID != RegistrationNotify->ActivityID)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (0 != LoadStringW(hDllInstance, RegistrationNotify->ActivityID,
|
|
|
|
Activity,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(Activity)))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_ACTIVITY, WM_SETTEXT,
|
|
|
|
0, (LPARAM) Activity);
|
|
|
|
}
|
|
|
|
oldActivityID = RegistrationNotify->ActivityID;
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_ITEM, WM_SETTEXT, 0,
|
|
|
|
(LPARAM)(NULL == RegistrationNotify->CurrentItem ?
|
|
|
|
L"" : RegistrationNotify->CurrentItem));
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS,
|
|
|
|
RegistrationNotify->Progress, 0);
|
|
|
|
if (NULL != RegistrationNotify->ErrorMessage)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP,
|
2017-08-10 18:59:26 +00:00
|
|
|
Title, ARRAYSIZE(Title)))
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
wcscpy(Title, L"ReactOS Setup");
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
MessageBoxW(hwndDlg, RegistrationNotify->ErrorMessage,
|
|
|
|
Title, MB_ICONERROR | MB_OK);
|
2005-11-27 22:27:35 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (wParam)
|
2005-11-27 22:27:35 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Enable the Back and Next buttons */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
|
|
|
|
PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);
|
2005-11-27 22:27:35 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
2005-11-27 22:27:35 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-14 15:35:41 +00:00
|
|
|
static VOID
|
2011-03-27 21:51:41 +00:00
|
|
|
SetInstallationCompleted(VOID)
|
2005-11-14 15:35:41 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
HKEY hKey = 0;
|
|
|
|
DWORD InProgress = 0;
|
|
|
|
DWORD InstallDate;
|
2011-05-20 22:29:54 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (RegOpenKeyExW( HKEY_LOCAL_MACHINE,
|
|
|
|
L"SYSTEM\\Setup",
|
|
|
|
0,
|
|
|
|
KEY_WRITE,
|
|
|
|
&hKey ) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
RegSetValueExW( hKey, L"SystemSetupInProgress", 0, REG_DWORD, (LPBYTE)&InProgress, sizeof(InProgress) );
|
|
|
|
RegCloseKey( hKey );
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RegOpenKeyExW( HKEY_LOCAL_MACHINE,
|
|
|
|
L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
0,
|
|
|
|
KEY_WRITE,
|
|
|
|
&hKey ) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
InstallDate = (DWORD)time(NULL);
|
|
|
|
RegSetValueExW( hKey, L"InstallDate", 0, REG_DWORD, (LPBYTE)&InstallDate, sizeof(InstallDate) );
|
|
|
|
RegCloseKey( hKey );
|
|
|
|
}
|
2005-11-14 15:35:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-27 22:33:17 +00:00
|
|
|
static INT_PTR CALLBACK
|
2004-04-16 13:37:18 +00:00
|
|
|
FinishDlgProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (uMsg)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
|
|
|
/* Get pointer to the global setup data */
|
2013-10-06 16:51:45 +00:00
|
|
|
PSETUPDATA SetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
|
2015-06-09 23:20:33 +00:00
|
|
|
if (!SetupData->UnattendSetup || !SetupData->DisableGeckoInst)
|
|
|
|
{
|
|
|
|
/* Run the Wine Gecko prompt */
|
|
|
|
Control_RunDLLW(hwndDlg, 0, L"appwiz.cpl install_gecko", SW_SHOW);
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Set title font */
|
|
|
|
SendDlgItemMessage(hwndDlg,
|
|
|
|
IDC_FINISHTITLE,
|
|
|
|
WM_SETFONT,
|
|
|
|
(WPARAM)SetupData->hTitleFont,
|
|
|
|
(LPARAM)TRUE);
|
|
|
|
if (SetupData->UnattendSetup)
|
|
|
|
{
|
|
|
|
KillTimer(hwndDlg, 1);
|
|
|
|
SetInstallationCompleted();
|
|
|
|
PostQuitMessage(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
2004-09-24 18:52:29 +00:00
|
|
|
{
|
2011-03-27 21:51:41 +00:00
|
|
|
SetInstallationCompleted();
|
2007-09-04 20:26:02 +00:00
|
|
|
PostQuitMessage(0);
|
2011-11-15 08:44:37 +00:00
|
|
|
return TRUE;
|
2004-09-24 18:52:29 +00:00
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_TIMER:
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
INT Position;
|
|
|
|
HWND hWndProgress;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
|
|
|
|
Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0);
|
|
|
|
if (Position == 300)
|
2004-04-16 13:37:18 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
KillTimer(hwndDlg, 1);
|
|
|
|
PropSheet_PressButton(GetParent(hwndDlg), PSBTN_FINISH);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
LPNMHDR lpnm = (LPNMHDR)lParam;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
switch (lpnm->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
/* Enable the correct buttons on for the active page */
|
|
|
|
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH);
|
|
|
|
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETRANGE, 0,
|
|
|
|
MAKELPARAM(0, 300));
|
|
|
|
SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETPOS, 0, 0);
|
|
|
|
SetTimer(hwndDlg, 1, 50, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_WIZFINISH:
|
|
|
|
DestroyWindow(GetParent(hwndDlg));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
}
|
2004-05-22 12:04:10 +00:00
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
return FALSE;
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
2012-04-06 18:25:18 +00:00
|
|
|
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
/*
|
|
|
|
* GetInstallSourceWin32 retrieves the path to the ReactOS installation medium
|
|
|
|
* in Win32 format, for later use by syssetup and storage in the registry.
|
|
|
|
*/
|
|
|
|
static BOOL
|
|
|
|
GetInstallSourceWin32(
|
|
|
|
OUT PWSTR pwszPath,
|
|
|
|
IN DWORD cchPathMax,
|
|
|
|
IN PCWSTR pwszNTPath)
|
|
|
|
{
|
|
|
|
WCHAR wszDrives[512];
|
|
|
|
WCHAR wszNTPath[512]; // MAX_PATH ?
|
|
|
|
DWORD cchDrives;
|
|
|
|
PWCHAR pwszDrive;
|
|
|
|
|
|
|
|
*pwszPath = UNICODE_NULL;
|
|
|
|
|
|
|
|
cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
|
|
|
|
if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
|
|
|
|
{
|
|
|
|
/* Buffer too small or failure */
|
|
|
|
LogItem(NULL, L"GetLogicalDriveStringsW failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
|
|
|
|
{
|
|
|
|
WCHAR wszBuf[MAX_PATH];
|
|
|
|
|
|
|
|
/* Retrieve the NT path corresponding to the current Win32 DOS path */
|
|
|
|
pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
|
|
|
|
QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
|
|
|
|
pwszDrive[2] = L'\\'; // Restore the backslash
|
|
|
|
|
|
|
|
wcscat(wszNTPath, L"\\"); // Concat a backslash
|
|
|
|
|
|
|
|
/* Logging */
|
|
|
|
wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD",
|
|
|
|
pwszDrive, wszNTPath,
|
|
|
|
(GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not");
|
|
|
|
LogItem(NULL, wszBuf);
|
|
|
|
|
|
|
|
/* Check whether the NT path corresponds to the NT installation source path */
|
|
|
|
if (!_wcsicmp(wszNTPath, pwszNTPath))
|
|
|
|
{
|
|
|
|
/* Found it! */
|
|
|
|
wcscpy(pwszPath, pwszDrive); // cchPathMax
|
|
|
|
|
|
|
|
/* Logging */
|
|
|
|
wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath);
|
|
|
|
LogItem(NULL, wszBuf);
|
|
|
|
wcscat(wszBuf, L"\n");
|
|
|
|
OutputDebugStringW(wszBuf);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-12-08 15:57:47 +00:00
|
|
|
VOID
|
2017-08-10 19:21:08 +00:00
|
|
|
ProcessUnattendSection(
|
|
|
|
IN OUT PSETUPDATA pSetupData)
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
INFCONTEXT InfContext;
|
|
|
|
WCHAR szName[256];
|
|
|
|
WCHAR szValue[MAX_PATH];
|
|
|
|
DWORD LineLength;
|
|
|
|
HKEY hKey;
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (!SetupFindFirstLineW(pSetupData->hSetupInf,
|
2011-11-15 08:44:37 +00:00
|
|
|
L"Unattend",
|
|
|
|
L"UnattendSetupEnabled",
|
|
|
|
&InfContext))
|
2006-09-13 12:33:59 +00:00
|
|
|
{
|
2017-08-10 18:56:15 +00:00
|
|
|
DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2006-09-13 12:33:59 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
1,
|
|
|
|
szValue,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szValue),
|
2011-11-15 08:44:37 +00:00
|
|
|
&LineLength))
|
2006-09-13 12:33:59 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2006-09-13 12:33:59 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2017-08-10 18:59:26 +00:00
|
|
|
if (_wcsicmp(szValue, L"yes") != 0)
|
2006-09-13 12:33:59 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2007-10-19 23:21:45 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->UnattendSetup = TRUE;
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (!SetupFindFirstLineW(pSetupData->hSetupInf,
|
2011-11-15 08:44:37 +00:00
|
|
|
L"Unattend",
|
|
|
|
NULL,
|
|
|
|
&InfContext))
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
0,
|
|
|
|
szName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szName),
|
2011-11-15 08:44:37 +00:00
|
|
|
&LineLength))
|
|
|
|
{
|
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2006-08-07 13:31:11 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
1,
|
|
|
|
szValue,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szValue),
|
2011-11-15 08:44:37 +00:00
|
|
|
&LineLength))
|
2006-08-07 13:31:11 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
DPRINT1("Name %S Value %S\n", szName, szValue);
|
2017-08-10 18:59:26 +00:00
|
|
|
if (!_wcsicmp(szName, L"FullName"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (ARRAYSIZE(pSetupData->OwnerName) > LineLength)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
wcscpy(pSetupData->OwnerName, szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"OrgName"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
wcscpy(pSetupData->OwnerOrganization, szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"ComputerName"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (ARRAYSIZE(pSetupData->ComputerName) > LineLength)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
wcscpy(pSetupData->ComputerName, szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"AdminPassword"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
wcscpy(pSetupData->AdminPassword, szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"TimeZoneIndex"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->TimeZoneIndex = _wtoi(szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet"))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"DisableGeckoInst"))
|
2015-06-09 23:20:33 +00:00
|
|
|
{
|
2017-08-10 18:59:26 +00:00
|
|
|
if (!_wcsicmp(szValue, L"yes"))
|
2017-08-10 18:56:15 +00:00
|
|
|
pSetupData->DisableGeckoInst = TRUE;
|
2015-06-09 23:20:33 +00:00
|
|
|
else
|
2017-08-10 18:56:15 +00:00
|
|
|
pSetupData->DisableGeckoInst = FALSE;
|
2015-06-09 23:20:33 +00:00
|
|
|
}
|
2020-05-19 06:41:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"ProductOption"))
|
|
|
|
{
|
|
|
|
pSetupData->ProductOption = (PRODUCT_OPTION)_wtoi(szValue);
|
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
} while (SetupFindNextLine(&InfContext, &InfContext));
|
2015-12-08 15:57:47 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (SetupFindFirstLineW(pSetupData->hSetupInf,
|
2017-05-27 09:37:16 +00:00
|
|
|
L"Display",
|
|
|
|
NULL,
|
|
|
|
&InfContext))
|
|
|
|
{
|
|
|
|
DEVMODEW dm = { { 0 } };
|
|
|
|
dm.dmSize = sizeof(dm);
|
|
|
|
if (EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
int iValue;
|
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
0,
|
|
|
|
szName,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szName),
|
2017-05-27 09:37:16 +00:00
|
|
|
&LineLength))
|
|
|
|
{
|
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
1,
|
|
|
|
szValue,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szValue),
|
2017-05-27 09:37:16 +00:00
|
|
|
&LineLength))
|
|
|
|
{
|
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iValue = _wtoi(szValue);
|
|
|
|
DPRINT1("Name %S Value %i\n", szName, iValue);
|
|
|
|
|
|
|
|
if (!iValue)
|
|
|
|
continue;
|
|
|
|
|
2017-08-10 18:59:26 +00:00
|
|
|
if (!_wcsicmp(szName, L"BitsPerPel"))
|
2017-05-27 09:37:16 +00:00
|
|
|
{
|
|
|
|
dm.dmFields |= DM_BITSPERPEL;
|
|
|
|
dm.dmBitsPerPel = iValue;
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"XResolution"))
|
2017-05-27 09:37:16 +00:00
|
|
|
{
|
|
|
|
dm.dmFields |= DM_PELSWIDTH;
|
|
|
|
dm.dmPelsWidth = iValue;
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"YResolution"))
|
2017-05-27 09:37:16 +00:00
|
|
|
{
|
|
|
|
dm.dmFields |= DM_PELSHEIGHT;
|
|
|
|
dm.dmPelsHeight = iValue;
|
|
|
|
}
|
2017-08-10 18:59:26 +00:00
|
|
|
else if (!_wcsicmp(szName, L"VRefresh"))
|
2017-05-27 09:37:16 +00:00
|
|
|
{
|
|
|
|
dm.dmFields |= DM_DISPLAYFREQUENCY;
|
|
|
|
dm.dmDisplayFrequency = iValue;
|
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
} while (SetupFindNextLine(&InfContext, &InfContext));
|
2017-05-27 09:37:16 +00:00
|
|
|
|
|
|
|
ChangeDisplaySettingsW(&dm, CDS_UPDATEREGISTRY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
|
|
|
|
0,
|
|
|
|
KEY_SET_VALUE,
|
|
|
|
&hKey) != ERROR_SUCCESS)
|
2007-08-29 21:10:05 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
DPRINT1("Error: failed to open HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
|
2015-12-08 15:57:47 +00:00
|
|
|
return;
|
2007-08-29 21:10:05 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (SetupFindFirstLineW(pSetupData->hSetupInf,
|
2011-11-15 08:44:37 +00:00
|
|
|
L"GuiRunOnce",
|
|
|
|
NULL,
|
|
|
|
&InfContext))
|
2006-11-10 11:16:38 +00:00
|
|
|
{
|
2011-11-15 08:44:37 +00:00
|
|
|
int i = 0;
|
|
|
|
do
|
|
|
|
{
|
2017-08-10 18:56:15 +00:00
|
|
|
if (SetupGetStringFieldW(&InfContext,
|
|
|
|
0,
|
|
|
|
szValue,
|
2017-08-10 18:59:26 +00:00
|
|
|
ARRAYSIZE(szValue),
|
2017-08-10 18:56:15 +00:00
|
|
|
NULL))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
WCHAR szPath[MAX_PATH];
|
|
|
|
swprintf(szName, L"%d", i);
|
|
|
|
DPRINT("szName %S szValue %S\n", szName, szValue);
|
|
|
|
|
|
|
|
if (ExpandEnvironmentStringsW(szValue, szPath, MAX_PATH))
|
|
|
|
{
|
|
|
|
DPRINT("value %S\n", szPath);
|
|
|
|
if (RegSetValueExW(hKey,
|
|
|
|
szName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(const BYTE*)szPath,
|
|
|
|
(wcslen(szPath) + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-10 18:56:15 +00:00
|
|
|
} while (SetupFindNextLine(&InfContext, &InfContext));
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2007-08-30 17:20:32 +00:00
|
|
|
|
2006-11-10 11:16:38 +00:00
|
|
|
RegCloseKey(hKey);
|
2006-08-07 13:31:11 +00:00
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
VOID
|
|
|
|
ProcessSetupInf(
|
|
|
|
IN OUT PSETUPDATA pSetupData)
|
2007-08-28 14:00:24 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
WCHAR szPath[MAX_PATH];
|
|
|
|
WCHAR szValue[MAX_PATH];
|
|
|
|
INFCONTEXT InfContext;
|
|
|
|
DWORD LineLength;
|
|
|
|
HKEY hKey;
|
|
|
|
LONG res;
|
2007-08-28 14:00:24 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
pSetupData->hSetupInf = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
|
|
/* Retrieve the path of the setup INF */
|
|
|
|
GetSystemDirectoryW(szPath, _countof(szPath));
|
|
|
|
wcscat(szPath, L"\\$winnt$.inf");
|
|
|
|
|
|
|
|
/* Open the setup INF */
|
|
|
|
pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
|
|
|
|
NULL,
|
|
|
|
INF_STYLE_OLDNT,
|
|
|
|
NULL);
|
|
|
|
if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
|
2007-08-28 14:00:24 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
|
|
|
|
return;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
|
|
|
|
/* Retrieve the NT source path from which the 1st-stage installer was run */
|
|
|
|
if (!SetupFindFirstLineW(pSetupData->hSetupInf,
|
|
|
|
L"data",
|
|
|
|
L"sourcepath",
|
|
|
|
&InfContext))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2019-04-02 19:23:58 +00:00
|
|
|
DPRINT1("Error: Cannot find sourcepath Key! %d\n", GetLastError());
|
2017-08-10 19:21:08 +00:00
|
|
|
return;
|
2007-08-28 14:00:24 +00:00
|
|
|
}
|
2004-04-16 13:37:18 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (!SetupGetStringFieldW(&InfContext,
|
|
|
|
1,
|
|
|
|
szValue,
|
|
|
|
ARRAYSIZE(szValue),
|
|
|
|
&LineLength))
|
|
|
|
{
|
|
|
|
DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pSetupData->SourcePath = UNICODE_NULL;
|
|
|
|
|
|
|
|
/* Close the setup INF as we are going to modify it manually */
|
|
|
|
if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
|
|
|
|
SetupCloseInfFile(pSetupData->hSetupInf);
|
2012-04-06 18:25:18 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
/* Find the installation source path in Win32 format */
|
|
|
|
if (!GetInstallSourceWin32(pSetupData->SourcePath,
|
|
|
|
_countof(pSetupData->SourcePath),
|
|
|
|
szValue))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
*pSetupData->SourcePath = UNICODE_NULL;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
/* Save the path in Win32 format in the setup INF */
|
|
|
|
swprintf(szValue, L"\"%s\"", pSetupData->SourcePath);
|
|
|
|
WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save it also in the registry, in the following keys:
|
|
|
|
* - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup ,
|
|
|
|
* values "SourcePath" and "ServicePackSourcePath" (REG_SZ);
|
|
|
|
* - HKLM\Software\Microsoft\Windows NT\CurrentVersion ,
|
|
|
|
* value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386).
|
|
|
|
*/
|
|
|
|
#if 0
|
|
|
|
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"Software\\Microsoft\\Windows NT\\CurrentVersion",
|
|
|
|
0,
|
|
|
|
KEY_ALL_ACCESS,
|
|
|
|
&hKey);
|
|
|
|
|
|
|
|
if (res != ERROR_SUCCESS)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
res = RegCreateKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
|
|
|
|
0, NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE,
|
|
|
|
KEY_ALL_ACCESS, // KEY_WRITE
|
|
|
|
NULL,
|
|
|
|
&hKey,
|
|
|
|
NULL);
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
res = RegSetValueExW(hKey,
|
|
|
|
L"SourcePath",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)pSetupData->SourcePath,
|
|
|
|
(wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
|
|
|
|
|
|
|
|
res = RegSetValueExW(hKey,
|
|
|
|
L"ServicePackSourcePath",
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(LPBYTE)pSetupData->SourcePath,
|
|
|
|
(wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2007-08-28 14:00:24 +00:00
|
|
|
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
/* Now, re-open the setup INF (this must succeed) */
|
|
|
|
pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
|
|
|
|
NULL,
|
|
|
|
INF_STYLE_OLDNT,
|
|
|
|
NULL);
|
|
|
|
if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
2017-08-10 19:21:08 +00:00
|
|
|
DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
|
|
|
|
return;
|
2011-11-15 08:44:37 +00:00
|
|
|
}
|
2017-08-10 19:21:08 +00:00
|
|
|
|
|
|
|
/* Process the unattended section of the setup file */
|
|
|
|
ProcessUnattendSection(pSetupData);
|
2007-08-28 14:00:24 +00:00
|
|
|
}
|
|
|
|
|
2016-05-17 22:38:58 +00:00
|
|
|
typedef DWORD(WINAPI *PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA);
|
2007-08-28 14:00:24 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
InstallWizard(VOID)
|
|
|
|
{
|
2020-01-24 19:07:38 +00:00
|
|
|
PROPSHEETHEADER psh = {0};
|
2016-05-17 22:38:58 +00:00
|
|
|
HPROPSHEETPAGE *phpage = NULL;
|
2011-11-15 08:44:37 +00:00
|
|
|
PROPSHEETPAGE psp = {0};
|
|
|
|
UINT nPages = 0;
|
|
|
|
HWND hWnd;
|
|
|
|
MSG msg;
|
2015-12-08 15:57:47 +00:00
|
|
|
PSETUPDATA pSetupData = NULL;
|
2016-05-17 22:38:58 +00:00
|
|
|
HMODULE hNetShell = NULL;
|
|
|
|
PFNREQUESTWIZARDPAGES pfn = NULL;
|
2020-02-10 02:10:42 +00:00
|
|
|
DWORD dwPageCount = 10, dwNetworkPageCount = 0;
|
2015-12-08 15:57:47 +00:00
|
|
|
|
2015-12-31 22:17:45 +00:00
|
|
|
LogItem(L"BEGIN_SECTION", L"InstallWizard");
|
|
|
|
|
2015-12-08 15:57:47 +00:00
|
|
|
/* Allocate setup data */
|
|
|
|
pSetupData = HeapAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
sizeof(SETUPDATA));
|
|
|
|
if (pSetupData == NULL)
|
|
|
|
{
|
2015-12-31 22:17:45 +00:00
|
|
|
LogItem(NULL, L"SetupData allocation failed!");
|
2015-12-08 15:57:47 +00:00
|
|
|
MessageBoxW(NULL,
|
|
|
|
L"Setup failed to allocate global data!",
|
|
|
|
L"ReactOS Setup",
|
|
|
|
MB_ICONERROR | MB_OK);
|
2016-05-17 22:38:58 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2020-05-19 06:41:26 +00:00
|
|
|
pSetupData->ProductOption = PRODUCT_OPTION_DEFAULT;
|
2016-05-17 22:38:58 +00:00
|
|
|
|
|
|
|
hNetShell = LoadLibraryW(L"netshell.dll");
|
|
|
|
if (hNetShell != NULL)
|
|
|
|
{
|
|
|
|
DPRINT("Netshell.dll loaded!\n");
|
|
|
|
|
|
|
|
pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
|
|
|
|
"NetSetupRequestWizardPages");
|
|
|
|
if (pfn != NULL)
|
|
|
|
{
|
|
|
|
pfn(&dwNetworkPageCount, NULL, NULL);
|
|
|
|
dwPageCount += dwNetworkPageCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINT("PageCount: %lu\n", dwPageCount);
|
|
|
|
|
|
|
|
phpage = HeapAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
dwPageCount * sizeof(HPROPSHEETPAGE));
|
|
|
|
if (phpage == NULL)
|
|
|
|
{
|
|
|
|
LogItem(NULL, L"Page array allocation failed!");
|
|
|
|
MessageBoxW(NULL,
|
|
|
|
L"Setup failed to allocate page array!",
|
|
|
|
L"ReactOS Setup",
|
|
|
|
MB_ICONERROR | MB_OK);
|
|
|
|
goto done;
|
2015-12-08 15:57:47 +00:00
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
/* Process the $winnt$.inf setup file */
|
|
|
|
ProcessSetupInf(pSetupData);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the Welcome page */
|
|
|
|
psp.dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
psp.hInstance = hDllInstance;
|
2015-12-08 15:57:47 +00:00
|
|
|
psp.lParam = (LPARAM)pSetupData;
|
2011-11-15 08:44:37 +00:00
|
|
|
psp.pfnDlgProc = WelcomeDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the Acknowledgements page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
|
|
|
|
psp.pfnDlgProc = AckPageDlgProc;
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2020-02-10 02:10:42 +00:00
|
|
|
/* Create the Product page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PRODUCTTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PRODUCTSUBTITLE);
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_PRODUCT);
|
|
|
|
psp.pfnDlgProc = ProductPageDlgProc;
|
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
2014-01-12 15:38:17 +00:00
|
|
|
/* 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);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2014-01-12 15:38:17 +00:00
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Create the Owner page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
|
|
|
|
psp.pfnDlgProc = OwnerPageDlgProc;
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the Computer page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
|
|
|
|
psp.pfnDlgProc = ComputerPageDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the DateTime page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
|
|
|
|
psp.pfnDlgProc = DateTimePageDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
|
|
|
|
2017-08-06 09:18:19 +00:00
|
|
|
/* Create the theme selection page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
|
|
|
|
psp.pfnDlgProc = ThemePageDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
|
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2016-05-17 22:38:58 +00:00
|
|
|
pSetupData->uFirstNetworkWizardPage = IDD_PROCESSPAGE;
|
|
|
|
pSetupData->uPostNetworkWizardPage = IDD_PROCESSPAGE;
|
|
|
|
|
|
|
|
if (pfn)
|
|
|
|
{
|
|
|
|
pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
|
|
|
|
nPages += dwNetworkPageCount;
|
|
|
|
}
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the Process page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
|
|
|
|
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
|
|
|
|
psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
|
|
|
|
psp.pfnDlgProc = ProcessPageDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Create the Finish page */
|
|
|
|
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
|
|
|
|
psp.pfnDlgProc = FinishDlgProc;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
|
2016-05-17 22:38:58 +00:00
|
|
|
phpage[nPages++] = CreatePropertySheetPage(&psp);
|
2011-11-15 08:44:37 +00:00
|
|
|
|
2018-06-08 04:31:26 +00:00
|
|
|
ASSERT(nPages == dwPageCount);
|
|
|
|
|
2011-11-15 08:44:37 +00:00
|
|
|
/* Create the property sheet */
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
|
|
|
psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
|
|
|
|
psh.hInstance = hDllInstance;
|
|
|
|
psh.hwndParent = NULL;
|
|
|
|
psh.nPages = nPages;
|
|
|
|
psh.nStartPage = 0;
|
2016-05-17 22:38:58 +00:00
|
|
|
psh.phpage = phpage;
|
2011-11-15 08:44:37 +00:00
|
|
|
psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
|
|
|
|
psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
|
|
|
|
|
|
|
|
/* Create title font */
|
2015-12-08 15:57:47 +00:00
|
|
|
pSetupData->hTitleFont = CreateTitleFont();
|
2017-08-10 18:56:15 +00:00
|
|
|
pSetupData->hBoldFont = CreateBoldFont();
|
2011-11-15 08:44:37 +00:00
|
|
|
|
|
|
|
/* Display the wizard */
|
|
|
|
hWnd = (HWND)PropertySheet(&psh);
|
|
|
|
ShowWindow(hWnd, SW_SHOW);
|
|
|
|
|
|
|
|
while (GetMessage(&msg, NULL, 0, 0))
|
2010-04-25 12:13:01 +00:00
|
|
|
{
|
2015-03-27 11:44:59 +00:00
|
|
|
if (!IsDialogMessage(hWnd, &msg))
|
2011-11-15 08:44:37 +00:00
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessage(&msg);
|
|
|
|
}
|
2010-04-25 12:13:01 +00:00
|
|
|
}
|
2004-09-24 18:52:29 +00:00
|
|
|
|
2018-05-20 18:35:56 +00:00
|
|
|
DeleteObject(pSetupData->hBoldFont);
|
|
|
|
DeleteObject(pSetupData->hTitleFont);
|
|
|
|
|
2017-08-10 19:21:08 +00:00
|
|
|
if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
|
|
|
|
SetupCloseInfFile(pSetupData->hSetupInf);
|
2015-12-08 15:57:47 +00:00
|
|
|
|
2016-05-17 22:38:58 +00:00
|
|
|
done:
|
|
|
|
if (phpage != NULL)
|
|
|
|
HeapFree(GetProcessHeap(), 0, phpage);
|
|
|
|
|
|
|
|
if (hNetShell != NULL)
|
|
|
|
FreeLibrary(hNetShell);
|
|
|
|
|
|
|
|
if (pSetupData != NULL)
|
|
|
|
HeapFree(GetProcessHeap(), 0, pSetupData);
|
2015-12-31 22:17:45 +00:00
|
|
|
|
|
|
|
LogItem(L"END_SECTION", L"InstallWizard");
|
2004-04-16 13:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|