ReactOS 0.4.17-dev-573-g8315b8c
wizard.c File Reference
#include "precomp.h"
#include <stdlib.h>
#include <time.h>
#include <winnls.h>
#include <windowsx.h>
#include <wincon.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <tzlib.h>
#include <strsafe.h>
#include <debug.h>
Include dependency graph for wizard.c:

Go to the source code of this file.

Classes

struct  _REGISTRATIONDATA
 
struct  _TIMEZONE_ENTRY
 
struct  _PRODUCT_OPTION_DATA
 
struct  ThemeInfo
 

Macros

#define NDEBUG
 
#define MAX_LAYOUTS_PER_LANGID   0x10000
 

Typedefs

typedef struct _REGISTRATIONDATA REGISTRATIONDATA
 
typedef struct _REGISTRATIONDATAPREGISTRATIONDATA
 
typedef struct _TIMEZONE_ENTRY TIMEZONE_ENTRY
 
typedef struct _TIMEZONE_ENTRYPTIMEZONE_ENTRY
 
typedef struct _PRODUCT_OPTION_DATA PRODUCT_OPTION_DATA
 
typedef DWORD(WINAPIPFNREQUESTWIZARDPAGES) (PDWORD, HPROPSHEETPAGE *, PSETUPDATA)
 

Functions

void WINAPI Control_RunDLLW (HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
 
VOID GetSetupInfPath (PWSTR szPath, UINT cchMax)
 
static VOID CenterWindow (HWND hWnd)
 
static HFONT CreateTitleFont (VOID)
 
static HFONT CreateBoldFont (VOID)
 
static INT_PTR CALLBACK GplDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK WelcomeDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK AckPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL DoWriteSoundEvents (HKEY hKey, LPCWSTR lpSubkey, LPCWSTR lpEventsArray[][2], DWORD dwSize)
 
static BOOL DoWriteInstallationType (INSTALLATION_TYPE nOption)
 
static void OnChooseInstallationType (HWND hwndDlg, INSTALLATION_TYPE nOption)
 
static INT_PTR CALLBACK InstallTypePageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL WriteOwnerSettings (WCHAR *OwnerName, WCHAR *OwnerOrganization)
 
static INT_PTR CALLBACK OwnerPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL WriteComputerSettings (WCHAR *ComputerName, HWND hwndDlg)
 
static BOOL WriteDefaultLogonData (LPWSTR Domain)
 
static void GenerateComputerName (LPWSTR lpBuffer)
 
static INT_PTR CALLBACK ComputerPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID SetUserLocaleName (HWND hwnd)
 
static VOID SetKeyboardLayoutName (HWND hwnd)
 
static BOOL RunControlPanelApplet (HWND hwnd, PCWSTR pwszCPLParameters)
 
VOID EnableVisualTheme (_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
 
static VOID WriteUserLocale (VOID)
 
static INT_PTR CALLBACK LocalePageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static PTIMEZONE_ENTRY GetLargerTimeZoneEntry (PSETUPDATA SetupData, DWORD Index)
 
static LONG RetrieveTimeZone (IN HKEY hZoneKey, IN PVOID Context)
 
static VOID CreateTimeZoneList (PSETUPDATA SetupData)
 
static VOID DestroyTimeZoneList (PSETUPDATA SetupData)
 
static BOOL HasDaylightSavingTime (PTIMEZONE_ENTRY Entry)
 
static PTIMEZONE_ENTRY GetSelectedTimeZoneEntry (PSETUPDATA SetupData, DWORD dwEntryIndex)
 
static PTIMEZONE_ENTRY GetTimeZoneEntryByIndex (PSETUPDATA SetupData, DWORD dwComboIndex)
 
static VOID UpdateAutoDaylightCheckbox (HWND hwndDlg, PTIMEZONE_ENTRY Entry)
 
static VOID ShowTimeZoneList (HWND hwnd, PSETUPDATA SetupData, DWORD dwEntryIndex)
 
static VOID SetLocalTimeZone (HWND hwnd, PSETUPDATA SetupData)
 
static BOOL GetLocalSystemTime (HWND hwnd, PSETUPDATA SetupData)
 
static BOOL SetSystemLocalTime (HWND hwnd, PSETUPDATA SetupData)
 
static VOID UpdateLocalSystemTime (HWND hwnd, SYSTEMTIME LocalTime)
 
static BOOL WriteDateTimeSettings (HWND hwndDlg, PSETUPDATA SetupData)
 
static INT_PTR CALLBACK DateTimePageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK ThemePageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static UINT CALLBACK RegistrationNotificationProc (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static DWORD RegisterDlls (_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify)
 
static VOID RegisterComponents (PITEMSDATA pItemsData)
 
static VOID SaveSettings (PITEMSDATA pItemsData)
 
static DWORD CALLBACK ItemCompletionThread (LPVOID Parameter)
 
static BOOL RunItemCompletionThread (_In_ HWND hwndDlg)
 
static VOID ShowItemError (HWND hwndDlg, DWORD LastError)
 
static VOID ShowStepError (HWND hwndDlg, PREGISTRATIONNOTIFY RegistrationNotify)
 
static INT_PTR CALLBACK ProcessPageDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID SetInstallationCompleted (IN BOOL Unattended)
 
static INT_PTR CALLBACK FinishDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL GetInstallSourceWin32 (OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
VOID ProcessUnattendSection (IN OUT PSETUPDATA pSetupData)
 
static BOOL PathIsEqual (IN LPCWSTR lpPath1, IN LPCWSTR lpPath2)
 
static VOID AddInstallationSource (IN HKEY hKey, IN LPWSTR lpPath)
 
VOID ProcessSetupInf (IN OUT PSETUPDATA pSetupData)
 
VOID InstallWizard (VOID)
 

Variables

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"
 
static const WCHAR s_szWinlogon [] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
 
static const WCHAR s_szDefaultSoundEvents [] = L"AppEvents\\Schemes\\Apps\\.Default"
 
static const WCHAR s_szExplorerSoundEvents [] = L"AppEvents\\Schemes\\Apps\\Explorer"
 
static const WCHAR s_szCurrentVersion [] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
 
static const PRODUCT_OPTION_DATA s_ProductOptionData [INSTALLATION_TYPE_MAX]
 
static const WCHARInstallationTypes [INSTALLATION_TYPE_MAX]
 
static const WCHARs_DefaultSoundEvents [][2]
 
static const WCHARs_ExplorerSoundEvents [][2]
 
static struct ThemeInfo Themes []
 

Macro Definition Documentation

◆ MAX_LAYOUTS_PER_LANGID

#define MAX_LAYOUTS_PER_LANGID   0x10000

◆ NDEBUG

#define NDEBUG

Definition at line 28 of file wizard.c.

Typedef Documentation

◆ PFNREQUESTWIZARDPAGES

typedef DWORD(WINAPI * PFNREQUESTWIZARDPAGES) (PDWORD, HPROPSHEETPAGE *, PSETUPDATA)

Definition at line 3470 of file wizard.c.

◆ PREGISTRATIONDATA

◆ PRODUCT_OPTION_DATA

◆ PTIMEZONE_ENTRY

◆ REGISTRATIONDATA

◆ TIMEZONE_ENTRY

Function Documentation

◆ AckPageDlgProc()

static INT_PTR CALLBACK AckPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 294 of file wizard.c.

298{
299 LPNMHDR lpnm;
300 PWCHAR Projects;
301 PWCHAR End, CurrentProject;
302 INT ProjectsSize, ProjectsCount;
303 PSETUPDATA pSetupData;
304
305 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
306
307 switch (uMsg)
308 {
309 case WM_INITDIALOG:
310 {
311 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
312 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
313
314 Projects = NULL;
315 ProjectsSize = 256;
316 while (TRUE)
317 {
318 Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR));
319 if (NULL == Projects)
320 {
321 return FALSE;
322 }
323 ProjectsCount = LoadStringW(hDllInstance, IDS_ACKPROJECTS, Projects, ProjectsSize);
324 if (0 == ProjectsCount)
325 {
326 HeapFree(GetProcessHeap(), 0, Projects);
327 return FALSE;
328 }
329 if (ProjectsCount < ProjectsSize - 1)
330 {
331 break;
332 }
333 HeapFree(GetProcessHeap(), 0, Projects);
334 ProjectsSize *= 2;
335 }
336
337 CurrentProject = Projects;
338 while (*CurrentProject != L'\0')
339 {
340 End = wcschr(CurrentProject, L'\n');
341 if (NULL != End)
342 {
343 *End = L'\0';
344 }
345 (void)ListBox_AddString(GetDlgItem(hwndDlg, IDC_PROJECTS), CurrentProject);
346 if (NULL != End)
347 {
348 CurrentProject = End + 1;
349 }
350 else
351 {
352 CurrentProject += wcslen(CurrentProject);
353 }
354 }
355 HeapFree(GetProcessHeap(), 0, Projects);
356 }
357 break;
358
359 case WM_COMMAND:
361 {
364 }
365 break;
366
367 case WM_NOTIFY:
368 {
369 lpnm = (LPNMHDR)lParam;
370
371 switch (lpnm->code)
372 {
373 case PSN_SETACTIVE:
374 /* Enable the Back and Next buttons */
376 if (pSetupData->UnattendSetup)
377 {
379 return TRUE;
380 }
381 break;
382
383 case PSN_WIZBACK:
384 pSetupData->UnattendSetup = FALSE;
385 break;
386
387 default:
388 break;
389 }
390 }
391 break;
392
393 default:
394 break;
395 }
396
397 return FALSE;
398}
struct _SETUPDATA * PSETUPDATA
static HINSTANCE hDllInstance
Definition: clb.c:9
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define IDC_VIEWGPL
Definition: resource.h:46
#define IDD_INSTALLATION
Definition: resource.h:112
#define IDD_GPL
Definition: resource.h:95
#define IDC_PROJECTS
Definition: resource.h:45
#define IDS_ACKPROJECTS
Definition: resource.h:140
#define L(x)
Definition: resources.c:13
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
#define PSWIZB_NEXT
Definition: prsht.h:154
#define PSWIZB_BACK
Definition: prsht.h:153
#define PropSheet_SetWizButtons(d, f)
Definition: prsht.h:357
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PSN_WIZBACK
Definition: prsht.h:120
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
#define LoadStringW
Definition: utils.h:64
BOOL UnattendSetup
Definition: syssetup.h:50
UINT code
Definition: winuser.h:3267
static INT_PTR CALLBACK GplDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:130
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
#define ListBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:472
#define DWLP_USER
Definition: winuser.h:883
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1767
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct tagNMHDR * LPNMHDR
HWND WINAPI GetParent(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define BN_CLICKED
Definition: winuser.h:1954
#define DialogBox
Definition: winuser.h:5927

Referenced by InstallWizard().

◆ AddInstallationSource()

static VOID AddInstallationSource ( IN HKEY  hKey,
IN LPWSTR  lpPath 
)
static

Definition at line 3248 of file wizard.c.

3251{
3252 LONG res;
3253 DWORD dwRegType;
3254 DWORD dwPathLength = 0;
3255 DWORD dwNewLength = 0;
3256 LPWSTR Buffer = NULL;
3257 LPWSTR Path;
3258
3260 hKey,
3261 L"Installation Sources",
3262 NULL,
3263 &dwRegType,
3264 NULL,
3265 &dwPathLength);
3266
3267 if (res != ERROR_SUCCESS ||
3268 dwRegType != REG_MULTI_SZ ||
3269 dwPathLength == 0 ||
3270 dwPathLength % sizeof(WCHAR) != 0)
3271 {
3272 dwPathLength = 0;
3273 goto set;
3274 }
3275
3276 /* Reserve space for existing data + new string */
3277 dwNewLength = dwPathLength + (wcslen(lpPath) + 1) * sizeof(WCHAR);
3278 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3279 if (!Buffer)
3280 return;
3281
3282 ZeroMemory(Buffer, dwNewLength);
3283
3285 hKey,
3286 L"Installation Sources",
3287 NULL,
3288 NULL,
3289 (LPBYTE)Buffer,
3290 &dwPathLength);
3291
3292 if (res != ERROR_SUCCESS)
3293 {
3295 dwPathLength = 0;
3296 goto set;
3297 }
3298
3299 /* Sanity check, these should already be zeros */
3300 Buffer[dwPathLength / sizeof(WCHAR) - 2] = UNICODE_NULL;
3301 Buffer[dwPathLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3302
3303 for (Path = Buffer; *Path; Path += wcslen(Path) + 1)
3304 {
3305 /* Check if path is already added */
3306 if (PathIsEqual(Path, lpPath))
3307 goto cleanup;
3308 }
3309
3310 Path = Buffer + dwPathLength / sizeof(WCHAR) - 1;
3311
3312set:
3313 if (dwPathLength == 0)
3314 {
3315 dwNewLength = (wcslen(lpPath) + 1 + 1) * sizeof(WCHAR);
3316 Buffer = HeapAlloc(GetProcessHeap(), 0, dwNewLength);
3317 if (!Buffer)
3318 return;
3319
3320 Path = Buffer;
3321 }
3322
3323 StringCbCopyW(Path, dwNewLength - (Path - Buffer) * sizeof(WCHAR), lpPath);
3324 Buffer[dwNewLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
3325
3327 hKey,
3328 L"Installation Sources",
3329 0,
3331 (LPBYTE)Buffer,
3332 dwNewLength);
3333
3334cleanup:
3336}
PRTL_UNICODE_STRING_BUFFER Path
Definition: bufpool.h:45
Definition: _set.h:50
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static void cleanup(void)
Definition: main.c:1335
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint res
Definition: glext.h:9613
#define ZeroMemory
Definition: minwinbase.h:31
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
static BOOL PathIsEqual(IN LPCWSTR lpPath1, IN LPCWSTR lpPath2)
Definition: wizard.c:3222
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by ProcessSetupInf().

◆ CenterWindow()

static VOID CenterWindow ( HWND  hWnd)
static

Definition at line 64 of file wizard.c.

65{
67 RECT rcParent;
68 RECT rcWindow;
69
71 if (hWndParent == NULL)
73
74 GetWindowRect(hWndParent, &rcParent);
75 GetWindowRect(hWnd, &rcWindow);
76
79 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
80 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
81 0,
82 0,
84}
HWND hWnd
Definition: settings.c:17
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define HWND_TOP
Definition: winuser.h:1218

◆ ComputerPageDlgProc()

static INT_PTR CALLBACK ComputerPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1129 of file wizard.c.

1133{
1134 WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1135 WCHAR Password1[128];
1136 WCHAR Password2[128];
1138 WCHAR Title[64];
1139 WCHAR EmptyComputerName[256], NotMatchPassword[256], WrongPassword[256];
1140 LPNMHDR lpnm;
1141 PSETUPDATA pSetupData;
1142
1143 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
1144
1146 {
1147 wcscpy(Title, L"ReactOS Setup");
1148 }
1149
1150 switch (uMsg)
1151 {
1152 case WM_INITDIALOG:
1153 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1154 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
1155
1156 /* Generate a new pseudo-random computer name */
1157 GenerateComputerName(ComputerName);
1158
1159 /* Display current computer name */
1160 SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName);
1161
1162 /* Set text limits */
1166
1167 /* Set focus to computer name */
1169 if (pSetupData->UnattendSetup)
1170 {
1171 /* "*" means use random name (we have already generated it above) */
1172 if (pSetupData->ComputerName[0] == L'*' && !pSetupData->ComputerName[1])
1173 wcscpy(pSetupData->ComputerName, ComputerName);
1174 else
1175 SetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, pSetupData->ComputerName);
1176 SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, pSetupData->AdminPassword);
1177 SetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, pSetupData->AdminPassword);
1180 }
1181
1182 /* Store the administrator account name as the default user name */
1184 break;
1185
1186
1187 case WM_NOTIFY:
1188 {
1189 lpnm = (LPNMHDR)lParam;
1190
1191 switch (lpnm->code)
1192 {
1193 case PSN_SETACTIVE:
1194 /* Enable the Back and Next buttons */
1196 if (pSetupData->UnattendSetup && WriteComputerSettings(pSetupData->ComputerName, hwndDlg))
1197 {
1199 return TRUE;
1200 }
1201 break;
1202
1203 case PSN_WIZNEXT:
1204 if (0 == GetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName, MAX_COMPUTERNAME_LENGTH + 1))
1205 {
1206 if (0 == LoadStringW(hDllInstance, IDS_WZD_COMPUTERNAME, EmptyComputerName,
1207 ARRAYSIZE(EmptyComputerName)))
1208 {
1209 wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer.");
1210 }
1211 MessageBoxW(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK);
1213 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1214 return TRUE;
1215 }
1216
1217 /* No need to check computer name for invalid characters,
1218 * SetComputerName() will do it for us */
1219
1220 if (!WriteComputerSettings(ComputerName, hwndDlg))
1221 {
1223 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1224 return TRUE;
1225 }
1226
1227#ifdef PASSWORDS_MANDATORY
1228 /* Check if admin passwords have been entered */
1229 if ((GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128) == 0) ||
1230 (GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128) == 0))
1231 {
1232 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDEMPTY, EmptyPassword,
1233 ARRAYSIZE(EmptyPassword)))
1234 {
1235 wcscpy(EmptyPassword, L"You must enter a password !");
1236 }
1237 MessageBoxW(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK);
1238 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1239 return TRUE;
1240 }
1241#else
1242 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD1, Password1, 128);
1243 GetDlgItemTextW(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128);
1244#endif
1245 /* Check if passwords match */
1246 if (wcscmp(Password1, Password2))
1247 {
1248 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDMATCH, NotMatchPassword,
1249 ARRAYSIZE(NotMatchPassword)))
1250 {
1251 wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again.");
1252 }
1253 MessageBoxW(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK);
1254 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1255 return TRUE;
1256 }
1257
1258 /* Check password for invalid characters */
1259 Password = (PWCHAR)Password1;
1260 while (*Password)
1261 {
1262 if (!isprint(*Password))
1263 {
1264 if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDCHAR, WrongPassword,
1265 ARRAYSIZE(WrongPassword)))
1266 {
1267 wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password.");
1268 }
1269 MessageBoxW(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK);
1270 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
1271 return TRUE;
1272 }
1273 Password++;
1274 }
1275
1276 /* Set admin password */
1277 SetAdministratorPassword(Password1);
1278 break;
1279
1280 case PSN_WIZBACK:
1281 pSetupData->UnattendSetup = FALSE;
1282 break;
1283
1284 default:
1285 break;
1286 }
1287 }
1288 break;
1289
1290 default:
1291 break;
1292 }
1293
1294 return FALSE;
1295}
#define isprint(c)
Definition: acclib.h:73
static CHAR Title[MAX_PATH]
Definition: dem.c:257
#define IDD_DATETIMEPAGE
Definition: resource.h:5
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IDS_REACTOS_SETUP
Definition: resource.h:138
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
#define IDC_COMPUTERNAME
Definition: resource.h:15
NTSTATUS SetAdministratorPassword(LPCWSTR Password)
Definition: security.c:1692
#define IDC_ADMINPASSWORD2
Definition: resource.h:55
#define IDS_WZD_COMPUTERNAME
Definition: resource.h:155
#define IDS_WZD_PASSWORDMATCH
Definition: resource.h:157
#define IDS_WZD_PASSWORDCHAR
Definition: resource.h:158
#define IDS_WZD_PASSWORDEMPTY
Definition: resource.h:156
#define IDC_ADMINPASSWORD1
Definition: resource.h:54
#define PSN_WIZNEXT
Definition: prsht.h:121
wcscpy
WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH+1]
Definition: syssetup.h:48
WCHAR AdminPassword[128]
Definition: syssetup.h:49
static BOOL WriteDefaultLogonData(LPWSTR Domain)
Definition: wizard.c:1059
static void GenerateComputerName(LPWSTR lpBuffer)
Definition: wizard.c:1111
static BOOL WriteComputerSettings(WCHAR *ComputerName, HWND hwndDlg)
Definition: wizard.c:988
@ Password
Definition: telnetd.h:67
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:268
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define GetDlgItemText
Definition: winuser.h:5951
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:798
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MB_OK
Definition: winuser.h:801
#define SendDlgItemMessage
Definition: winuser.h:6008

Referenced by InstallWizard().

◆ Control_RunDLLW()

void WINAPI Control_RunDLLW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 1177 of file control.c.

1178{
1179 CPanel panel;
1180
1181 TRACE("(%p, %p, %s, 0x%08x)\n",
1182 hWnd, hInst, debugstr_w(cmd), nCmdShow);
1183
1184#ifndef __REACTOS__
1185 memset(&panel, 0, sizeof(panel));
1186 list_init( &panel.applets );
1187#endif
1188
1189 if (!cmd || !*cmd) {
1190 Control_DoWindow(&panel, hWnd, hInst);
1191 } else {
1192 Control_DoLaunch(&panel, hWnd, cmd);
1193 }
1194}
static void list_init(struct list_entry *head)
Definition: list.h:51
static void Control_DoWindow(CPanel *panel, HWND hWnd, HINSTANCE hInst)
Definition: control.c:703
static void Control_DoLaunch(CPanel *panel, HWND hWnd, LPCWSTR wszCmd)
Definition: control.c:867
HINSTANCE hInst
Definition: dxdiag.c:13
#define debugstr_w
Definition: kernel32.h:32
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cpanel.h:56
struct list applets
Definition: cpanel.h:57
Definition: ftp_var.h:139

◆ CreateBoldFont()

static HFONT CreateBoldFont ( VOID  )
static

Definition at line 109 of file wizard.c.

110{
111 LOGFONTW tmpFont = {0};
112 HFONT hBoldFont;
113 HDC hDc;
114
115 /* Grabs the Drawing Context */
116 hDc = GetDC(NULL);
117
118 tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDc, LOGPIXELSY), 72);
119 tmpFont.lfWeight = FW_BOLD;
120 wcscpy(tmpFont.lfFaceName, L"MS Shell Dlg");
121
122 hBoldFont = CreateFontIndirectW(&tmpFont);
123
124 ReleaseDC(NULL, hDc);
125
126 return hBoldFont;
127}
static HDC
Definition: imagelist.c:88
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by InstallWizard().

◆ CreateTimeZoneList()

static VOID CreateTimeZoneList ( PSETUPDATA  SetupData)
static

Definition at line 1747 of file wizard.c.

1748{
1750}
SETUPDATA SetupData
Definition: reactos.c:24
static LONG RetrieveTimeZone(IN HKEY hZoneKey, IN PVOID Context)
Definition: wizard.c:1666
VOID EnumerateTimeZoneList(IN PENUM_TIMEZONE_CALLBACK Callback, IN PVOID Context OPTIONAL)
Definition: tzlib.c:223

Referenced by DateTimePageDlgProc().

◆ CreateTitleFont()

static HFONT CreateTitleFont ( VOID  )
static

Definition at line 88 of file wizard.c.

89{
90 LOGFONTW LogFont = {0};
91 HDC hdc;
92 HFONT hFont;
93
94 LogFont.lfWeight = FW_BOLD;
95 wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
96
97 hdc = GetDC(NULL);
98 LogFont.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72);
99
100 hFont = CreateFontIndirectW(&LogFont);
101
103
104 return hFont;
105}
HFONT hFont
Definition: main.c:53
HDC hdc
Definition: main.c:9

◆ DateTimePageDlgProc()

static INT_PTR CALLBACK DateTimePageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1980 of file wizard.c.

1984{
1986
1987 /* Retrieve pointer to the global setup data */
1989
1990 switch (uMsg)
1991 {
1992 case WM_INITDIALOG:
1993 {
1994 DWORD dwEntryIndex;
1996
1997 /* Save pointer to the global setup data */
2000
2002
2004 {
2007
2010 {
2013 }
2014 else
2015 {
2018 }
2019 }
2020 else
2021 {
2022 /* Get the default time zone index from the registry */
2023 dwEntryIndex = (DWORD)-1;
2024 GetTimeZoneListIndex(&dwEntryIndex);
2025
2027 SetupData, -1);
2028
2029 /* Set the auto-daylight checkbox based on whether
2030 * the selected timezone observes DST */
2031 Entry = GetSelectedTimeZoneEntry(SetupData, dwEntryIndex);
2033 }
2034 break;
2035 }
2036
2037 case WM_TIMER:
2038 {
2039 SYSTEMTIME LocalTime;
2040
2041 GetLocalTime(&LocalTime);
2042 UpdateLocalSystemTime(hwndDlg, LocalTime);
2043
2044 // Reset timeout.
2045 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
2046 break;
2047 }
2048
2049 case WM_COMMAND:
2051 {
2052 /* User changed the timezone selection */
2053 DWORD dwIndex = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TIMEZONELIST, CB_GETCURSEL, 0, 0);
2056 }
2057 break;
2058
2059 case WM_NOTIFY:
2060 switch (((LPNMHDR)lParam)->code)
2061 {
2062 case PSN_SETACTIVE:
2063 {
2064 SYSTEMTIME LocalTime;
2065
2066 GetLocalTime(&LocalTime);
2067 UpdateLocalSystemTime(hwndDlg, LocalTime);
2068
2069 /* Enable the Back and Next buttons */
2071
2073 {
2075 return TRUE;
2076 }
2077
2078 SetTimer(hwndDlg, 1, 1000 - LocalTime.wMilliseconds, NULL);
2079 break;
2080 }
2081
2082 case PSN_KILLACTIVE:
2083 case DTN_DATETIMECHANGE:
2084 // NB: Not re-set until changing page (PSN_SETACTIVE).
2085 KillTimer(hwndDlg, 1);
2086 break;
2087
2088 case PSN_WIZNEXT:
2090 break;
2091
2092 case PSN_WIZBACK:
2094 break;
2095
2096 default:
2097 break;
2098 }
2099 break;
2100
2101 case WM_DESTROY:
2103 break;
2104
2105 default:
2106 break;
2107 }
2108
2109 return FALSE;
2110}
#define IDC_TIMEZONELIST
Definition: resource.h:16
#define IDC_AUTODAYLIGHT
Definition: resource.h:17
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:272
#define IDD_THEMEPAGE
Definition: resource.h:92
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
UINT_PTR WPARAM
Definition: minwindef.h:174
#define DWORD
Definition: nt_native.h:44
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define DTN_DATETIMECHANGE
Definition: commctrl.h:4371
Entry
Definition: section.c:5216
DWORD TimeZoneIndex
Definition: syssetup.h:56
DWORD DisableAutoDaylightTimeSet
Definition: syssetup.h:57
WORD wMilliseconds
Definition: minwinbase.h:263
Definition: timezone.c:16
Definition: inflate.c:139
static VOID CreateTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1747
static VOID UpdateLocalSystemTime(HWND hwnd, SYSTEMTIME LocalTime)
Definition: wizard.c:1941
static BOOL WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
Definition: wizard.c:1949
static VOID DestroyTimeZoneList(PSETUPDATA SetupData)
Definition: wizard.c:1753
static PTIMEZONE_ENTRY GetSelectedTimeZoneEntry(PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1784
static PTIMEZONE_ENTRY GetTimeZoneEntryByIndex(PSETUPDATA SetupData, DWORD dwComboIndex)
Definition: wizard.c:1798
static BOOL HasDaylightSavingTime(PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1775
static VOID UpdateAutoDaylightCheckbox(HWND hwndDlg, PTIMEZONE_ENTRY Entry)
Definition: wizard.c:1809
static VOID ShowTimeZoneList(HWND hwnd, PSETUPDATA SetupData, DWORD dwEntryIndex)
Definition: wizard.c:1822
#define GWLP_USERDATA
Definition: treelist.c:63
uint32_t DWORD_PTR
Definition: typedefs.h:65
BOOL GetTimeZoneListIndex(IN OUT PULONG pIndex)
Definition: tzlib.c:20
#define BST_UNCHECKED
Definition: winuser.h:199
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define BM_SETCHECK
Definition: winuser.h:1950
#define WM_TIMER
Definition: winuser.h:1770
#define WM_DESTROY
Definition: winuser.h:1637
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define CB_GETCURSEL
Definition: winuser.h:1972
#define BST_CHECKED
Definition: winuser.h:197

Referenced by InstallWizard().

◆ DestroyTimeZoneList()

static VOID DestroyTimeZoneList ( PSETUPDATA  SetupData)
static

Definition at line 1753 of file wizard.c.

1754{
1756
1757 while (SetupData->TimeZoneListHead != NULL)
1758 {
1760
1763 {
1765 }
1766
1768 }
1769
1771}
struct _TIMEZONE_ENTRY * TimeZoneListHead
Definition: syssetup.h:54
struct _TIMEZONE_ENTRY * TimeZoneListTail
Definition: syssetup.h:55

Referenced by DateTimePageDlgProc().

◆ DoWriteInstallationType()

static BOOL DoWriteInstallationType ( INSTALLATION_TYPE  nOption)
static

Definition at line 553 of file wizard.c.

554{
555 HKEY hKey;
556 LONG error;
557 LPCWSTR pszData;
558 DWORD dwValue, cbData;
560 ASSERT(0 <= nOption && nOption < INSTALLATION_TYPE_MAX);
561
562 /* open ProductOptions key */
564 if (error)
565 {
566 DPRINT1("RegOpenKeyExW failed\n");
567 goto Error;
568 }
569
570 /* write ProductSuite */
571 pszData = pData->ProductSuite;
572 cbData = (lstrlenW(pszData) + 2) * sizeof(WCHAR);
573 error = RegSetValueExW(hKey, L"ProductSuite", 0, REG_MULTI_SZ, (const BYTE *)pszData, cbData);
574 if (error)
575 {
576 DPRINT1("RegSetValueExW failed\n");
577 goto Error;
578 }
579
580 /* write ProductType */
581 pszData = pData->ProductType;
582 cbData = (lstrlenW(pszData) + 1) * sizeof(WCHAR);
583 error = RegSetValueExW(hKey, L"ProductType", 0, REG_SZ, (const BYTE *)pszData, cbData);
584 if (error)
585 {
586 DPRINT1("RegSetValueExW failed\n");
587 goto Error;
588 }
589
591
592 /* open ReactOS version key */
594 if (error)
595 {
596 DPRINT1("RegOpenKeyExW failed\n");
597 goto Error;
598 }
599
600 /* write ReportAsWorkstation */
601 dwValue = pData->ReportAsWorkstation;
602 cbData = sizeof(dwValue);
603 error = RegSetValueExW(hKey, L"ReportAsWorkstation", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
604 if (error)
605 {
606 DPRINT1("RegSetValueExW failed\n");
607 goto Error;
608 }
609
611
612 /* open Control Windows key */
614 if (error)
615 {
616 DPRINT1("RegOpenKeyExW failed\n");
617 goto Error;
618 }
619
620 /* write Control Windows CSDVersion */
621 dwValue = pData->CSDVersion;
622 cbData = sizeof(dwValue);
623 error = RegSetValueExW(hKey, L"CSDVersion", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
624 if (error)
625 {
626 DPRINT1("RegSetValueExW failed\n");
627 goto Error;
628 }
629
631
632 /* open Winlogon key */
634 if (error)
635 {
636 DPRINT1("RegOpenKeyExW failed\n");
637 goto Error;
638 }
639
640 /* write LogonType */
641 dwValue = pData->LogonType;
642 cbData = sizeof(dwValue);
643 error = RegSetValueExW(hKey, L"LogonType", 0, REG_DWORD, (const BYTE *)&dwValue, cbData);
644 if (error)
645 {
646 DPRINT1("RegSetValueExW failed\n");
647 goto Error;
648 }
649
650 if (nOption == INSTALLATION_TYPE_WORKSTATION)
651 {
652 /* Write system sound events values for Workstation */
655 }
656
657 if (nOption == INSTALLATION_TYPE_SERVER_CORE)
658 {
659 /* Set the shell to command prompt */
660 WCHAR szShell[] = L"cmd.exe";
661 cbData = sizeof(szShell);
662 error = RegSetValueExW(hKey, L"Shell", 0, REG_SZ, (const BYTE *)szShell, cbData);
663 if (error)
664 {
665 DPRINT1("RegSetValueExW failed\n");
666 goto Error;
667 }
668 }
669
670 /* Open InstallationType key and write InstallationType value */
672 if (error)
673 {
674 DPRINT1("RegOpenKeyExW failed\n");
675 goto Error;
676 }
677
678 cbData = (DWORD)((wcslen(InstallationTypes[nOption]) + 1) * sizeof(WCHAR));
679 error = RegSetValueExW(hKey, L"InstallationType", 0, REG_SZ, (const BYTE *)InstallationTypes[nOption], cbData);
680 if (error)
681 {
682 DPRINT1("RegSetValueExW failed\n");
683 goto Error;
684 }
685
686Error:
687 if (hKey)
689
690 return error == ERROR_SUCCESS;
691}
#define DPRINT1
Definition: precomp.h:8
BOOL Error
Definition: chkdsk.c:66
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define lstrlenW
Definition: compat.h:750
#define REG_SZ
Definition: layer.c:22
#define error(str)
Definition: mkdosfs.c:1605
#define ASSERT(a)
Definition: mode.c:44
#define KEY_WRITE
Definition: nt_native.h:1034
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define REG_DWORD
Definition: sdbapi.c:615
#define _countof(array)
Definition: sndvol32.h:70
static const WCHAR * s_ExplorerSoundEvents[][2]
Definition: wizard.c:463
static BOOL DoWriteSoundEvents(HKEY hKey, LPCWSTR lpSubkey, LPCWSTR lpEventsArray[][2], DWORD dwSize)
Definition: wizard.c:470
static const WCHAR s_szRosVersion[]
Definition: wizard.c:401
static const WCHAR * InstallationTypes[INSTALLATION_TYPE_MAX]
Definition: wizard.c:425
static const WCHAR s_szWinlogon[]
Definition: wizard.c:403
static const PRODUCT_OPTION_DATA s_ProductOptionData[INSTALLATION_TYPE_MAX]
Definition: wizard.c:417
static const WCHAR * s_DefaultSoundEvents[][2]
Definition: wizard.c:433
static const WCHAR s_szCurrentVersion[]
Definition: wizard.c:406
static const WCHAR s_szExplorerSoundEvents[]
Definition: wizard.c:405
static const WCHAR s_szProductOptions[]
Definition: wizard.c:400
static const WCHAR s_szControlWindows[]
Definition: wizard.c:402
static const WCHAR s_szDefaultSoundEvents[]
Definition: wizard.c:404
@ INSTALLATION_TYPE_SERVER_CORE
Definition: syssetup.h:30
@ INSTALLATION_TYPE_WORKSTATION
Definition: syssetup.h:29
@ INSTALLATION_TYPE_MAX
Definition: syssetup.h:32
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
unsigned char BYTE
Definition: xxhash.c:193

Referenced by InstallTypePageDlgProc().

◆ DoWriteSoundEvents()

static BOOL DoWriteSoundEvents ( HKEY  hKey,
LPCWSTR  lpSubkey,
LPCWSTR  lpEventsArray[][2],
DWORD  dwSize 
)
static

Definition at line 470 of file wizard.c.

474{
475 HKEY hRootKey, hEventKey, hDefaultKey;
476 LONG error;
477 ULONG i;
478 WCHAR szDest[MAX_PATH];
479 DWORD dwAttribs;
481
482 /* Open the sound events key */
483 error = RegOpenKeyExW(hKey, lpSubkey, 0, KEY_READ, &hRootKey);
484 if (error)
485 {
486 DPRINT1("RegOpenKeyExW failed\n");
487 goto Error;
488 }
489
490 /* Set each sound event */
491 for (i = 0; i < dwSize; i++)
492 {
493 /*
494 * Verify that the sound file exists and is an actual file.
495 */
496
497 /* Expand the sound file path */
498 if (!ExpandEnvironmentStringsW(lpEventsArray[i][1], szDest, _countof(szDest)))
499 {
500 /* Failed to expand, continue with the next sound event */
501 continue;
502 }
503
504 /* Check if the sound file exists and isn't a directory */
505 dwAttribs = GetFileAttributesW(szDest);
506 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
507 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
508 {
509 /* It does not, just continue with the next sound event */
510 continue;
511 }
512
513 /*
514 * Create the sound event entry.
515 */
516
517 /* Open the sound event subkey */
518 error = RegOpenKeyExW(hRootKey, lpEventsArray[i][0], 0, KEY_READ, &hEventKey);
519 if (error)
520 {
521 /* Failed to open, continue with next sound event */
522 continue;
523 }
524
525 /* Open .Default subkey */
526 error = RegOpenKeyExW(hEventKey, L".Default", 0, KEY_WRITE, &hDefaultKey);
527 RegCloseKey(hEventKey);
528 if (error)
529 {
530 /* Failed to open, continue with next sound event */
531 continue;
532 }
533
534 /* Associate the sound file to this sound event */
535 cbData = (lstrlenW(lpEventsArray[i][1]) + 1) * sizeof(WCHAR);
536 error = RegSetValueExW(hDefaultKey, NULL, 0, REG_EXPAND_SZ, (const BYTE *)lpEventsArray[i][1], cbData);
537 RegCloseKey(hDefaultKey);
538 if (error)
539 {
540 /* Failed to set the value, continue with next sound event */
541 continue;
542 }
543 }
544
545Error:
546 if (hRootKey)
547 RegCloseKey(hRootKey);
548
549 return error == ERROR_SUCCESS;
550}
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1026
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
uint32_t ULONG
Definition: typedefs.h:59
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by DoWriteInstallationType().

◆ EnableVisualTheme()

VOID EnableVisualTheme ( _In_opt_ HWND  hwndParent,
_In_opt_ PCWSTR  ThemeFile 
)

Definition at line 1460 of file wizard.c.

1463{
1464 enum { THEME_FILE, STYLE_FILE, UNKNOWN } fType;
1465 WCHAR szPath[MAX_PATH]; // Expanded path of the file to use.
1466 WCHAR szStyleFile[MAX_PATH];
1467
1468 fType = THEME_FILE; // Default to Classic theme.
1469 if (ThemeFile)
1470 {
1471 /* Expand the path if possible */
1472 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1473 ThemeFile = szPath;
1474
1475 /* Determine the file type from its extension */
1476 fType = UNKNOWN; {
1477 PCWSTR pszExt = wcsrchr(ThemeFile, L'.'); // PathFindExtensionW(ThemeFile);
1478 if (pszExt)
1479 {
1480 if (_wcsicmp(pszExt, L".theme") == 0)
1481 fType = THEME_FILE;
1482 else if (_wcsicmp(pszExt, L".msstyles") == 0)
1483 fType = STYLE_FILE;
1484 } }
1485 if (fType == UNKNOWN)
1486 {
1487 DPRINT1("EnableVisualTheme(): Unknown file '%S'\n", ThemeFile);
1488 return;
1489 }
1490 }
1491
1492 DPRINT1("Applying visual %s '%S'\n",
1493 (fType == THEME_FILE) ? "theme" : "style",
1494 ThemeFile ? ThemeFile : L"(Classic)");
1495
1496//
1497// TODO: Use instead uxtheme!SetSystemVisualStyle() once it is implemented,
1498// https://stackoverflow.com/a/1036903
1499// https://pinvoke.net/default.aspx/uxtheme.SetSystemVisualStyle
1500// or ApplyTheme(NULL, 0, NULL) for restoring the classic theme.
1501//
1502// NOTE: The '/Action:ActivateMSTheme' is ReactOS-specific.
1503//
1504
1505 if (ThemeFile && (fType == THEME_FILE))
1506 {
1507 /* Retrieve the visual style specified in the theme file.
1508 * If none, fall back to the classic theme. */
1509 if (GetPrivateProfileStringW(L"VisualStyles", L"Path", NULL,
1510 szStyleFile, _countof(szStyleFile), ThemeFile) && *szStyleFile)
1511 {
1512 /* Expand the path if possible */
1513 ThemeFile = szStyleFile;
1514 if (ExpandEnvironmentStringsW(ThemeFile, szPath, _countof(szPath)) != 0)
1515 ThemeFile = szPath;
1516 }
1517 else
1518 {
1519 ThemeFile = NULL;
1520 }
1521
1522 DPRINT1("--> Applying visual style '%S'\n",
1523 ThemeFile ? ThemeFile : L"(Classic)");
1524 }
1525
1526 if (ThemeFile)
1527 {
1528 WCHAR wszParams[1024];
1529 // FIXME: L"desk.cpl desk,@Appearance" regression, see commit 50d260a7f0
1530 PCWSTR format = L"desk.cpl,,2 /Action:ActivateMSTheme /file:\"%s\"";
1531
1532 StringCchPrintfW(wszParams, _countof(wszParams), format, ThemeFile);
1534 }
1535 else
1536 {
1537 RunControlPanelApplet(hwndParent, L"desk.cpl,,2 /Action:ActivateMSTheme");
1538 }
1539}
static HWND hwndParent
Definition: cryptui.c:299
#define wcsrchr
Definition: compat.h:16
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
void * UNKNOWN
Definition: ks.h:2676
LPCWSTR szPath
Definition: env.c:37
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
Definition: format.c:58
static BOOL RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters)
Definition: wizard.c:1398
const uint16_t * PCWSTR
Definition: typedefs.h:57
struct _THEME_FILE THEME_FILE

Referenced by PreprocessUnattend(), and ThemePageDlgProc().

◆ FinishDlgProc()

static INT_PTR CALLBACK FinishDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2786 of file wizard.c.

2790{
2791 switch (uMsg)
2792 {
2793 case WM_INITDIALOG:
2794 {
2795 /* Get pointer to the global setup data */
2797
2798 /* Set title font */
2799 SendDlgItemMessage(hwndDlg,
2801 WM_SETFONT,
2803 (LPARAM)TRUE);
2805 {
2806 KillTimer(hwndDlg, 1);
2808 PostQuitMessage(0);
2809 }
2810
2811 /* Ensure that the installer wizard window is made visible and focused */
2812 ShowWindow(GetParent(hwndDlg), SW_SHOW);
2814 break;
2815 }
2816
2817 case WM_DESTROY:
2818 {
2820 PostQuitMessage(0);
2821 return TRUE;
2822 }
2823
2824 case WM_TIMER:
2825 {
2826 HWND hWndProgress;
2827 INT Position;
2828
2829 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2830 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2831 if (Position == 300)
2832 {
2833 KillTimer(hwndDlg, 1);
2835 }
2836 else
2837 {
2838 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2839 }
2840 return TRUE;
2841 }
2842
2843 case WM_NOTIFY:
2844 {
2845 LPNMHDR lpnm = (LPNMHDR)lParam;
2846
2847 switch (lpnm->code)
2848 {
2849 case PSN_SETACTIVE:
2850 {
2851 HWND hWndParent = GetParent(hwndDlg);
2852
2853 /* Only "Finish" for closing the wizard, and hide "Back" and "Next" */
2855 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2858
2859 /* Set up the reboot progress bar and countdown timer.
2860 * 300 steps at 50 ms each: 15 seconds */
2863 SetTimer(hwndDlg, 1, 50, NULL);
2864 break;
2865 }
2866
2867 case PSN_WIZFINISH:
2868 DestroyWindow(GetParent(hwndDlg));
2869 break;
2870
2871 default:
2872 break;
2873 }
2874 break;
2875 }
2876
2877 default:
2878 break;
2879 }
2880
2881 return FALSE;
2882}
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
#define ID_WIZNEXT
Definition: reactos.h:47
#define ID_WIZBACK
Definition: reactos.h:46
#define IDC_FINISHTITLE
Definition: resource.h:75
#define IDC_RESTART_PROGRESS
Definition: resource.h:77
LONG_PTR LPARAM
Definition: minwindef.h:175
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
#define PSWIZB_FINISH
Definition: prsht.h:155
#define PSBTN_FINISH
Definition: prsht.h:148
#define PSN_WIZFINISH
Definition: prsht.h:122
#define PBM_GETPOS
Definition: commctrl.h:2199
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_SETRANGE
Definition: commctrl.h:2188
HFONT hTitleFont
Definition: reactos.h:131
static COORD Position
Definition: mouse.c:34
static VOID SetInstallationCompleted(IN BOOL Unattended)
Definition: wizard.c:2750
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
#define SW_HIDE
Definition: winuser.h:779
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SETFONT
Definition: winuser.h:1678
#define SW_SHOW
Definition: winuser.h:786
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ GenerateComputerName()

static void GenerateComputerName ( LPWSTR  lpBuffer)
static

Definition at line 1111 of file wizard.c.

1112{
1113 static const WCHAR Chars[] = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1114 static const unsigned cChars = sizeof(Chars) / sizeof(WCHAR) - 1;
1115 unsigned i;
1116
1117 wcscpy(lpBuffer, L"REACTOS-");
1118
1120
1121 /* fill in 7 characters */
1122 for (i = 8; i < 15; i++)
1123 lpBuffer[i] = Chars[rand() % cChars];
1124
1125 lpBuffer[15] = UNICODE_NULL; /* NULL-terminate */
1126}
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
_ACRTIMP int __cdecl rand(void)
Definition: misc.c:59
_ACRTIMP void __cdecl srand(unsigned int)
Definition: misc.c:50
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68

Referenced by ComputerPageDlgProc().

◆ GetInstallSourceWin32()

static BOOL GetInstallSourceWin32 ( OUT PWSTR  pwszPath,
IN DWORD  cchPathMax,
IN PCWSTR  pwszNTPath 
)
static

Definition at line 2890 of file wizard.c.

2894{
2895 WCHAR wszDrives[512];
2896 WCHAR wszNTPath[512]; // MAX_PATH ?
2897 DWORD cchDrives;
2898 PWCHAR pwszDrive;
2899
2900 *pwszPath = UNICODE_NULL;
2901
2902 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2903 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2904 {
2905 /* Buffer too small or failure */
2906 LogItem(NULL, L"GetLogicalDriveStringsW failed");
2907 return FALSE;
2908 }
2909
2910 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2911 {
2912 WCHAR wszBuf[MAX_PATH];
2913
2914 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2915 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2916 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2917 pwszDrive[2] = L'\\'; // Restore the backslash
2918
2919 wcscat(wszNTPath, L"\\"); // Concat a backslash
2920
2921 /* Logging */
2922 wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD",
2923 pwszDrive, wszNTPath,
2924 (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not");
2925 LogItem(NULL, wszBuf);
2926
2927 /* Check whether the NT path corresponds to the NT installation source path */
2928 if (!_wcsicmp(wszNTPath, pwszNTPath))
2929 {
2930 /* Found it! */
2931 wcscpy(pwszPath, pwszDrive); // cchPathMax
2932
2933 /* Logging */
2934 wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath);
2935 LogItem(NULL, wszBuf);
2936 wcscat(wszBuf, L"\n");
2937 OutputDebugStringW(wszBuf);
2938
2939 return TRUE;
2940 }
2941 }
2942
2943 return FALSE;
2944}
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
wcscat
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:102
#define DRIVE_CDROM
Definition: winbase.h:279
#define wsprintf
Definition: winuser.h:6031

Referenced by ProcessSetupInf().

◆ GetLargerTimeZoneEntry()

static PTIMEZONE_ENTRY GetLargerTimeZoneEntry ( PSETUPDATA  SetupData,
DWORD  Index 
)
static

Definition at line 1649 of file wizard.c.

1650{
1652
1654 while (Entry != NULL)
1655 {
1656 if (Entry->Index >= Index)
1657 return Entry;
1658
1659 Entry = Entry->Next;
1660 }
1661
1662 return NULL;
1663}
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by RetrieveTimeZone().

◆ GetLocalSystemTime()

static BOOL GetLocalSystemTime ( HWND  hwnd,
PSETUPDATA  SetupData 
)
static

Definition at line 1897 of file wizard.c.

1898{
1899 SYSTEMTIME Date;
1901
1903 {
1904 return FALSE;
1905 }
1906
1908 {
1909 return FALSE;
1910 }
1911
1915 SetupData->SystemTime.wDay = Date.wDay;
1916 SetupData->SystemTime.wHour = Time.wHour;
1917 SetupData->SystemTime.wMinute = Time.wMinute;
1918 SetupData->SystemTime.wSecond = Time.wSecond;
1919 SetupData->SystemTime.wMilliseconds = Time.wMilliseconds;
1920
1921 return TRUE;
1922}
#define IDC_TIMEPICKER
Definition: resource.h:11
#define IDC_DATEPICKER
Definition: resource.h:64
static PLARGE_INTEGER Time
Definition: time.c:37
#define GDT_VALID
Definition: commctrl.h:4465
#define DateTime_GetSystemtime(hdp, pst)
Definition: commctrl.h:4335
SYSTEMTIME SystemTime
Definition: syssetup.h:53
WORD wSecond
Definition: minwinbase.h:262
WORD wMinute
Definition: minwinbase.h:261
WORD wDayOfWeek
Definition: minwinbase.h:258
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by WriteDateTimeSettings().

◆ GetSelectedTimeZoneEntry()

static PTIMEZONE_ENTRY GetSelectedTimeZoneEntry ( PSETUPDATA  SetupData,
DWORD  dwEntryIndex 
)
static

Definition at line 1784 of file wizard.c.

1785{
1787
1788 for (Entry = SetupData->TimeZoneListHead; Entry != NULL; Entry = Entry->Next)
1789 {
1790 if (Entry->Index == dwEntryIndex)
1791 return Entry;
1792 }
1793
1794 return NULL;
1795}

Referenced by DateTimePageDlgProc().

◆ GetSetupInfPath()

VOID GetSetupInfPath ( PWSTR  szPath,
UINT  cchMax 
)

Definition at line 57 of file wizard.c.

58{
60 wcscat(szPath, L"\\$winnt$.inf");
61}
UINT cchMax
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2232

Referenced by PreprocessUnattend(), ProcessSetupInf(), and SetInstallationCompleted().

◆ GetTimeZoneEntryByIndex()

static PTIMEZONE_ENTRY GetTimeZoneEntryByIndex ( PSETUPDATA  SetupData,
DWORD  dwComboIndex 
)
static

Definition at line 1798 of file wizard.c.

1799{
1801 DWORD i;
1802
1803 for (Entry = SetupData->TimeZoneListHead, i = 0; Entry != NULL && i < dwComboIndex; i++, Entry = Entry->Next);
1804
1805 return Entry;
1806}
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE

Referenced by DateTimePageDlgProc().

◆ GplDlgProc()

static INT_PTR CALLBACK GplDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 130 of file wizard.c.

134{
135 HRSRC GplTextResource;
136 HGLOBAL GplTextMem;
137 PVOID GplTextLocked;
138 PCHAR GplText;
139 DWORD Size;
140
141
142 switch (uMsg)
143 {
144 case WM_INITDIALOG:
145 GplTextResource = FindResourceW(hDllInstance, MAKEINTRESOURCE(IDR_GPL), L"RT_TEXT");
146 if (NULL == GplTextResource)
147 {
148 break;
149 }
150 Size = SizeofResource(hDllInstance, GplTextResource);
151 if (0 == Size)
152 {
153 break;
154 }
155 GplText = HeapAlloc(GetProcessHeap(), 0, Size + 1);
156 if (NULL == GplText)
157 {
158 break;
159 }
160 GplTextMem = LoadResource(hDllInstance, GplTextResource);
161 if (NULL == GplTextMem)
162 {
163 HeapFree(GetProcessHeap(), 0, GplText);
164 break;
165 }
166 GplTextLocked = LockResource(GplTextMem);
167 if (NULL == GplTextLocked)
168 {
169 HeapFree(GetProcessHeap(), 0, GplText);
170 break;
171 }
172 memcpy(GplText, GplTextLocked, Size);
173 GplText[Size] = '\0';
174 SendMessageA(GetDlgItem(hwndDlg, IDC_GPL_TEXT), WM_SETTEXT, 0, (LPARAM) GplText);
175 HeapFree(GetProcessHeap(), 0, GplText);
176 SetFocus(GetDlgItem(hwndDlg, IDOK));
177 return FALSE;
178
179 case WM_CLOSE:
180 EndDialog(hwndDlg, IDCANCEL);
181 break;
182
183 case WM_COMMAND:
184 if (HIWORD(wParam) == BN_CLICKED && IDOK == LOWORD(wParam))
185 {
186 EndDialog(hwndDlg, IDOK);
187 }
188 break;
189
190 default:
191 break;
192 }
193
194 return FALSE;
195}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define IDR_GPL
Definition: resource.h:188
#define IDC_GPL_TEXT
Definition: resource.h:96
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define WM_CLOSE
Definition: winuser.h:1649
#define IDCANCEL
Definition: winuser.h:842
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDOK
Definition: winuser.h:841
#define WM_SETTEXT
Definition: winuser.h:1645
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by AckPageDlgProc().

◆ HasDaylightSavingTime()

static BOOL HasDaylightSavingTime ( PTIMEZONE_ENTRY  Entry)
static

Definition at line 1775 of file wizard.c.

1776{
1777 /* If StandardDate.wMonth and DaylightDate.wMonth are zero,
1778 * the timezone does not observe daylight saving time */
1779 return (Entry->TimezoneInfo.StandardDate.wMonth != 0 &&
1780 Entry->TimezoneInfo.DaylightDate.wMonth != 0);
1781}

Referenced by DateTimePageDlgProc(), and UpdateAutoDaylightCheckbox().

◆ InstallTypePageDlgProc()

static INT_PTR CALLBACK InstallTypePageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 725 of file wizard.c.

726{
727 LPNMHDR lpnm;
728 PSETUPDATA pSetupData;
729 INT iItem;
730 WCHAR szText[64], szDefault[64];
731 HICON hIcon;
732
733 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
734
735 switch (uMsg)
736 {
737 case WM_INITDIALOG:
738 {
739 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
740 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
741
742 LoadStringW(hDllInstance, IDS_DEFAULT, szDefault, _countof(szDefault));
743
746 {
747 StringCchCatW(szText, _countof(szText), L" ");
748 StringCchCatW(szText, _countof(szText), szDefault);
749 }
751
754 {
755 StringCchCatW(szText, _countof(szText), L" ");
756 StringCchCatW(szText, _countof(szText), szDefault);
757 }
759
762 {
763 StringCchCatW(szText, _countof(szText), L" ");
764 StringCchCatW(szText, _countof(szText), szDefault);
765 }
767
768#if 0
769 LoadStringW(hDllInstance, IDS_INSTALLATIONNANOSERVERNAME, szText, _countof(szText));
770 if (INSTALLATION_TYPE_DEFAULT == INSTALLATION_TYPE_NANO_SERVER)
771 {
772 StringCchCatW(szText, _countof(szText), L" ");
773 StringCchCatW(szText, _countof(szText), szDefault);
774 }
776#endif
777
780
783 return TRUE;
784 }
785
786 case WM_COMMAND:
788 {
791 }
792 break;
793
794 case WM_NOTIFY:
795 {
796 lpnm = (LPNMHDR)lParam;
797
798 switch (lpnm->code)
799 {
800 case PSN_SETACTIVE:
801 /* Enable the Back and Next buttons */
803 if (pSetupData->UnattendSetup)
804 {
805 OnChooseInstallationType(hwndDlg, pSetupData->InstallationType);
808 return TRUE;
809 }
810 break;
811
812 case PSN_WIZNEXT:
814 pSetupData->InstallationType = (INSTALLATION_TYPE)iItem;
816 break;
817
818 case PSN_WIZBACK:
819 pSetupData->UnattendSetup = FALSE;
820 break;
821
822 default:
823 break;
824 }
825 }
826 break;
827
828 default:
829 break;
830 }
831
832 return FALSE;
833}
#define IDD_LOCALEPAGE
Definition: resource.h:13
#define IDC_INSTALLATION_ICON
Definition: resource.h:113
#define IDS_INSTALLATIONWORKSTATIONNAME
Definition: resource.h:180
#define IDC_INSTALLATION_TYPES
Definition: resource.h:114
#define IDS_DEFAULT
Definition: resource.h:186
#define IDS_INSTALLATIONSERVERNAME
Definition: resource.h:178
#define IDS_INSTALLATIONSERVERCORENAME
Definition: resource.h:182
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
INSTALLATION_TYPE InstallationType
Definition: syssetup.h:65
static void OnChooseInstallationType(HWND hwndDlg, INSTALLATION_TYPE nOption)
Definition: wizard.c:694
static BOOL DoWriteInstallationType(INSTALLATION_TYPE nOption)
Definition: wizard.c:553
@ INSTALLATION_TYPE_DEFAULT
Definition: syssetup.h:34
@ INSTALLATION_TYPE_SERVER
Definition: syssetup.h:28
enum _INSTALLATION_TYPE INSTALLATION_TYPE
#define STM_SETICON
Definition: winuser.h:2128
#define CB_SETCURSEL
Definition: winuser.h:1990
#define IDI_WINLOGO
Definition: winuser.h:717
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ADDSTRING
Definition: winuser.h:1965
#define LoadIcon
Definition: winuser.h:5979

Referenced by InstallWizard().

◆ InstallWizard()

VOID InstallWizard ( VOID  )

Definition at line 3473 of file wizard.c.

3474{
3475 PROPSHEETHEADER psh = {0};
3476 HPROPSHEETPAGE *phpage = NULL;
3477 PROPSHEETPAGE psp = {0};
3478 UINT nPages = 0;
3479 HWND hWnd;
3480 MSG msg;
3481 PSETUPDATA pSetupData = NULL;
3482 HMODULE hNetShell = NULL;
3484 DWORD dwPageCount = 10, dwNetworkPageCount = 0;
3485
3486 LogItem(L"BEGIN_SECTION", L"InstallWizard");
3487
3488 /* Allocate setup data */
3489 pSetupData = HeapAlloc(GetProcessHeap(),
3491 sizeof(SETUPDATA));
3492 if (pSetupData == NULL)
3493 {
3494 LogItem(NULL, L"SetupData allocation failed!");
3496 L"Setup failed to allocate global data!",
3497 L"ReactOS Setup",
3499 goto done;
3500 }
3502
3503 hNetShell = LoadLibraryW(L"netshell.dll");
3504 if (hNetShell != NULL)
3505 {
3506 DPRINT("Netshell.dll loaded!\n");
3507
3508 pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
3509 "NetSetupRequestWizardPages");
3510 if (pfn != NULL)
3511 {
3512 pfn(&dwNetworkPageCount, NULL, NULL);
3513 dwPageCount += dwNetworkPageCount;
3514 }
3515 }
3516
3517 DPRINT("PageCount: %lu\n", dwPageCount);
3518
3519 phpage = HeapAlloc(GetProcessHeap(),
3521 dwPageCount * sizeof(HPROPSHEETPAGE));
3522 if (phpage == NULL)
3523 {
3524 LogItem(NULL, L"Page array allocation failed!");
3526 L"Setup failed to allocate page array!",
3527 L"ReactOS Setup",
3529 goto done;
3530 }
3531
3532 /* Process the $winnt$.inf setup file */
3533 ProcessSetupInf(pSetupData);
3534
3535 /* Create the Welcome page */
3536 psp.dwSize = sizeof(PROPSHEETPAGE);
3537 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3538 psp.hInstance = hDllInstance;
3539 psp.lParam = (LPARAM)pSetupData;
3540 psp.pfnDlgProc = WelcomeDlgProc;
3541 psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
3542 phpage[nPages++] = CreatePropertySheetPage(&psp);
3543
3544 /* Create the Acknowledgements page */
3545 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3546 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
3547 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
3548 psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
3549 psp.pfnDlgProc = AckPageDlgProc;
3550 phpage[nPages++] = CreatePropertySheetPage(&psp);
3551
3552 /* Create the Installation Type page */
3553 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3554 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_INSTALLATIONTITLE);
3555 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_INSTALLATIONSUBTITLE);
3556 psp.pszTemplate = MAKEINTRESOURCE(IDD_INSTALLATION);
3557 psp.pfnDlgProc = InstallTypePageDlgProc;
3558 phpage[nPages++] = CreatePropertySheetPage(&psp);
3559
3560 /* Create the Locale page */
3561 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3562 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
3563 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
3564 psp.pfnDlgProc = LocalePageDlgProc;
3565 psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
3566 phpage[nPages++] = CreatePropertySheetPage(&psp);
3567
3568 /* Create the Owner page */
3569 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3570 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
3571 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
3572 psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
3573 psp.pfnDlgProc = OwnerPageDlgProc;
3574 phpage[nPages++] = CreatePropertySheetPage(&psp);
3575
3576 /* Create the Computer page */
3577 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3578 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
3579 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
3580 psp.pfnDlgProc = ComputerPageDlgProc;
3581 psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
3582 phpage[nPages++] = CreatePropertySheetPage(&psp);
3583
3584 /* Create the DateTime page */
3585 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3586 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
3587 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
3588 psp.pfnDlgProc = DateTimePageDlgProc;
3589 psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
3590 phpage[nPages++] = CreatePropertySheetPage(&psp);
3591
3592 /* Create the theme selection page */
3593 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3594 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
3595 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
3596 psp.pfnDlgProc = ThemePageDlgProc;
3597 psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
3598 phpage[nPages++] = CreatePropertySheetPage(&psp);
3599
3602
3603 if (pfn)
3604 {
3605 pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
3606 nPages += dwNetworkPageCount;
3607 }
3608
3609 /* Create the Process page */
3610 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3611 psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
3612 psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
3613 psp.pfnDlgProc = ProcessPageDlgProc;
3614 psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
3615 phpage[nPages++] = CreatePropertySheetPage(&psp);
3616
3617 /* Create the Finish page */
3618 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3619 psp.pfnDlgProc = FinishDlgProc;
3620 psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
3621 phpage[nPages++] = CreatePropertySheetPage(&psp);
3622
3623 ASSERT(nPages == dwPageCount);
3624
3625 /* Create the property sheet */
3626 psh.dwSize = sizeof(PROPSHEETHEADER);
3627 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
3628 psh.hInstance = hDllInstance;
3629 psh.hwndParent = NULL;
3630 psh.nPages = nPages;
3631 psh.nStartPage = 0;
3632 psh.phpage = phpage;
3633 psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
3634 psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
3635
3636 /* Create title font */
3637 pSetupData->hTitleFont = CreateTitleFont();
3638 pSetupData->hBoldFont = CreateBoldFont();
3639
3640 /* Display the wizard */
3641 hWnd = (HWND)PropertySheet(&psh);
3643
3644 while (GetMessage(&msg, NULL, 0, 0))
3645 {
3646 if (!IsDialogMessage(hWnd, &msg))
3647 {
3650 }
3651 }
3652
3653 DeleteObject(pSetupData->hBoldFont);
3654 DeleteObject(pSetupData->hTitleFont);
3655
3656 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3657 SetupCloseInfFile(pSetupData->hSetupInf);
3658
3659done:
3660 if (phpage != NULL)
3661 HeapFree(GetProcessHeap(), 0, phpage);
3662
3663 if (hNetShell != NULL)
3664 FreeLibrary(hNetShell);
3665
3666 if (pSetupData != NULL)
3667 HeapFree(GetProcessHeap(), 0, pSetupData);
3668
3669 LogItem(L"END_SECTION", L"InstallWizard");
3670}
#define msg(x)
Definition: auth_time.c:54
#define IDB_HEADER
Definition: resource.h:30
#define IDS_PROCESSSUBTITLE
Definition: resource.h:109
#define IDS_PROCESSTITLE
Definition: resource.h:108
#define IDB_WATERMARK
Definition: resource.h:13
#define IDD_PROCESSPAGE
Definition: resource.h:69
#define IDD_FINISHPAGE
Definition: resource.h:74
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FreeLibrary(x)
Definition: compat.h:748
HANDLE HWND
Definition: compat.h:19
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDD_WELCOMEPAGE
Definition: resource.h:21
#define IDS_THEMESELECTIONTITLE
Definition: resource.h:137
#define IDS_INSTALLATIONSUBTITLE
Definition: resource.h:177
#define IDS_LOCALESUBTITLE
Definition: resource.h:127
#define IDD_ACKPAGE
Definition: resource.h:44
#define IDS_ACKTITLE
Definition: resource.h:117
#define IDD_OWNERPAGE
Definition: resource.h:48
#define IDS_OWNERSUBTITLE
Definition: resource.h:121
#define IDS_COMPUTERSUBTITLE
Definition: resource.h:124
#define IDS_INSTALLATIONTITLE
Definition: resource.h:176
#define IDS_DATETIMESUBTITLE
Definition: resource.h:132
#define IDS_LOCALETITLE
Definition: resource.h:126
#define IDS_THEMESELECTIONSUBTITLE
Definition: resource.h:138
#define IDS_COMPUTERTITLE
Definition: resource.h:123
#define IDD_COMPUTERPAGE
Definition: resource.h:52
#define IDS_OWNERTITLE
Definition: resource.h:120
#define IDS_ACKSUBTITLE
Definition: resource.h:118
#define IDS_DATETIMETITLE
Definition: resource.h:131
pKey DeleteObject()
unsigned int UINT
Definition: sysinfo.c:13
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:1347
static INT_PTR CALLBACK WelcomeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:469
static INT_PTR CALLBACK FinishDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wizard.c:1268
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_MODELESS
Definition: prsht.h:50
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropertySheet
Definition: prsht.h:400
#define PROPSHEETPAGE
Definition: prsht.h:389
#define DPRINT
Definition: sndvol32.h:73
HFONT hBoldFont
Definition: reactos.h:132
UINT uPostNetworkWizardPage
Definition: syssetup.h:63
UINT uFirstNetworkWizardPage
Definition: syssetup.h:62
HINF hSetupInf
Definition: syssetup.h:60
static INT_PTR CALLBACK ComputerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1129
static INT_PTR CALLBACK LocalePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1564
static INT_PTR CALLBACK OwnerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:879
static INT_PTR CALLBACK DateTimePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1980
static HFONT CreateBoldFont(VOID)
Definition: wizard.c:109
VOID ProcessSetupInf(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:3339
DWORD(WINAPI * PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA)
Definition: wizard.c:3470
static INT_PTR CALLBACK ThemePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2126
static INT_PTR CALLBACK AckPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:294
static INT_PTR CALLBACK InstallTypePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:725
static INT_PTR CALLBACK ProcessPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2631
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:45
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define IsDialogMessage
Definition: winuser.h:5975
#define GetMessage
Definition: winuser.h:5956
#define DispatchMessage
Definition: winuser.h:5931

Referenced by InstallReactOS().

◆ ItemCompletionThread()

static DWORD CALLBACK ItemCompletionThread ( LPVOID  Parameter)
static

Definition at line 2478 of file wizard.c.

2480{
2481 PITEMSDATA pItemsData;
2482 HWND hwndDlg;
2483
2484 pItemsData = (PITEMSDATA)Parameter;
2485 hwndDlg = pItemsData->hwndDlg;
2486
2487 /* Step 0 - Registering components */
2488 RegisterComponents(pItemsData);
2489
2490 /* Step 1 - Installing start menu items */
2491 InstallStartMenuItems(pItemsData);
2492
2493 /* Step 2 - Saving Settings */
2494 SaveSettings(pItemsData);
2495
2496 /* Step 3 - Install optional components */
2497 InstallOptionalComponents(pItemsData);
2498
2499 /* Step 4 - Removing temporary files */
2500// RemoveTempFiles(pItemsData);
2501
2502 // FIXME: Move this call to a separate cleanup page!
2504
2505 /* Free the items data */
2506 HeapFree(GetProcessHeap(), 0, pItemsData);
2507
2508 /* Tell the wizard page that we are done */
2509 PostMessage(hwndDlg, PM_ITEMS_DONE, 0, 0);
2510
2511 return 0;
2512}
void SaveSettings(void)
Definition: settings.c:115
struct _ITEMSDATA * PITEMSDATA
#define PM_ITEMS_DONE
Definition: globals.h:64
VOID InstallStartMenuItems(_In_ PITEMSDATA pItemsData)
Definition: install.c:314
NTSTATUS NTAPI RtlCreateBootStatusDataFile(VOID)
Definition: bootdata.c:98
HWND hwndDlg
Definition: globals.h:31
static VOID RegisterComponents(PITEMSDATA pItemsData)
Definition: wizard.c:2404
HRESULT InstallOptionalComponents(_In_ PITEMSDATA pItemsData)
Definition: addons.c:135
#define PostMessage
Definition: winuser.h:5998
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336

Referenced by RunItemCompletionThread().

◆ LocalePageDlgProc()

static INT_PTR CALLBACK LocalePageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1564 of file wizard.c.

1568{
1570
1571 /* Retrieve pointer to the global setup data */
1573
1574 switch (uMsg)
1575 {
1576 case WM_INITDIALOG:
1577 {
1578 /* Save pointer to the global setup data */
1582
1585 }
1586 break;
1587
1588 case WM_COMMAND:
1589 if (HIWORD(wParam) == BN_CLICKED)
1590 {
1591 switch (LOWORD(wParam))
1592 {
1593 case IDC_CUSTOMLOCALE:
1594 RunControlPanelApplet(hwndDlg, L"intl.cpl,,5");
1596 break;
1597
1598 case IDC_CUSTOMLAYOUT:
1599 RunControlPanelApplet(hwndDlg, L"input.dll,@1");
1601 break;
1602 }
1603 }
1604 break;
1605
1606 case WM_NOTIFY:
1607 {
1608 LPNMHDR lpnm = (LPNMHDR)lParam;
1609
1610 switch (lpnm->code)
1611 {
1612 case PSN_SETACTIVE:
1613 /* Enable the Back and Next buttons */
1616 {
1617 // if (!*SetupData->SourcePath)
1618 {
1619 RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"$winnt$.inf\""); // Should be in System32
1620 }
1621
1623 return TRUE;
1624 }
1625 break;
1626
1627 case PSN_WIZNEXT:
1628 break;
1629
1630 case PSN_WIZBACK:
1632 break;
1633
1634 default:
1635 break;
1636 }
1637 }
1638 break;
1639
1640 default:
1641 break;
1642 }
1643
1644 return FALSE;
1645}
#define IDC_LOCALETEXT
Definition: resource.h:58
#define IDC_LAYOUTTEXT
Definition: resource.h:60
#define IDC_CUSTOMLOCALE
Definition: resource.h:59
#define IDC_CUSTOMLAYOUT
Definition: resource.h:61
static VOID SetKeyboardLayoutName(HWND hwnd)
Definition: wizard.c:1316
static VOID WriteUserLocale(VOID)
Definition: wizard.c:1543
static VOID SetUserLocaleName(HWND hwnd)
Definition: wizard.c:1299

Referenced by InstallWizard().

◆ OnChooseInstallationType()

static void OnChooseInstallationType ( HWND  hwndDlg,
INSTALLATION_TYPE  nOption 
)
static

Definition at line 694 of file wizard.c.

695{
696 WCHAR szText[256];
697 ASSERT(0 <= nOption && nOption < INSTALLATION_TYPE_MAX);
698
699 switch (nOption)
700 {
703 break;
704
707 break;
708
711 break;
712
713 // case INSTALLATION_TYPE_NANO_SERVER:
714 // LoadStringW(hDllInstance, IDS_INSTALLATIONSERVERINFO, szText, _countof(szText));
715 // break;
716
717 default:
718 return;
719 }
720
722}
#define IDS_INSTALLATIONSERVERINFO
Definition: resource.h:179
#define IDC_INSTALLATION_DESCRIPTION
Definition: resource.h:115
#define IDS_INSTALLATIONWORKSTATIONINFO
Definition: resource.h:181
#define IDS_INSTALLATIONSERVERCOREINFO
Definition: resource.h:183

Referenced by InstallTypePageDlgProc().

◆ OwnerPageDlgProc()

static INT_PTR CALLBACK OwnerPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 879 of file wizard.c.

883{
884 WCHAR OwnerName[51];
885 WCHAR OwnerOrganization[51];
886 WCHAR Title[64];
887 WCHAR ErrorName[256];
888 LPNMHDR lpnm;
889 PSETUPDATA pSetupData;
890
891 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
892
893 switch (uMsg)
894 {
895 case WM_INITDIALOG:
896 {
897 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
898 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
899
900 /* set a localized ('Owner') placeholder string as default */
901 if (LoadStringW(hDllInstance, IDS_MACHINE_OWNER_NAME, OwnerName, _countof(OwnerName)))
902 {
903 SendDlgItemMessage(hwndDlg, IDC_OWNERNAME, WM_SETTEXT, 0, (LPARAM)OwnerName);
904 }
905
908
909 /* Set focus to owner name */
911
912 /* Select the default text to quickly overwrite it by typing */
914 }
915 break;
916
917
918 case WM_NOTIFY:
919 {
920 lpnm = (LPNMHDR)lParam;
921
922 switch (lpnm->code)
923 {
924 case PSN_SETACTIVE:
925 /* Enable the Back and Next buttons */
927 if (pSetupData->UnattendSetup)
928 {
929 SendMessage(GetDlgItem(hwndDlg, IDC_OWNERNAME), WM_SETTEXT, 0, (LPARAM)pSetupData->OwnerName);
931 if (WriteOwnerSettings(pSetupData->OwnerName, pSetupData->OwnerOrganization))
932 {
934 return TRUE;
935 }
936 }
937 break;
938
939 case PSN_WIZNEXT:
940 OwnerName[0] = 0;
941 if (GetDlgItemTextW(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0)
942 {
944 {
945 wcscpy(Title, L"ReactOS Setup");
946 }
947 if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, ARRAYSIZE(ErrorName)))
948 {
949 wcscpy(ErrorName, L"Setup cannot continue until you enter your name.");
950 }
951 MessageBoxW(hwndDlg, ErrorName, Title, MB_ICONERROR | MB_OK);
952
954 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
955
956 return TRUE;
957 }
958
959 OwnerOrganization[0] = 0;
960 GetDlgItemTextW(hwndDlg, IDC_OWNERORGANIZATION, OwnerOrganization, 50);
961
962 if (!WriteOwnerSettings(OwnerName, OwnerOrganization))
963 {
965 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, -1);
966 return TRUE;
967 }
968
969 case PSN_WIZBACK:
970 pSetupData->UnattendSetup = FALSE;
971 break;
972
973 default:
974 break;
975 }
976 }
977 break;
978
979 default:
980 break;
981 }
982
983 return FALSE;
984}
#define IDC_OWNERORGANIZATION
Definition: resource.h:50
#define IDS_MACHINE_OWNER_NAME
Definition: resource.h:151
#define IDS_WZD_NAME
Definition: resource.h:153
#define IDC_OWNERNAME
Definition: resource.h:49
WCHAR OwnerName[51]
Definition: syssetup.h:46
WCHAR OwnerOrganization[51]
Definition: syssetup.h:47
static BOOL WriteOwnerSettings(WCHAR *OwnerName, WCHAR *OwnerOrganization)
Definition: wizard.c:837
#define SendMessage
Definition: winuser.h:6009
#define EM_SETSEL
Definition: winuser.h:2047

Referenced by InstallWizard().

◆ PathIsEqual()

static BOOL PathIsEqual ( IN LPCWSTR  lpPath1,
IN LPCWSTR  lpPath2 
)
static

Definition at line 3222 of file wizard.c.

3225{
3226 WCHAR szPath1[MAX_PATH];
3227 WCHAR szPath2[MAX_PATH];
3228
3229 /* If something goes wrong, better return TRUE,
3230 * so the calling function returns early.
3231 */
3232 if (!PathCanonicalizeW(szPath1, lpPath1))
3233 return TRUE;
3234
3235 if (!PathAddBackslashW(szPath1))
3236 return TRUE;
3237
3238 if (!PathCanonicalizeW(szPath2, lpPath2))
3239 return TRUE;
3240
3241 if (!PathAddBackslashW(szPath2))
3242 return TRUE;
3243
3244 return (_wcsicmp(szPath1, szPath2) == 0);
3245}
#define PathCanonicalizeW
Definition: pathcch.h:314
#define PathAddBackslashW
Definition: pathcch.h:302

Referenced by AddInstallationSource().

◆ ProcessPageDlgProc()

static INT_PTR CALLBACK ProcessPageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2631 of file wizard.c.

2635{
2637 PREGISTRATIONNOTIFY RegistrationNotify;
2638 static HICON s_hCheckIcon, s_hArrowIcon, s_hCrossIcon;
2639 static HFONT s_hNormalFont;
2640
2641 /* Retrieve pointer to the global setup data */
2643
2644 switch (uMsg)
2645 {
2646 case WM_INITDIALOG:
2647 {
2648 /* Save pointer to the global setup data */
2652 ShowDlgItem(hwndDlg, IDC_CHECK5, SW_HIDE);
2653 s_hCheckIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CHECKICON), IMAGE_ICON, 16, 16, 0);
2654 s_hArrowIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_ARROWICON), IMAGE_ICON, 16, 16, 0);
2655 s_hCrossIcon = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_CROSSICON), IMAGE_ICON, 16, 16, 0);
2656 s_hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1, WM_GETFONT, 0, 0);
2657 break;
2658 }
2659
2660 case WM_DESTROY:
2661 DestroyIcon(s_hCheckIcon);
2662 DestroyIcon(s_hArrowIcon);
2663 DestroyIcon(s_hCrossIcon);
2664 break;
2665
2666 case WM_NOTIFY:
2667 switch (((LPNMHDR)lParam)->code)
2668 {
2669 case PSN_SETACTIVE:
2670 {
2671 LogItem(L"BEGIN", L"ProcessPage");
2672
2673 /* Disable all buttons during installation; hide "Back" */
2675 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
2677
2678 RunItemCompletionThread(hwndDlg);
2679 break;
2680 }
2681
2682 case PSN_WIZNEXT:
2683 LogItem(L"END", L"ProcessPage");
2684 break;
2685
2686 case PSN_WIZBACK:
2688 break;
2689
2690 default:
2691 break;
2692 }
2693 break;
2694
2695 case PM_ITEM_START:
2696 DPRINT("PM_ITEM_START %lu\n", (ULONG)lParam);
2701 break;
2702
2703 case PM_ITEM_END:
2704 DPRINT("PM_ITEM_END\n");
2705 SendDlgItemMessage(hwndDlg, IDC_TASKTEXT1 + wParam, WM_SETFONT, (WPARAM)s_hNormalFont, (LPARAM)TRUE);
2706 if (lParam == ERROR_SUCCESS)
2707 {
2709 }
2710 else
2711 {
2713 ShowItemError(hwndDlg, (DWORD)lParam);
2714 }
2715 break;
2716
2717 case PM_STEP_START:
2718 DPRINT("PM_STEP_START\n");
2719 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2721 (LPARAM)((RegistrationNotify->CurrentItem != NULL)? RegistrationNotify->CurrentItem : L""));
2722 break;
2723
2724 case PM_STEP_END:
2725 DPRINT("PM_STEP_END\n");
2726 RegistrationNotify = (PREGISTRATIONNOTIFY)lParam;
2727 SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS, RegistrationNotify->Progress, 0);
2728 if (RegistrationNotify->LastError != ERROR_SUCCESS)
2729 {
2730 ShowStepError(hwndDlg, RegistrationNotify);
2731 }
2732 break;
2733
2734 case PM_ITEMS_DONE:
2735 DPRINT("PM_ITEMS_DONE\n");
2736 /* Enable the Back and Next buttons */
2739 break;
2740
2741 default:
2742 break;
2743 }
2744
2745 return FALSE;
2746}
#define IDC_PROCESSPROGRESS
Definition: resource.h:72
#define IDC_ITEM
Definition: resource.h:71
#define IDC_CHECK1
Definition: resource.h:319
#define PM_STEP_START
Definition: globals.h:62
#define PM_ITEM_START
Definition: globals.h:52
#define PM_ITEM_END
Definition: globals.h:57
struct _REGISTRATIONNOTIFY * PREGISTRATIONNOTIFY
#define PM_STEP_END
Definition: globals.h:63
#define IDC_CHECK5
Definition: resource.h:86
#define IDC_TASKTEXT1
Definition: resource.h:72
#define IDC_TASKTEXT5
Definition: resource.h:76
#define IDI_ARROWICON
Definition: resource.h:36
#define IDI_CHECKICON
Definition: resource.h:35
#define IDI_CROSSICON
Definition: resource.h:37
#define PSBTN_NEXT
Definition: prsht.h:147
LPCWSTR CurrentItem
Definition: globals.h:38
static VOID ShowItemError(HWND hwndDlg, DWORD LastError)
Definition: wizard.c:2550
static BOOL RunItemCompletionThread(_In_ HWND hwndDlg)
Definition: wizard.c:2517
static VOID ShowStepError(HWND hwndDlg, PREGISTRATIONNOTIFY RegistrationNotify)
Definition: wizard.c:2593
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define WM_GETFONT
Definition: winuser.h:1679
#define STM_SETIMAGE
Definition: winuser.h:2129
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422

Referenced by InstallWizard().

◆ ProcessSetupInf()

VOID ProcessSetupInf ( IN OUT PSETUPDATA  pSetupData)

Definition at line 3339 of file wizard.c.

3341{
3343 WCHAR szValue[MAX_PATH];
3344 INFCONTEXT InfContext;
3345 DWORD LineLength;
3346 HKEY hKey;
3347 LONG res;
3348
3349 pSetupData->hSetupInf = INVALID_HANDLE_VALUE;
3350
3351 /* Retrieve the path of the setup INF */
3353
3354 /* Open the setup INF */
3355 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3356 NULL,
3358 NULL);
3359 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3360 {
3361 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3362 return;
3363 }
3364
3365
3366 /* Retrieve the NT source path from which the 1st-stage installer was run */
3367 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
3368 L"data",
3369 L"sourcepath",
3370 &InfContext))
3371 {
3372 DPRINT1("Error: Cannot find sourcepath Key! %d\n", GetLastError());
3373 return;
3374 }
3375
3376 if (!SetupGetStringFieldW(&InfContext,
3377 1,
3378 szValue,
3379 ARRAYSIZE(szValue),
3380 &LineLength))
3381 {
3382 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3383 return;
3384 }
3385
3386 *pSetupData->SourcePath = UNICODE_NULL;
3387
3388 /* Close the setup INF as we are going to modify it manually */
3389 if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
3390 SetupCloseInfFile(pSetupData->hSetupInf);
3391
3392
3393 /* Find the installation source path in Win32 format */
3394 if (!GetInstallSourceWin32(pSetupData->SourcePath,
3395 _countof(pSetupData->SourcePath),
3396 szValue))
3397 {
3398 *pSetupData->SourcePath = UNICODE_NULL;
3399 }
3400
3401 /* Save the path in Win32 format in the setup INF */
3402 _swprintf(szValue, L"\"%s\"", pSetupData->SourcePath);
3403 WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath);
3404
3405 /*
3406 * Save it also in the registry, in the following keys:
3407 * - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup ,
3408 * values "SourcePath" and "ServicePackSourcePath" (REG_SZ);
3409 * - HKLM\Software\Microsoft\Windows NT\CurrentVersion ,
3410 * value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386).
3411 */
3412#if 0
3414 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
3415 0,
3417 &hKey);
3418
3419 if (res != ERROR_SUCCESS)
3420 {
3421 return FALSE;
3422 }
3423#endif
3424
3426 L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
3427 0, NULL,
3429 KEY_ALL_ACCESS, // KEY_WRITE
3430 NULL,
3431 &hKey,
3432 NULL);
3433 if (res == ERROR_SUCCESS)
3434 {
3435 AddInstallationSource(hKey, pSetupData->SourcePath);
3436
3438 L"SourcePath",
3439 0,
3440 REG_SZ,
3441 (LPBYTE)pSetupData->SourcePath,
3442 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3443
3445 L"ServicePackSourcePath",
3446 0,
3447 REG_SZ,
3448 (LPBYTE)pSetupData->SourcePath,
3449 (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR));
3450
3452 }
3453
3454
3455 /* Now, re-open the setup INF (this must succeed) */
3456 pSetupData->hSetupInf = SetupOpenInfFileW(szPath,
3457 NULL,
3459 NULL);
3460 if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE)
3461 {
3462 DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError());
3463 return;
3464 }
3465
3466 /* Process the unattended section of the setup file */
3467 ProcessUnattendSection(pSetupData);
3468}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
#define INF_STYLE_OLDNT
Definition: infsupp.h:39
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1060
static BOOL GetInstallSourceWin32(OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
Definition: wizard.c:2890
VOID GetSetupInfPath(PWSTR szPath, UINT cchMax)
Definition: wizard.c:57
static VOID AddInstallationSource(IN HKEY hKey, IN LPWSTR lpPath)
Definition: wizard.c:3248
VOID ProcessUnattendSection(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:2947
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:186
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:56
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by InstallWizard().

◆ ProcessUnattendSection()

VOID ProcessUnattendSection ( IN OUT PSETUPDATA  pSetupData)

Definition at line 2947 of file wizard.c.

2949{
2950 INFCONTEXT InfContext;
2951 WCHAR szName[256];
2952 WCHAR szValue[MAX_PATH];
2953 DWORD LineLength;
2954 HKEY hKey;
2955
2956 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2957 L"Unattend",
2958 L"UnattendSetupEnabled",
2959 &InfContext))
2960 {
2961 DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError());
2962 return;
2963 }
2964
2965 if (!SetupGetStringFieldW(&InfContext,
2966 1,
2967 szValue,
2968 ARRAYSIZE(szValue),
2969 &LineLength))
2970 {
2971 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
2972 return;
2973 }
2974
2975 if (_wcsicmp(szValue, L"yes") != 0)
2976 {
2977 DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n");
2978 return;
2979 }
2980
2981 pSetupData->UnattendSetup = TRUE;
2982
2983 if (!SetupFindFirstLineW(pSetupData->hSetupInf,
2984 L"Unattend",
2985 NULL,
2986 &InfContext))
2987 {
2988 DPRINT1("Error: SetupFindFirstLine failed %d\n", GetLastError());
2989 return;
2990 }
2991
2992 do
2993 {
2994 if (!SetupGetStringFieldW(&InfContext,
2995 0,
2996 szName,
2998 &LineLength))
2999 {
3000 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3001 return;
3002 }
3003
3004 if (!SetupGetStringFieldW(&InfContext,
3005 1,
3006 szValue,
3007 ARRAYSIZE(szValue),
3008 &LineLength))
3009 {
3010 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3011 return;
3012 }
3013 DPRINT1("Name %S Value %S\n", szName, szValue);
3014 if (!_wcsicmp(szName, L"FullName"))
3015 {
3016 if (ARRAYSIZE(pSetupData->OwnerName) > LineLength)
3017 {
3018 wcscpy(pSetupData->OwnerName, szValue);
3019 }
3020 }
3021 else if (!_wcsicmp(szName, L"OrgName"))
3022 {
3023 if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength)
3024 {
3025 wcscpy(pSetupData->OwnerOrganization, szValue);
3026 }
3027 }
3028 else if (!_wcsicmp(szName, L"ComputerName"))
3029 {
3030 if (ARRAYSIZE(pSetupData->ComputerName) > LineLength)
3031 {
3032 wcscpy(pSetupData->ComputerName, szValue);
3033 }
3034 }
3035 else if (!_wcsicmp(szName, L"AdminPassword"))
3036 {
3037 if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength)
3038 {
3039 wcscpy(pSetupData->AdminPassword, szValue);
3040 }
3041 }
3042 else if (!_wcsicmp(szName, L"TimeZoneIndex"))
3043 {
3044 pSetupData->TimeZoneIndex = _wtoi(szValue);
3045 }
3046 else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet"))
3047 {
3048 pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue);
3049 }
3050 else if (!_wcsicmp(szName, L"RappsDownload"))
3051 {
3052 if (!_wcsicmp(szValue, L"yes"))
3053 pSetupData->RappsDownload = TRUE;
3054 else
3055 pSetupData->RappsDownload = FALSE;
3056 }
3057 else if (!_wcsicmp(szName, L"InstallationType"))
3058 {
3059 pSetupData->InstallationType = (INSTALLATION_TYPE)_wtoi(szValue);
3060 }
3061 } while (SetupFindNextLine(&InfContext, &InfContext));
3062
3063 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3064 L"Display",
3065 NULL,
3066 &InfContext))
3067 {
3068 DEVMODEW dm = { { 0 } };
3069 dm.dmSize = sizeof(dm);
3071 {
3072 do
3073 {
3074 int iValue;
3075 if (!SetupGetStringFieldW(&InfContext,
3076 0,
3077 szName,
3079 &LineLength))
3080 {
3081 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3082 return;
3083 }
3084
3085 if (!SetupGetStringFieldW(&InfContext,
3086 1,
3087 szValue,
3088 ARRAYSIZE(szValue),
3089 &LineLength))
3090 {
3091 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3092 return;
3093 }
3094 iValue = _wtoi(szValue);
3095 DPRINT1("Name %S Value %i\n", szName, iValue);
3096
3097 if (!iValue)
3098 continue;
3099
3100 if (!_wcsicmp(szName, L"BitsPerPel"))
3101 {
3102 dm.dmFields |= DM_BITSPERPEL;
3103 dm.dmBitsPerPel = iValue;
3104 }
3105 else if (!_wcsicmp(szName, L"XResolution"))
3106 {
3107 dm.dmFields |= DM_PELSWIDTH;
3108 dm.dmPelsWidth = iValue;
3109 }
3110 else if (!_wcsicmp(szName, L"YResolution"))
3111 {
3112 dm.dmFields |= DM_PELSHEIGHT;
3113 dm.dmPelsHeight = iValue;
3114 }
3115 else if (!_wcsicmp(szName, L"VRefresh"))
3116 {
3118 dm.dmDisplayFrequency = iValue;
3119 }
3120 } while (SetupFindNextLine(&InfContext, &InfContext));
3121
3123 }
3124 }
3125
3127 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
3128 0,
3130 &hKey) != ERROR_SUCCESS)
3131 {
3132 DPRINT1("Error: failed to open HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\n");
3133 return;
3134 }
3135
3136 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3137 L"GuiRunOnce",
3138 NULL,
3139 &InfContext))
3140 {
3141 int i = 0;
3142 do
3143 {
3144 if (SetupGetStringFieldW(&InfContext,
3145 0,
3146 szValue,
3147 ARRAYSIZE(szValue),
3148 NULL))
3149 {
3151 _swprintf(szName, L"%d", i);
3152 DPRINT("szName %S szValue %S\n", szName, szValue);
3153
3155 {
3156 DPRINT("value %S\n", szPath);
3157 if (RegSetValueExW(hKey,
3158 szName,
3159 0,
3160 REG_SZ,
3161 (const BYTE*)szPath,
3162 (wcslen(szPath) + 1) * sizeof(WCHAR)) == ERROR_SUCCESS)
3163 {
3164 i++;
3165 }
3166 }
3167 }
3168 } while (SetupFindNextLine(&InfContext, &InfContext));
3169 }
3170
3172
3173 if (SetupFindFirstLineW(pSetupData->hSetupInf,
3174 L"Env",
3175 NULL,
3176 &InfContext))
3177 {
3178 if (RegCreateKeyExW(
3179 HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, NULL,
3181 {
3182 DPRINT1("Error: failed to open HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\n");
3183 return;
3184 }
3185 do
3186 {
3187 if (!SetupGetStringFieldW(&InfContext,
3188 0,
3189 szName,
3191 &LineLength))
3192 {
3193 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3194 return;
3195 }
3196
3197 if (!SetupGetStringFieldW(&InfContext,
3198 1,
3199 szValue,
3200 ARRAYSIZE(szValue),
3201 &LineLength))
3202 {
3203 DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError());
3204 return;
3205 }
3206 DPRINT1("[ENV] %S=%S\n", szName, szValue);
3207
3208 DWORD dwType = wcschr(szValue, '%') != NULL ? REG_EXPAND_SZ : REG_SZ;
3209
3210 if (RegSetValueExW(hKey, szName, 0, dwType, (const BYTE*)szValue, (DWORD)(wcslen(szValue) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS)
3211 {
3212 DPRINT1(" - Error %d\n", GetLastError());
3213 }
3214
3215 } while (SetupFindNextLine(&InfContext, &InfContext));
3216
3218 }
3219}
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2778
char TCHAR
Definition: tchar.h:1402
#define KEY_SET_VALUE
Definition: nt_native.h:1020
static const WCHAR szName[]
Definition: powrprof.c:45
DWORD dmBitsPerPel
Definition: wingdi.h:2093
DWORD dmFields
Definition: wingdi.h:2068
DWORD dmPelsWidth
Definition: wingdi.h:2094
DWORD dmPelsHeight
Definition: wingdi.h:2095
DWORD dmDisplayFrequency
Definition: wingdi.h:2100
WORD dmSize
Definition: wingdi.h:2066
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
Definition: display.c:408
LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode, DWORD dwflags)
Definition: display.c:612
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DM_BITSPERPEL
Definition: wingdi.h:1268
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
#define CDS_UPDATEREGISTRY
Definition: winuser.h:181
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179

Referenced by ProcessSetupInf().

◆ RegisterComponents()

static VOID RegisterComponents ( PITEMSDATA  pItemsData)
static

Definition at line 2404 of file wizard.c.

2406{
2407 WCHAR SectionName[512];
2409 LONG Steps = 0;
2412
2413 ZeroMemory(&Notify, sizeof(Notify));
2414
2415 /* Count the 'RegisterDlls' steps */
2416 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2417 L"RegisterDlls", &Context))
2418 {
2419 DPRINT1("No RegistrationPhase2 section found\n");
2420 return;
2421 }
2422
2423 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2424 ARRAYSIZE(SectionName),
2425 NULL))
2426 {
2427 DPRINT1("Unable to retrieve section name\n");
2428 return;
2429 }
2430
2431 Steps += SetupGetLineCountW(hSysSetupInf, SectionName);
2432
2433 /* Count the 'TypeLibratries' steps */
2434 Steps += SetupGetLineCountW(hSysSetupInf, L"TypeLibraries");
2435
2436 /* Start the item */
2437 DPRINT("Register Components: %ld Steps\n", Steps);
2438 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)Steps);
2439
2440 Error = RegisterDlls(pItemsData, &Notify);
2441 if (Error == ERROR_SUCCESS)
2442 RegisterTypeLibraries(pItemsData, &Notify, hSysSetupInf, L"TypeLibraries");
2443
2444 /* End the item */
2445 DPRINT("Register Components: done\n");
2446 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, Error);
2447}
#define NO_ERROR
Definition: dderror.h:5
BOOL WINAPI SHIM_OBJ_NAME() Notify(DWORD fdwReason, PVOID ptr)
static const WCHAR RegisterDlls[]
Definition: install.c:118
LONG WINAPI SetupGetLineCountW(HINF hinf, PCWSTR section)
Definition: parser.c:1501
HINF hSysSetupInf
Definition: install.c:38
BOOL RegisterTypeLibraries(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify, _In_ HINF hinf, _In_ LPCWSTR szSection)
Definition: install.c:540
_In_ PVOID Context
Definition: storport.h:2269

Referenced by ItemCompletionThread().

◆ RegisterDlls()

static DWORD RegisterDlls ( _In_ PITEMSDATA  pItemsData,
_In_ PREGISTRATIONNOTIFY  pNotify 
)
static

Definition at line 2333 of file wizard.c.

2336{
2337 REGISTRATIONDATA RegistrationData;
2338 WCHAR SectionName[512];
2340 LONG DllCount = 0;
2342
2343 ZeroMemory(&RegistrationData, sizeof(REGISTRATIONDATA));
2344 RegistrationData.hwndDlg = pItemsData->hwndDlg;
2345 RegistrationData.Registered = 0;
2346
2347 if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
2348 L"RegisterDlls", &Context))
2349 {
2350 DPRINT1("No RegistrationPhase2 section found\n");
2351 return GetLastError();
2352 }
2353
2354 if (!SetupGetStringFieldW(&Context, 1, SectionName,
2355 ARRAYSIZE(SectionName),
2356 NULL))
2357 {
2358 DPRINT1("Unable to retrieve section name\n");
2359 return GetLastError();
2360 }
2361
2362 DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
2363 DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
2364 if (DllCount < 0)
2365 {
2366 return STATUS_NOT_FOUND;
2367 }
2368
2369 RegistrationData.DllCount = (ULONG)DllCount;
2370 RegistrationData.DefaultContext = SetupInitDefaultQueueCallback(RegistrationData.hwndDlg);
2371 RegistrationData.pNotify = pNotify;
2372
2373 _SEH2_TRY
2374 {
2375 if (!SetupInstallFromInfSectionW(GetParent(RegistrationData.hwndDlg),
2377 L"RegistrationPhase2",
2378 SPINST_REGISTRY | SPINST_REGISTERCALLBACKAWARE | SPINST_REGSVR,
2379 0,
2380 NULL,
2381 0,
2383 &RegistrationData,
2384 NULL,
2385 NULL))
2386 {
2387 Error = GetLastError();
2388 }
2389 }
2391 {
2392 DPRINT("Catching exception\n");
2394 }
2395 _SEH2_END;
2396
2398
2399 return Error;
2400}
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1330
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1656
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
Definition: queue.c:1629
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define SPINST_REGSVR
Definition: setupapi.h:597
#define SPINST_REGISTRY
Definition: setupapi.h:593
#define STATUS_NOT_FOUND
Definition: shellext.h:72
PVOID DefaultContext
Definition: wizard.c:36
PREGISTRATIONNOTIFY pNotify
Definition: wizard.c:37
ULONG Registered
Definition: wizard.c:35
ULONG DllCount
Definition: wizard.c:34
static UINT CALLBACK RegistrationNotificationProc(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: wizard.c:2237
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

◆ RegistrationNotificationProc()

static UINT CALLBACK RegistrationNotificationProc ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 2237 of file wizard.c.

2241{
2242 PREGISTRATIONDATA RegistrationData;
2245
2246 RegistrationData = (PREGISTRATIONDATA)Context;
2247
2250 {
2251 StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1;
2252 RegistrationData->pNotify->CurrentItem = wcsrchr(StatusInfo->FileName, L'\\');
2253 if (RegistrationData->pNotify->CurrentItem == NULL)
2254 {
2255 RegistrationData->pNotify->CurrentItem = StatusInfo->FileName;
2256 }
2257 else
2258 {
2259 RegistrationData->pNotify->CurrentItem++;
2260 }
2261
2263 {
2264 DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n",
2265 StatusInfo->FileName);
2266 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2267
2268 DPRINT("RegisterDll: Start step %ld\n", RegistrationData->pNotify->Progress);
2269 SendMessage(RegistrationData->hwndDlg, PM_STEP_START, 0, (LPARAM)RegistrationData->pNotify);
2270 }
2271 else
2272 {
2273 DPRINT("Received SPFILENOTIFY_ENDREGISTRATION notification for %S\n",
2274 StatusInfo->FileName);
2275 DPRINT("Win32Error %u FailureCode %u\n", StatusInfo->Win32Error,
2276 StatusInfo->FailureCode);
2277 if (StatusInfo->FailureCode != SPREG_SUCCESS)
2278 {
2279 switch (StatusInfo->FailureCode)
2280 {
2281 case SPREG_LOADLIBRARY:
2283 break;
2284 case SPREG_GETPROCADDR:
2286 break;
2287 case SPREG_REGSVR:
2289 break;
2290 case SPREG_DLLINSTALL:
2292 break;
2293 case SPREG_TIMEOUT:
2295 break;
2296 default:
2298 break;
2299 }
2300
2301 RegistrationData->pNotify->MessageID = MessageID;
2302 RegistrationData->pNotify->LastError = StatusInfo->Win32Error;
2303 }
2304 else
2305 {
2306 RegistrationData->pNotify->MessageID = 0;
2307 RegistrationData->pNotify->LastError = ERROR_SUCCESS;
2308 }
2309
2310 if (RegistrationData->Registered < RegistrationData->DllCount)
2311 {
2312 RegistrationData->Registered++;
2313 }
2314
2315 RegistrationData->pNotify->Progress = RegistrationData->Registered;
2316 DPRINT("RegisterDll: End step %ld\n", RegistrationData->pNotify->Progress);
2317 SendMessage(RegistrationData->hwndDlg, PM_STEP_END, 0, (LPARAM)RegistrationData->pNotify);
2318 }
2319
2320 return FILEOP_DOIT;
2321 }
2322 else
2323 {
2324 DPRINT1("Received unexpected notification %u\n", Notification);
2325 return SetupDefaultQueueCallback(RegistrationData->DefaultContext,
2326 Notification, Param1, Param2);
2327 }
2328}
#define IDS_TIMEOUT
Definition: resource.h:14
#define IDS_DLLINSTALL_FAILED
Definition: resource.h:147
#define IDS_REGSVR_FAILED
Definition: resource.h:146
#define IDS_LOADLIBRARY_FAILED
Definition: resource.h:144
#define IDS_GETPROCADDR_FAILED
Definition: resource.h:145
#define IDS_REASON_UNKNOWN
Definition: resource.h:149
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPREG_GETPROCADDR
Definition: setupapi.h:657
#define SPREG_REGSVR
Definition: setupapi.h:658
#define SetupDefaultQueueCallback
Definition: setupapi.h:2593
#define SPFILENOTIFY_STARTREGISTRATION
Definition: setupapi.h:573
#define SPREG_SUCCESS
Definition: setupapi.h:655
struct _SP_REGISTER_CONTROL_STATUSW * PSP_REGISTER_CONTROL_STATUSW
#define SPREG_TIMEOUT
Definition: setupapi.h:660
#define SPFILENOTIFY_ENDREGISTRATION
Definition: setupapi.h:574
#define SPREG_DLLINSTALL
Definition: setupapi.h:659
#define SPREG_LOADLIBRARY
Definition: setupapi.h:656
struct _REGISTRATIONDATA * PREGISTRATIONDATA
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
_In_ ULONG MessageID
Definition: wdfinterrupt.h:92

Referenced by RegisterDlls().

◆ RetrieveTimeZone()

static LONG RetrieveTimeZone ( IN HKEY  hZoneKey,
IN PVOID  Context 
)
static

Definition at line 1666 of file wizard.c.

1669{
1670 LONG lError;
1673 PTIMEZONE_ENTRY Current;
1674 ULONG DescriptionSize;
1675 ULONG StandardNameSize;
1676 ULONG DaylightNameSize;
1677
1679 if (Entry == NULL)
1680 {
1682 }
1683
1684 DescriptionSize = sizeof(Entry->Description);
1685 StandardNameSize = sizeof(Entry->StandardName);
1686 DaylightNameSize = sizeof(Entry->DaylightName);
1687
1688 lError = QueryTimeZoneData(hZoneKey,
1689 &Entry->Index,
1690 &Entry->TimezoneInfo,
1691 Entry->Description,
1692 &DescriptionSize,
1693 Entry->StandardName,
1694 &StandardNameSize,
1695 Entry->DaylightName,
1696 &DaylightNameSize);
1697 if (lError != ERROR_SUCCESS)
1698 {
1700 return lError;
1701 }
1702
1705 {
1706 Entry->Prev = NULL;
1707 Entry->Next = NULL;
1710 }
1711 else
1712 {
1713 Current = GetLargerTimeZoneEntry(SetupData, Entry->Index);
1714 if (Current != NULL)
1715 {
1716 if (Current == SetupData->TimeZoneListHead)
1717 {
1718 /* Prepend to head */
1719 Entry->Prev = NULL;
1723 }
1724 else
1725 {
1726 /* Insert before current */
1727 Entry->Prev = Current->Prev;
1728 Entry->Next = Current;
1729 Current->Prev->Next = Entry;
1730 Current->Prev = Entry;
1731 }
1732 }
1733 else
1734 {
1735 /* Append to tail */
1737 Entry->Next = NULL;
1740 }
1741 }
1742
1743 return ERROR_SUCCESS;
1744}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
struct _TIMEZONE_ENTRY * Prev
Definition: timezone.c:17
static PTIMEZONE_ENTRY GetLargerTimeZoneEntry(PSETUPDATA SetupData, DWORD Index)
Definition: wizard.c:1649
LONG QueryTimeZoneData(IN HKEY hZoneKey, OUT PULONG Index OPTIONAL, OUT PREG_TZI_FORMAT TimeZoneInfo, OUT PWCHAR Description OPTIONAL, IN OUT PULONG DescriptionSize OPTIONAL, OUT PWCHAR StandardName OPTIONAL, IN OUT PULONG StandardNameSize OPTIONAL, OUT PWCHAR DaylightName OPTIONAL, IN OUT PULONG DaylightNameSize OPTIONAL)
Definition: tzlib.c:141

Referenced by CreateTimeZoneList().

◆ RunControlPanelApplet()

static BOOL RunControlPanelApplet ( HWND  hwnd,
PCWSTR  pwszCPLParameters 
)
static

Definition at line 1398 of file wizard.c.

1399{
1400 MSG msg;
1401 HWND MainWindow = GetParent(hwnd);
1402 STARTUPINFOW StartupInfo;
1403 PROCESS_INFORMATION ProcessInformation;
1404 WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL ";
1405
1406 if (!pwszCPLParameters)
1407 {
1408 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1409 return FALSE;
1410 }
1411
1412 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
1413 StartupInfo.cb = sizeof(StartupInfo);
1414 ZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
1415
1416 ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters));
1417 wcscat(CmdLine, pwszCPLParameters);
1418
1419 if (!CreateProcessW(NULL,
1420 CmdLine,
1421 NULL,
1422 NULL,
1423 FALSE,
1424 0,
1425 NULL,
1426 NULL,
1427 &StartupInfo,
1428 &ProcessInformation))
1429 {
1430 MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR);
1431 return FALSE;
1432 }
1433
1434 /* Disable the Back and Next buttons and the main window
1435 * while we're interacting with the control panel applet */
1436 PropSheet_SetWizButtons(MainWindow, 0);
1437 EnableWindow(MainWindow, FALSE);
1438
1440 {
1441 /* We still need to process main window messages to avoid freeze */
1442 while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
1443 {
1446 }
1447 }
1448 CloseHandle(ProcessInformation.hThread);
1449 CloseHandle(ProcessInformation.hProcess);
1450
1451 /* Enable the Back and Next buttons and the main window again */
1453 EnableWindow(MainWindow, TRUE);
1454
1455 return TRUE;
1456}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4441
static const WCHAR CmdLine[]
Definition: install.c:48
#define INFINITE
Definition: serial.h:102
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:893
#define QS_ALLINPUT
Definition: winuser.h:914
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)

Referenced by EnableVisualTheme(), and LocalePageDlgProc().

◆ RunItemCompletionThread()

static BOOL RunItemCompletionThread ( _In_ HWND  hwndDlg)
static

Definition at line 2517 of file wizard.c.

2519{
2520 HANDLE hCompletionThread;
2521 PITEMSDATA pItemsData;
2522
2523 pItemsData = HeapAlloc(GetProcessHeap(), 0, sizeof(ITEMSDATA));
2524 if (pItemsData == NULL)
2525 return FALSE;
2526
2527 pItemsData->hwndDlg = hwndDlg;
2528
2529 hCompletionThread = CreateThread(NULL,
2530 0,
2532 pItemsData,
2533 0,
2534 NULL);
2535 if (hCompletionThread == NULL)
2536 {
2537 HeapFree(GetProcessHeap(), 0, pItemsData);
2538 }
2539 else
2540 {
2541 CloseHandle(hCompletionThread);
2542 return TRUE;
2543 }
2544
2545 return FALSE;
2546}
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static DWORD CALLBACK ItemCompletionThread(LPVOID Parameter)
Definition: wizard.c:2478

Referenced by ProcessPageDlgProc().

◆ SaveSettings()

static VOID SaveSettings ( PITEMSDATA  pItemsData)
static

Definition at line 2451 of file wizard.c.

2453{
2454 LONG Steps = 0;
2457
2458 ZeroMemory(&Notify, sizeof(Notify));
2459
2460 /* Count steps */
2461 Steps = CountSecuritySteps();
2462
2463 /* Start the item */
2464 DPRINT("Install security: %ld Steps\n", Steps);
2465 SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 2, (LPARAM)Steps);
2466
2467 /* Install steps */
2468 Error = InstallSecurity(pItemsData, &Notify);
2469
2470 /* End the item */
2471 DPRINT("Install security: done\n");
2472 SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 2, Error);
2473}
LONG CountSecuritySteps(VOID)
Definition: security.c:1607
DWORD InstallSecurity(_In_ PITEMSDATA pItemsData, _In_ PREGISTRATIONNOTIFY pNotify)
Definition: security.c:1648

◆ SetInstallationCompleted()

static VOID SetInstallationCompleted ( IN BOOL  Unattended)
static

Definition at line 2750 of file wizard.c.

2751{
2752 HKEY hKey = 0;
2753 DWORD InProgress = 0;
2754 DWORD InstallDate;
2755
2756 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion",
2757 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
2758 {
2759 InstallDate = (DWORD)time(NULL);
2760 RegSetValueExW(hKey, L"InstallDate", 0, REG_DWORD, (LPBYTE)&InstallDate, sizeof(InstallDate));
2762 }
2763
2764 if (Unattended)
2765 {
2766 WCHAR szInf[MAX_PATH];
2767 WCHAR szInfCmd[MAX_PATH * 4], szCmd[_countof(szInfCmd)];
2768
2769 GetSetupInfPath(szInf, _countof(szInf));
2770 if (GetPrivateProfileStringW(L"SetupParams", L"UserExecute", L"", szInfCmd, _countof(szInfCmd), szInf) && *szInfCmd)
2771 {
2772 *szCmd = UNICODE_NULL;
2773 ExpandEnvironmentStringsW(szInfCmd, szCmd, _countof(szInfCmd));
2774 RunCommandAndWait(szCmd);
2775 }
2776 }
2777
2778 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\Setup", 0, KEY_WRITE, &hKey) == ERROR_SUCCESS)
2779 {
2780 RegSetValueExW(hKey, L"SystemSetupInProgress", 0, REG_DWORD, (LPBYTE)&InProgress, sizeof(InProgress));
2782 }
2783}
__u16 time
Definition: mkdosfs.c:8
HRESULT RunCommandAndWait(_In_ PWCHAR Command)
Definition: addons.c:37

Referenced by FinishDlgProc().

◆ SetKeyboardLayoutName()

static VOID SetKeyboardLayoutName ( HWND  hwnd)
static

Definition at line 1316 of file wizard.c.

1317{
1318 HKL hkl;
1319 BOOL LayoutSpecial = FALSE;
1320 WCHAR LayoutPath[256];
1321 WCHAR LocaleName[32];
1322 WCHAR SpecialId[5] = L"";
1323 WCHAR ResText[256] = L"";
1324 DWORD dwValueSize;
1325 HKEY hKey;
1326 UINT i;
1327
1328 /* Get the default input language and method */
1329 if (!SystemParametersInfoW(SPI_GETDEFAULTINPUTLANG, 0, (LPDWORD)&hkl, 0))
1330 {
1332 }
1333
1334 if ((HIWORD(hkl) & 0xF000) == 0xF000)
1335 {
1336 /* Process keyboard layout with special id */
1337 StringCchPrintfW(SpecialId, ARRAYSIZE(SpecialId), L"%04x", (HIWORD(hkl) & 0x0FFF));
1338 LayoutSpecial = TRUE;
1339 }
1340
1341#define MAX_LAYOUTS_PER_LANGID 0x10000
1342 for (i = 0; i < (LayoutSpecial ? MAX_LAYOUTS_PER_LANGID : 1); i++)
1343 {
1344 /* Generate a hexadecimal identifier for keyboard layout registry key */
1346
1347 StringCchCopyW(LayoutPath, ARRAYSIZE(LayoutPath), L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\");
1348 StringCchCatW(LayoutPath, ARRAYSIZE(LayoutPath), LocaleName);
1350
1352 LayoutPath,
1353 0,
1355 &hKey) == ERROR_SUCCESS)
1356 {
1357 /* Make sure the keyboard layout key we opened is the one we need.
1358 * If the layout has no special id, just pass this check. */
1359 dwValueSize = sizeof(LocaleName);
1360 if (!LayoutSpecial ||
1362 L"Layout Id",
1363 NULL,
1364 NULL,
1365 (PVOID)&LocaleName,
1366 &dwValueSize) == ERROR_SUCCESS) &&
1367 (wcscmp(LocaleName, SpecialId) == 0)))
1368 {
1370 dwValueSize = sizeof(LocaleName);
1372 L"Layout Text",
1373 NULL,
1374 NULL,
1375 (PVOID)&LocaleName,
1376 &dwValueSize);
1377 /* Let the loop know where to stop */
1379 }
1381 }
1382 else
1383 {
1384 /* Keyboard layout registry keys are expected to go in order without gaps */
1385 break;
1386 }
1387 }
1388#undef MAX_LAYOUTS_PER_LANGID
1389
1390 LoadStringW(hDllInstance, IDS_LAYOUTTEXT, ResText, ARRAYSIZE(ResText));
1391 StringCchPrintfW(LayoutPath, ARRAYSIZE(LayoutPath), ResText, LocaleName);
1392
1393 SetWindowTextW(hwnd, LayoutPath);
1394}
static _In_ LPCWSTR LocaleName
#define IDS_LAYOUTTEXT
Definition: resource.h:129
unsigned int BOOL
Definition: ntddk_ex.h:94
HKL hkl
Definition: msctf.idl:632
UINT_PTR HKL
Definition: msctf.idl:125
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define MAX_LAYOUTS_PER_LANGID
uint32_t * LPDWORD
Definition: typedefs.h:59
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by LocalePageDlgProc().

◆ SetLocalTimeZone()

static VOID SetLocalTimeZone ( HWND  hwnd,
PSETUPDATA  SetupData 
)
static

Definition at line 1852 of file wizard.c.

1853{
1854 TIME_ZONE_INFORMATION TimeZoneInformation;
1856 DWORD dwIndex;
1857 DWORD i;
1858
1859 dwIndex = SendMessage(hwnd,
1861 0,
1862 0);
1863
1864 i = 0;
1866 while (i < dwIndex)
1867 {
1868 if (Entry == NULL)
1869 return;
1870
1871 i++;
1872 Entry = Entry->Next;
1873 }
1874
1875 wcscpy(TimeZoneInformation.StandardName,
1876 Entry->StandardName);
1877 wcscpy(TimeZoneInformation.DaylightName,
1878 Entry->DaylightName);
1879
1880 TimeZoneInformation.Bias = Entry->TimezoneInfo.Bias;
1881 TimeZoneInformation.StandardBias = Entry->TimezoneInfo.StandardBias;
1882 TimeZoneInformation.DaylightBias = Entry->TimezoneInfo.DaylightBias;
1883
1884 memcpy(&TimeZoneInformation.StandardDate,
1885 &Entry->TimezoneInfo.StandardDate,
1886 sizeof(SYSTEMTIME));
1887 memcpy(&TimeZoneInformation.DaylightDate,
1888 &Entry->TimezoneInfo.DaylightDate,
1889 sizeof(SYSTEMTIME));
1890
1891 /* Set time zone information */
1892 SetTimeZoneInformation(&TimeZoneInformation);
1893}
BOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
Definition: timezone.c:316
SYSTEMTIME DaylightDate
Definition: timezoneapi.h:30
SYSTEMTIME StandardDate
Definition: timezoneapi.h:27

Referenced by WriteDateTimeSettings().

◆ SetSystemLocalTime()

static BOOL SetSystemLocalTime ( HWND  hwnd,
PSETUPDATA  SetupData 
)
static

Definition at line 1926 of file wizard.c.

1927{
1928 BOOL Ret = FALSE;
1929
1930 /*
1931 * Call SetLocalTime twice to ensure correct results
1932 */
1935
1936 return Ret;
1937}
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:328

Referenced by WriteDateTimeSettings().

◆ SetUserLocaleName()

static VOID SetUserLocaleName ( HWND  hwnd)
static

Definition at line 1299 of file wizard.c.

1300{
1301 WCHAR CurLocale[256] = L"";
1302 WCHAR CurGeo[256] = L"";
1303 WCHAR ResText[256] = L"";
1304 WCHAR LocaleText[256 * 2];
1305
1308
1309 LoadStringW(hDllInstance, IDS_LOCALETEXT, ResText, ARRAYSIZE(ResText));
1310 StringCchPrintfW(LocaleText, ARRAYSIZE(LocaleText), ResText, CurLocale, CurGeo);
1311
1312 SetWindowTextW(hwnd, LocaleText);
1313}
GEOID WINAPI GetUserGeoID(GEOCLASS GeoClass)
Definition: locale.c:4747
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2803
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: locale.c:5401
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
#define IDS_LOCALETEXT
Definition: resource.h:128
@ GEO_FRIENDLYNAME
Definition: winnls.h:645
#define LOCALE_SLANGUAGE
Definition: winnls.h:31
@ GEOCLASS_NATION
Definition: winnls.h:632

Referenced by LocalePageDlgProc().

◆ ShowItemError()

static VOID ShowItemError ( HWND  hwndDlg,
DWORD  LastError 
)
static

Definition at line 2550 of file wizard.c.

2553{
2555 WCHAR UnknownError[84];
2556 WCHAR Title[64];
2557
2559 NULL, LastError, 0, ErrorMessage, 0, NULL) == 0)
2560 {
2562 UnknownError,
2563 ARRAYSIZE(UnknownError) - 20) == 0)
2564 {
2565 wcscpy(UnknownError, L"Unknown error");
2566 }
2567 wcscat(UnknownError, L" ");
2568 _ultow(LastError, UnknownError + wcslen(UnknownError), 10);
2569 ErrorMessage = UnknownError;
2570 }
2571
2572 if (ErrorMessage != NULL)
2573 {
2575 Title, ARRAYSIZE(Title)) == 0)
2576 {
2577 wcscpy(Title, L"ReactOS Setup");
2578 }
2579
2581 }
2582
2583 if (ErrorMessage != NULL &&
2584 ErrorMessage != UnknownError)
2585 {
2587 }
2588}
static VOID ErrorMessage(_In_ DWORD dwErrorCode, _In_opt_ PCWSTR pszMsg,...)
Definition: attrib.c:32
#define IDS_UNKNOWN_ERROR
Definition: resource.h:91
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
_ACRTIMP wchar_t *__cdecl _ultow(__msvcrt_ulong, wchar_t *, int)
Definition: string.c:2204
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396

Referenced by ProcessPageDlgProc().

◆ ShowStepError()

static VOID ShowStepError ( HWND  hwndDlg,
PREGISTRATIONNOTIFY  RegistrationNotify 
)
static

Definition at line 2593 of file wizard.c.

2596{
2597 WCHAR ErrorMessage[128];
2598 WCHAR Title[64];
2599
2600 if (LoadStringW(hDllInstance, RegistrationNotify->MessageID,
2602 ARRAYSIZE(ErrorMessage)) == 0)
2603 {
2604 ErrorMessage[0] = L'\0';
2605 }
2606
2607 if (RegistrationNotify->MessageID != IDS_TIMEOUT)
2608 {
2610 RegistrationNotify->LastError, 0,
2613 NULL);
2614 }
2615
2616 if (ErrorMessage[0] != L'\0')
2617 {
2619 Title, ARRAYSIZE(Title)) == 0)
2620 {
2621 wcscpy(Title, L"ReactOS Setup");
2622 }
2623
2624 MessageBoxW(hwndDlg, ErrorMessage,
2626 }
2627}

Referenced by ProcessPageDlgProc().

◆ ShowTimeZoneList()

static VOID ShowTimeZoneList ( HWND  hwnd,
PSETUPDATA  SetupData,
DWORD  dwEntryIndex 
)
static

Definition at line 1822 of file wizard.c.

1823{
1825 DWORD dwIndex = 0;
1826 DWORD dwCount;
1827
1828 GetTimeZoneListIndex(&dwEntryIndex);
1829
1831 while (Entry != NULL)
1832 {
1833 dwCount = SendMessage(hwnd,
1835 0,
1836 (LPARAM)Entry->Description);
1837
1838 if (dwEntryIndex != 0 && dwEntryIndex == Entry->Index)
1839 dwIndex = dwCount;
1840
1841 Entry = Entry->Next;
1842 }
1843
1846 (WPARAM)dwIndex,
1847 0);
1848}

Referenced by DateTimePageDlgProc().

◆ ThemePageDlgProc()

static INT_PTR CALLBACK ThemePageDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2126 of file wizard.c.

2130{
2132 LPNMLISTVIEW pnmv;
2133
2134 /* Retrieve pointer to the global setup data */
2136
2137 switch (uMsg)
2138 {
2139 case WM_INITDIALOG:
2140 {
2141 HWND hListView;
2143 DWORD n;
2144 LVITEM lvi = {0};
2145
2146 /* Save pointer to the global setup data */
2149
2150 hListView = GetDlgItem(hwndDlg, IDC_THEMEPICKER);
2151
2152 /* Common */
2154 lvi.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE;
2155
2156 for (n = 0; n < ARRAYSIZE(Themes); ++n)
2157 {
2158 WCHAR DisplayName[100] = {0};
2159 /* Load the bitmap */
2161 ImageList_AddMasked(himl, image, RGB(255,0,255));
2162
2163 /* Load the string */
2164 LoadStringW(hDllInstance, Themes[n].DisplayName, DisplayName, ARRAYSIZE(DisplayName));
2165 DisplayName[ARRAYSIZE(DisplayName)-1] = UNICODE_NULL;
2166
2167 /* Add the listview item */
2168 lvi.iItem = n;
2169 lvi.iImage = n;
2170 lvi.pszText = DisplayName;
2171 ListView_InsertItem(hListView, &lvi);
2172 }
2173
2174 /* Register the imagelist */
2176 /* Transparent background */
2177 ListView_SetBkColor(hListView, CLR_NONE);
2179 /* Reduce the size between the items */
2180 ListView_SetIconSpacing(hListView, 190, 173);
2181 break;
2182 }
2183
2184 case WM_NOTIFY:
2185 switch (((LPNMHDR)lParam)->code)
2186 {
2187 //case LVN_ITEMCHANGING:
2188 case LVN_ITEMCHANGED:
2189 pnmv = (LPNMLISTVIEW)lParam;
2190 if ((pnmv->uChanged & LVIF_STATE) && (pnmv->uNewState & LVIS_SELECTED))
2191 {
2192 int iTheme = pnmv->iItem;
2193 DPRINT1("Selected theme: %u\n", Themes[iTheme].DisplayName);
2194
2195 if (Themes[iTheme].ThemeFile)
2196 {
2197 WCHAR wszTheme[MAX_PATH];
2198 SHGetFolderPathAndSubDirW(0, CSIDL_RESOURCES, NULL, SHGFP_TYPE_DEFAULT, Themes[iTheme].ThemeFile, wszTheme);
2199 EnableVisualTheme(hwndDlg, wszTheme);
2200 }
2201 else
2202 {
2203 EnableVisualTheme(hwndDlg, Themes[iTheme].ThemeFile);
2204 }
2205 }
2206 break;
2207 case PSN_SETACTIVE:
2208 /* Enable the Back and Next buttons */
2211 {
2213 return TRUE;
2214 }
2215 break;
2216
2217 case PSN_WIZNEXT:
2218 break;
2219
2220 case PSN_WIZBACK:
2222 break;
2223
2224 default:
2225 break;
2226 }
2227 break;
2228
2229 default:
2230 break;
2231 }
2232
2233 return FALSE;
2234}
HIMAGELIST himl
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:573
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:2782
#define IDC_THEMEPICKER
Definition: resource.h:93
#define RGB(r, g, b)
Definition: precomp.h:67
GLdouble n
Definition: glext.h:7729
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2413
#define ListView_SetIconSpacing(hwndLV, cx, cy)
Definition: commctrl.h:2728
#define LVIF_STATE
Definition: commctrl.h:2317
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2309
#define CLR_NONE
Definition: commctrl.h:319
#define ListView_SetBkColor(hwnd, clrBk)
Definition: commctrl.h:2299
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVITEM
Definition: commctrl.h:2380
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVIF_TEXT
Definition: commctrl.h:2314
#define ILC_MASK
Definition: commctrl.h:351
#define LVIF_IMAGE
Definition: commctrl.h:2315
#define ListView_SetTextBkColor(hwnd, clrTextBk)
Definition: commctrl.h:2668
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
#define LVSIL_NORMAL
Definition: commctrl.h:2303
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2168
#define CSIDL_RESOURCES
Definition: shlobj.h:2243
UINT uNewState
Definition: commctrl.h:3041
VOID EnableVisualTheme(_In_opt_ HWND hwndParent, _In_opt_ PCWSTR ThemeFile)
Definition: wizard.c:1460
static struct ThemeInfo Themes[]
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1109

Referenced by InstallWizard().

◆ UpdateAutoDaylightCheckbox()

static VOID UpdateAutoDaylightCheckbox ( HWND  hwndDlg,
PTIMEZONE_ENTRY  Entry 
)
static

Definition at line 1809 of file wizard.c.

1810{
1811 BOOL bHasDST = (Entry != NULL && HasDaylightSavingTime(Entry));
1812
1813 /* Enable or disable the checkbox based on DST support */
1814 EnableDlgItem(hwndDlg, IDC_AUTODAYLIGHT, bHasDST);
1815
1816 /* Check the checkbox only if DST is supported, otherwise uncheck it */
1818 (WPARAM)(bHasDST ? BST_CHECKED : BST_UNCHECKED), 0);
1819}

Referenced by DateTimePageDlgProc().

◆ UpdateLocalSystemTime()

static VOID UpdateLocalSystemTime ( HWND  hwnd,
SYSTEMTIME  LocalTime 
)
static

Definition at line 1941 of file wizard.c.

1942{
1945}
#define DateTime_SetSystemtime(hdp, gd, pst)
Definition: commctrl.h:4337

Referenced by DateTimePageDlgProc().

◆ WelcomeDlgProc()

static INT_PTR CALLBACK WelcomeDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 199 of file wizard.c.

203{
204 PSETUPDATA pSetupData;
205
206 pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
207
208 switch (uMsg)
209 {
210 case WM_INITDIALOG:
211 {
212 HWND hwndControl;
213 DWORD dwStyle;
214
215 /* Get pointer to the global setup data */
216 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
217 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSetupData);
218
219 hwndControl = GetParent(hwndDlg);
220
221 /* Center the wizard window */
222 CenterWindow(hwndControl);
223
224 /* Hide the system menu */
225 dwStyle = GetWindowLongPtr(hwndControl, GWL_STYLE);
226 SetWindowLongPtr(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU);
227
228 /* Hide and disable the 'Cancel' button */
229 hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL);
230 ShowWindow(hwndControl, SW_HIDE);
231 EnableWindow(hwndControl, FALSE);
232
233 /* Set title font */
234 SendDlgItemMessage(hwndDlg,
237 (WPARAM)pSetupData->hTitleFont,
238 (LPARAM)TRUE);
239 }
240 break;
241
242 case WM_NOTIFY:
243 {
244 LPNMHDR lpnm = (LPNMHDR)lParam;
245
246 switch (lpnm->code)
247 {
248 case PSN_SETACTIVE:
249 {
250 LogItem(L"BEGIN", L"WelcomePage");
251 /* Only "Next" for the first page and hide "Back" */
253 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
255 if (pSetupData->UnattendSetup)
256 {
258 return TRUE;
259 }
260 break;
261 }
262
263 case PSN_KILLACTIVE:
264 {
265 /* Show "Back" button */
266 // PropSheet_ShowWizButtons(GetParent(hwndDlg), PSWIZB_BACK, PSWIZB_BACK);
268 break;
269 }
270
271 case PSN_WIZNEXT:
272 LogItem(L"END", L"WelcomePage");
273 break;
274
275 case PSN_WIZBACK:
276 pSetupData->UnattendSetup = FALSE;
277 break;
278
279 default:
280 break;
281 }
282 }
283 break;
284
285 default:
286 break;
287 }
288
289 return FALSE;
290}
#define IDC_WELCOMETITLE
Definition: resource.h:16
static VOID CenterWindow(IN HWND hWnd)
Definition: wizard.c:31
#define WS_SYSMENU
Definition: pedump.c:629
#define GWL_STYLE
Definition: winuser.h:863

◆ WriteComputerSettings()

static BOOL WriteComputerSettings ( WCHAR ComputerName,
HWND  hwndDlg 
)
static

Definition at line 988 of file wizard.c.

989{
990 WCHAR Title[64];
991 WCHAR ErrorComputerName[256];
992 LONG lError;
993 HKEY hKey = NULL;
994
995 if (!SetComputerNameW(ComputerName))
996 {
997 if (hwndDlg != NULL)
998 {
1000 {
1001 wcscpy(Title, L"ReactOS Setup");
1002 }
1003 if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName,
1004 ARRAYSIZE(ErrorComputerName)))
1005 {
1006 wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
1007 }
1008 MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
1009 }
1010
1011 return FALSE;
1012 }
1013
1014 /* Set the physical DNS domain */
1015 SetComputerNameExW(ComputerNamePhysicalDnsDomain, L"");
1016
1017 /* Set the physical DNS hostname */
1018 SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
1019
1020 /* Set the accounts domain name */
1021 SetAccountsDomainSid(NULL, ComputerName);
1022
1023 /* Now we need to set the Hostname */
1025 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
1026 0,
1027 NULL,
1029 KEY_WRITE,
1030 NULL,
1031 &hKey,
1032 NULL);
1033 if (lError == ERROR_SUCCESS)
1034 {
1035 lError = RegSetValueEx(hKey,
1036 L"Hostname",
1037 0,
1038 REG_SZ,
1039 (LPBYTE)ComputerName,
1040 (wcslen(ComputerName) + 1) * sizeof(WCHAR));
1041 if (lError != ERROR_SUCCESS)
1042 {
1043 DPRINT1("RegSetValueEx(\"Hostname\") failed (%08lX)\n", lError);
1044 }
1045
1047 }
1048 else
1049 {
1050 DPRINT1("RegCreateKeyExW for Tcpip\\Parameters failed (%08lX)\n", lError);
1051 }
1052
1053 return TRUE;
1054}
BOOL WINAPI SetComputerNameW(LPCWSTR lpComputerName)
Definition: compname.c:616
BOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer)
Definition: compname.c:648
#define IDS_WZD_SETCOMPUTERNAME
Definition: resource.h:154
NTSTATUS WINAPI SetAccountsDomainSid(PSID DomainSid, LPCWSTR DomainName)
Definition: security.c:28
#define RegSetValueEx
Definition: winreg.h:565

Referenced by ComputerPageDlgProc().

◆ WriteDateTimeSettings()

static BOOL WriteDateTimeSettings ( HWND  hwndDlg,
PSETUPDATA  SetupData 
)
static

Definition at line 1949 of file wizard.c.

1950{
1951 WCHAR Title[64];
1952 WCHAR ErrorLocalTime[256];
1953
1954 GetLocalSystemTime(hwndDlg, SetupData);
1956 SetupData);
1957
1959 BM_GETCHECK, 0, 0) != BST_UNCHECKED);
1960 if (!SetSystemLocalTime(hwndDlg, SetupData))
1961 {
1963 {
1964 wcscpy(Title, L"ReactOS Setup");
1965 }
1966 if (0 == LoadStringW(hDllInstance, IDS_WZD_LOCALTIME, ErrorLocalTime,
1967 ARRAYSIZE(ErrorLocalTime)))
1968 {
1969 wcscpy(ErrorLocalTime, L"Setup was unable to set the local time.");
1970 }
1971 MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
1972 return FALSE;
1973 }
1974
1975 return TRUE;
1976}
#define IDS_WZD_LOCALTIME
Definition: resource.h:159
static BOOL SetSystemLocalTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1926
static BOOL GetLocalSystemTime(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1897
static VOID SetLocalTimeZone(HWND hwnd, PSETUPDATA SetupData)
Definition: wizard.c:1852
VOID SetAutoDaylight(IN BOOL EnableAutoDaylightTime)
Definition: tzlib.c:323
#define MB_ICONWARNING
Definition: winuser.h:797
#define BM_GETCHECK
Definition: winuser.h:1947

Referenced by DateTimePageDlgProc().

◆ WriteDefaultLogonData()

static BOOL WriteDefaultLogonData ( LPWSTR  Domain)
static

Definition at line 1059 of file wizard.c.

1060{
1061 WCHAR szAdministratorName[256];
1062 HKEY hKey = NULL;
1063 LONG lError;
1064
1067 szAdministratorName,
1068 ARRAYSIZE(szAdministratorName)) == 0)
1069 {
1070 wcscpy(szAdministratorName, L"Administrator");
1071 }
1072
1074 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1075 0,
1077 &hKey);
1078 if (lError != ERROR_SUCCESS)
1079 return FALSE;
1080
1081 lError = RegSetValueEx(hKey,
1082 L"DefaultDomainName",
1083 0,
1084 REG_SZ,
1085 (LPBYTE)Domain,
1086 (wcslen(Domain)+ 1) * sizeof(WCHAR));
1087 if (lError != ERROR_SUCCESS)
1088 {
1089 DPRINT1("RegSetValueEx(\"DefaultDomainName\") failed!\n");
1090 }
1091
1092 lError = RegSetValueEx(hKey,
1093 L"DefaultUserName",
1094 0,
1095 REG_SZ,
1096 (LPBYTE)szAdministratorName,
1097 (wcslen(szAdministratorName)+ 1) * sizeof(WCHAR));
1098 if (lError != ERROR_SUCCESS)
1099 {
1100 DPRINT1("RegSetValueEx(\"DefaultUserName\") failed!\n");
1101 }
1102
1104
1105 return TRUE;
1106}
#define IDS_ADMINISTRATOR_NAME
Definition: resource.h:150
_In_ ULONG Domain
Definition: haltypes.h:1814

Referenced by ComputerPageDlgProc().

◆ WriteOwnerSettings()

static BOOL WriteOwnerSettings ( WCHAR OwnerName,
WCHAR OwnerOrganization 
)
static

Definition at line 837 of file wizard.c.

839{
840 HKEY hKey;
841 LONG res;
842
844 L"Software\\Microsoft\\Windows NT\\CurrentVersion",
845 0,
847 &hKey);
848
849 if (res != ERROR_SUCCESS)
850 {
851 return FALSE;
852 }
853
855 L"RegisteredOwner",
856 0,
857 REG_SZ,
858 (LPBYTE)OwnerName,
859 (wcslen(OwnerName) + 1) * sizeof(WCHAR));
860
861 if (res != ERROR_SUCCESS)
862 {
864 return FALSE;
865 }
866
868 L"RegisteredOrganization",
869 0,
870 REG_SZ,
871 (LPBYTE)OwnerOrganization,
872 (wcslen(OwnerOrganization) + 1) * sizeof(WCHAR));
873
875 return (res == ERROR_SUCCESS);
876}

Referenced by OwnerPageDlgProc().

◆ WriteUserLocale()

static VOID WriteUserLocale ( VOID  )
static

Definition at line 1543 of file wizard.c.

1544{
1545 HKEY hKey;
1546 LCID lcid;
1547 WCHAR Locale[9] = L"0000";
1548
1550
1551 if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, &Locale[4], _countof(Locale) - 4) != 0)
1552 {
1553 if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
1556 {
1557 RegSetValueExW(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (wcslen(Locale) + 1) * sizeof(WCHAR));
1559 }
1560 }
1561}
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1235
LCID lcid
Definition: locale.c:5660
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
DWORD LCID
Definition: nls.h:13
#define LOCALE_ILANGUAGE
Definition: winnls.h:30

Referenced by LocalePageDlgProc().

Variable Documentation

◆ InstallationTypes

const WCHAR* InstallationTypes[INSTALLATION_TYPE_MAX]
static
Initial value:
=
{
L"Server",
L"Client",
L"Server Core",
}

Definition at line 425 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_DefaultSoundEvents

const WCHAR* s_DefaultSoundEvents[][2]
static
Initial value:
=
{
{ L".Default", L"%SystemRoot%\\Media\\ReactOS_Default.wav" },
{ L"AppGPFault", L"" },
{ L"Close", L"" },
{ L"CriticalBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Critical.wav" },
{ L"DeviceConnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Insert.wav" },
{ L"DeviceDisconnect", L"%SystemRoot%\\Media\\ReactOS_Hardware_Remove.wav" },
{ L"DeviceFail", L"%SystemRoot%\\Media\\ReactOS_Hardware_Fail.wav" },
{ L"LowBatteryAlarm", L"%SystemRoot%\\Media\\ReactOS_Battery_Low.wav" },
{ L"MailBeep", L"%SystemRoot%\\Media\\ReactOS_Notify.wav" },
{ L"Maximize", L"%SystemRoot%\\Media\\ReactOS_Restore.wav" },
{ L"MenuCommand", L"%SystemRoot%\\Media\\ReactOS_Menu_Command.wav" },
{ L"MenuPopup", L"" },
{ L"Minimize", L"%SystemRoot%\\Media\\ReactOS_Minimize.wav" },
{ L"Open", L"" },
{ L"PrintComplete", L"%SystemRoot%\\Media\\ReactOS_Print_Complete.wav" },
{ L"RestoreDown", L"" },
{ L"RestoreUp", L"" },
{ L"SystemAsterisk", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
{ L"SystemExclamation", L"%SystemRoot%\\Media\\ReactOS_Exclamation.wav" },
{ L"SystemExit", L"%SystemRoot%\\Media\\ReactOS_Shutdown.wav" },
{ L"SystemHand", L"%SystemRoot%\\Media\\ReactOS_Critical_Stop.wav" },
{ L"SystemNotification", L"%SystemRoot%\\Media\\ReactOS_Balloon.wav" },
{ L"SystemQuestion", L"%SystemRoot%\\Media\\ReactOS_Ding.wav" },
{ L"SystemStart", L"%SystemRoot%\\Media\\ReactOS_Startup.wav" },
{ L"WindowsLogoff", L"%SystemRoot%\\Media\\ReactOS_LogOff.wav" }
}

Definition at line 433 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_ExplorerSoundEvents

const WCHAR* s_ExplorerSoundEvents[][2]
static
Initial value:
=
{
{ L"EmptyRecycleBin", L"%SystemRoot%\\Media\\ReactOS_Recycle.wav" },
{ L"Navigating", L"%SystemRoot%\\Media\\ReactOS_Start.wav" }
}

Definition at line 463 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_ProductOptionData

const PRODUCT_OPTION_DATA s_ProductOptionData[INSTALLATION_TYPE_MAX]
static
Initial value:
=
{
{ L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 },
{ L"\0", L"WinNT", 1, 0x300, 1 },
{ L"Terminal Server\0", L"ServerNT", 0, 0x200, 0 }
}

Definition at line 417 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szControlWindows

const WCHAR s_szControlWindows[] = L"SYSTEM\\CurrentControlSet\\Control\\Windows"
static

Definition at line 402 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szCurrentVersion

const WCHAR s_szCurrentVersion[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
static

Definition at line 406 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szDefaultSoundEvents

const WCHAR s_szDefaultSoundEvents[] = L"AppEvents\\Schemes\\Apps\\.Default"
static

Definition at line 404 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szExplorerSoundEvents

const WCHAR s_szExplorerSoundEvents[] = L"AppEvents\\Schemes\\Apps\\Explorer"
static

Definition at line 405 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szProductOptions

const WCHAR s_szProductOptions[] = L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
static

Definition at line 400 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szRosVersion

const WCHAR s_szRosVersion[] = L"SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version"
static

Definition at line 401 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ s_szWinlogon

const WCHAR s_szWinlogon[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
static

Definition at line 403 of file wizard.c.

Referenced by DoWriteInstallationType().

◆ Themes

struct ThemeInfo Themes[]
static
Initial value:
= {
{ MAKEINTRESOURCE(IDB_LAUTUS), IDS_LAUTUS, L"themes\\lautus\\lautus.msstyles" },
{ MAKEINTRESOURCE(IDB_LUNAR), IDS_LUNAR, L"themes\\lunar\\lunar.msstyles" },
{ MAKEINTRESOURCE(IDB_MIZU), IDS_MIZU, L"themes\\mizu\\mizu.msstyles"},
}
#define IDS_LAUTUS
Definition: resource.h:172
#define IDB_LUNAR
Definition: resource.h:25
#define IDB_MIZU
Definition: resource.h:26
#define IDS_CLASSIC
Definition: resource.h:171
#define IDS_LUNAR
Definition: resource.h:173
#define IDS_MIZU
Definition: resource.h:174
#define IDB_LAUTUS
Definition: resource.h:24
#define IDB_CLASSIC
Definition: resource.h:23

Referenced by ThemePageDlgProc().