ReactOS 0.4.17-dev-444-g71ee754
reactos.c File Reference
#include "reactos.h"
#include <winnls.h>
#include <ndk/obfuncs.h>
#include "resource.h"
#include <debug.h>
#include <ndk/exfuncs.h>
#include <delayimp.h>
Include dependency graph for reactos.c:

Go to the source code of this file.

Classes

struct  _FSVOL_CONTEXT
 
struct  _COPYCONTEXT
 
struct  _CLOSABLE_WND_INFO
 

Macros

#define NTOS_MODE_USER
 
#define NDEBUG
 
#define InstallVolume   (InstallPartition->Volume)
 
#define SystemVolume   (SystemPartition->Volume)
 
#define IDS_LIST_COLUMN_FIRST   IDS_INSTALLATION_NAME
 
#define IDS_LIST_COLUMN_LAST   IDS_INSTALLATION_VENDOR
 
#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
 
#define DECLARE_UNICODE_STRING_SIZE(_var, _size)
 
#define DELAYIMP_INSECURE_WRITABLE_HOOKS
 

Typedefs

typedef VOID(NTAPIPGET_ENTRY_DESCRIPTION) (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
typedef VOID(NTAPIPADD_ENTRY_ITEM) (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
typedef struct _FSVOL_CONTEXT FSVOL_CONTEXT
 
typedef struct _FSVOL_CONTEXTPFSVOL_CONTEXT
 
typedef struct _COPYCONTEXT COPYCONTEXT
 
typedef struct _COPYCONTEXTPCOPYCONTEXT
 
typedef struct _CLOSABLE_WND_INFO CLOSABLE_WND_INFO
 
typedef struct _CLOSABLE_WND_INFOPCLOSABLE_WND_INFO
 

Functions

static VOID CenterWindow (HWND hWnd)
 
static HFONT CreateBoldFont (_In_opt_ HFONT hOrigFont, _In_opt_ INT PointSize)
 Create a bold font derived from the provided font.
 
static HFONT CreateTitleFont (_In_opt_ HFONT hOrigFont)
 
size_t LoadAllocStringW (_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
 
size_t FormatAllocStringWV (_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
 
INT DisplayMessageV (_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage, _In_ va_list args)
 
INT __cdecl DisplayMessage (_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
 
INT __cdecl DisplayError (_In_opt_ HWND hWnd, _In_ UINT uIDTitle, _In_ UINT uIDMessage,...)
 
VOID SetWindowResTextW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID)
 
VOID SetWindowResPrintfVW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
 
VOID __cdecl SetWindowResPrintfW (_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID,...)
 
static INT_PTR CALLBACK StartDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK TypeDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL CreateListViewColumns (IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
 
VOID InitGenericComboList (IN HWND hWndList, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
 
PVOID GetSelectedComboListItem (IN HWND hWndList)
 
VOID InitGenericListView (IN HWND hWndList, IN PGENERIC_LIST List, IN PADD_ENTRY_ITEM AddEntryItemProc)
 
PVOID GetSelectedListViewItem (IN HWND hWndList)
 
static VOID NTAPI GetSettingDescription (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
static VOID NTAPI AddNTOSInstallationItem (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
 
static INT_PTR CALLBACK UpgradeRepairDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK DeviceDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK SummaryDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static BOOLEAN NTAPI FormatCallback (_In_ CALLBACKCOMMAND Command, _In_ ULONG Modifier, _In_ PVOID Argument)
 
static BOOLEAN NTAPI ChkdskCallback (_In_ CALLBACKCOMMAND Command, _In_ ULONG Modifier, _In_ PVOID Argument)
 
static FSVOL_OP CALLBACK FsVolCallback (_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
 
static UINT CALLBACK FileCopyCallback (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static VOID __cdecl RegistryStatus (IN REGISTRY_STATUS RegStatus,...)
 
VOID PropSheet_SetCloseCancel (_In_ HWND hWndWiz, _In_ BOOL Enable)
 Enable or disable the Cancel and the Close title-bar property-sheet buttons.
 
static DWORD WINAPI PrepareAndDoCopyThread (IN LPVOID Param)
 
static INT_PTR CALLBACK ProcessDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static BOOL IsShellActive (VOID)
 Detects whether a Windows shell is active.
 
static BOOL CALLBACK FindUserClosableWindowProc (_In_ HWND hWnd, _In_ LPARAM lParam)
 
static BOOL AreThereInteractiveWindows (_In_opt_ HWND hWndExclude)
 Detects whether there exist interactive closable windows opened.
 
static INT_PTR CALLBACK FinishDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL LoadSetupData (IN OUT PSETUPDATA pSetupData)
 
VOID InitNtToWin32PathMappingList (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
 
VOID FreeNtToWin32PathMappingList (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
 
BOOL ConvertNtPathToWin32Path (IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList, OUT PWSTR pwszPath, IN DWORD cchPathMax, IN PCWSTR pwszNTPath)
 
BOOL EnablePrivilege (IN LPCWSTR lpszPrivilegeName, IN BOOL bEnablePrivilege)
 
static DWORD CALLBACK HotkeyThread (LPVOID Parameter)
 
static PCWSTR GetLocalSetupDllPath (VOID)
 
static FARPROC WINAPI setupDelayHook (unsigned dliNotify, PDelayLoadInfo pdli)
 Controls the delay-loading of Setup DLLs from a suitable path.
 
int WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
 

Variables

HANDLE ProcessHeap
 
SETUPDATA SetupData
 
static BOOLEAN IsUnattendedSetup
 
PPARTENTRY InstallPartition = NULL
 
PPARTENTRY SystemPartition = NULL
 
UI_CONTEXT UiContext
 
static const UINT column_ids [MAX_LIST_COLUMNS] = {IDS_LIST_COLUMN_FIRST, IDS_LIST_COLUMN_FIRST + 1, IDS_LIST_COLUMN_FIRST + 2}
 
static const INT column_widths [MAX_LIST_COLUMNS] = {200, 150, 100}
 
static const INT column_alignment [MAX_LIST_COLUMNS] = {LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT}
 
PfnDliHook __pfnDliNotifyHook2 = setupDelayHook
 Custom delay-loading hooks for loading the Setup DLLs from a suitable path.
 
PfnDliHook __pfnDliFailureHook2 = setupDelayHook
 

Macro Definition Documentation

◆ DECLARE_UNICODE_STRING_SIZE

#define DECLARE_UNICODE_STRING_SIZE (   _var,
  _size 
)
Value:
WCHAR _var ## _buffer[_size]; \
UNICODE_STRING _var = { 0, (_size) * sizeof(WCHAR) , _var ## _buffer }
short WCHAR
Definition: pedump.c:58

Definition at line 3167 of file reactos.c.

◆ DELAYIMP_INSECURE_WRITABLE_HOOKS

#define DELAYIMP_INSECURE_WRITABLE_HOOKS

Definition at line 3172 of file reactos.c.

◆ IDS_LIST_COLUMN_FIRST

#define IDS_LIST_COLUMN_FIRST   IDS_INSTALLATION_NAME

Definition at line 786 of file reactos.c.

◆ IDS_LIST_COLUMN_LAST

#define IDS_LIST_COLUMN_LAST   IDS_INSTALLATION_VENDOR

Definition at line 787 of file reactos.c.

◆ InstallVolume

#define InstallVolume   (InstallPartition->Volume)

Definition at line 30 of file reactos.c.

◆ MAX_LIST_COLUMNS

#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)

Definition at line 789 of file reactos.c.

◆ NDEBUG

#define NDEBUG

Definition at line 18 of file reactos.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 13 of file reactos.c.

◆ SystemVolume

#define SystemVolume   (SystemPartition->Volume)

Definition at line 35 of file reactos.c.

Typedef Documentation

◆ CLOSABLE_WND_INFO

◆ COPYCONTEXT

◆ FSVOL_CONTEXT

◆ PADD_ENTRY_ITEM

typedef VOID(NTAPI * PADD_ENTRY_ITEM) (IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)

Definition at line 653 of file reactos.c.

◆ PCLOSABLE_WND_INFO

◆ PCOPYCONTEXT

◆ PFSVOL_CONTEXT

◆ PGET_ENTRY_DESCRIPTION

typedef VOID(NTAPI * PGET_ENTRY_DESCRIPTION) (IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)

Definition at line 596 of file reactos.c.

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hInst,
HINSTANCE  hPrevInstance,
LPTSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 3250 of file reactos.c.

3254{
3255 ULONG Error;
3256 HANDLE hHotkeyThread;
3258 PROPSHEETHEADER psh;
3259 HPROPSHEETPAGE ahpsp[9];
3260 PROPSHEETPAGE psp = {0};
3261 UINT nPages = 0;
3262
3264
3269
3270 /* Initialize the NT to Win32 path prefix mapping list */
3272
3273 /* Initialize Setup */
3276 if (Error != ERROR_SUCCESS)
3277 {
3278 //
3279 // TODO: Write an error mapper (much like the MUIDisplayError of USETUP)
3280 //
3282 MessageBoxW(NULL, L"GetSourcePaths failed!", L"Error", MB_ICONERROR);
3283 else if (Error == ERROR_LOAD_TXTSETUPSIF)
3285 else // FIXME!!
3286 MessageBoxW(NULL, L"Unknown error!", L"Error", MB_ICONERROR);
3287
3288 goto Quit;
3289 }
3290
3291 /* Retrieve any supplemental options from the unattend file */
3293
3294 /* Load extra setup data (HW lists etc...) */
3295 if (!LoadSetupData(&SetupData))
3296 goto Quit;
3297
3298 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
3299
3300 /* Whenever any of the common controls are used in your app,
3301 * you must call InitCommonControlsEx() to register the classes
3302 * for those controls. */
3303 iccx.dwSize = sizeof(iccx);
3305 InitCommonControlsEx(&iccx);
3306
3307 /* Register the TreeList control */
3308 // RegisterTreeListClass(hInst);
3310
3311 /* Create the title and bold fonts */
3314
3315 if (!SetupData.bUnattend)
3316 {
3317 /* Create the Start page */
3318 psp.dwSize = sizeof(psp);
3319 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3320 psp.hInstance = hInst;
3321 psp.lParam = (LPARAM)&SetupData;
3322 psp.pfnDlgProc = StartDlgProc;
3323 psp.pszTemplate = MAKEINTRESOURCEW(IDD_STARTPAGE);
3324 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3325
3326 /* Create the Install type selection page */
3327 psp.dwSize = sizeof(psp);
3328 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3329 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_TYPETITLE);
3330 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_TYPESUBTITLE);
3331 psp.hInstance = hInst;
3332 psp.lParam = (LPARAM)&SetupData;
3333 psp.pfnDlgProc = TypeDlgProc;
3334 psp.pszTemplate = MAKEINTRESOURCEW(IDD_TYPEPAGE);
3335 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3336
3337 /* Create the Upgrade/Repair selection page */
3338 psp.dwSize = sizeof(psp);
3339 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3340 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_UPDATETITLE);
3341 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_UPDATESUBTITLE);
3342 psp.hInstance = hInst;
3343 psp.lParam = (LPARAM)&SetupData;
3344 psp.pfnDlgProc = UpgradeRepairDlgProc;
3345 psp.pszTemplate = MAKEINTRESOURCEW(IDD_UPDATEREPAIRPAGE);
3346 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3347
3348 /* Create the Device Settings page */
3349 psp.dwSize = sizeof(psp);
3350 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3351 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_DEVICETITLE);
3352 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_DEVICESUBTITLE);
3353 psp.hInstance = hInst;
3354 psp.lParam = (LPARAM)&SetupData;
3355 psp.pfnDlgProc = DeviceDlgProc;
3356 psp.pszTemplate = MAKEINTRESOURCEW(IDD_DEVICEPAGE);
3357 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3358
3359 /* Create the Install device settings page / boot method / install directory */
3360 psp.dwSize = sizeof(psp);
3361 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3362 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_DRIVETITLE);
3363 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_DRIVESUBTITLE);
3364 psp.hInstance = hInst;
3365 psp.lParam = (LPARAM)&SetupData;
3366 psp.pfnDlgProc = DriveDlgProc;
3367 psp.pszTemplate = MAKEINTRESOURCEW(IDD_DRIVEPAGE);
3368 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3369
3370 /* Create the Summary page */
3371 psp.dwSize = sizeof(psp);
3372 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3373 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_SUMMARYTITLE);
3374 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_SUMMARYSUBTITLE);
3375 psp.hInstance = hInst;
3376 psp.lParam = (LPARAM)&SetupData;
3377 psp.pfnDlgProc = SummaryDlgProc;
3378 psp.pszTemplate = MAKEINTRESOURCEW(IDD_SUMMARYPAGE);
3379 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3380 }
3381
3382 /* Create the Installation Progress page */
3383 psp.dwSize = sizeof(psp);
3384 psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
3385 psp.pszHeaderTitle = MAKEINTRESOURCEW(IDS_PROCESSTITLE);
3386 psp.pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_PROCESSSUBTITLE);
3387 psp.hInstance = hInst;
3388 psp.lParam = (LPARAM)&SetupData;
3389 psp.pfnDlgProc = ProcessDlgProc;
3390 psp.pszTemplate = MAKEINTRESOURCEW(IDD_PROCESSPAGE);
3391 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3392
3393 /* Create the Finish page */
3394 psp.dwSize = sizeof(psp);
3395 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3396 psp.hInstance = hInst;
3397 psp.lParam = (LPARAM)&SetupData;
3398 psp.pfnDlgProc = FinishDlgProc;
3399 psp.pszTemplate = MAKEINTRESOURCEW(IDD_FINISHPAGE);
3400 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3401
3402 /* Create the Abort page */
3403 psp.dwSize = sizeof(psp);
3404 psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
3405 psp.hInstance = hInst;
3406 psp.lParam = (LPARAM)&SetupData;
3407 psp.pfnDlgProc = FinishDlgProc; // Same dialog procedure as the Finish page.
3408 psp.pszTemplate = MAKEINTRESOURCEW(IDD_ABORTPAGE);
3409 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3410
3411 /* Create the property sheet */
3412 psh.dwSize = sizeof(psh);
3413 psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
3414 psh.hInstance = hInst;
3415 psh.hwndParent = NULL;
3416 psh.nPages = nPages;
3417 psh.nStartPage = 0;
3418 psh.phpage = ahpsp;
3419 psh.pszbmWatermark = MAKEINTRESOURCEW(IDB_WATERMARK);
3420 psh.pszbmHeader = MAKEINTRESOURCEW(IDB_HEADER);
3421
3422 /* Display the wizard */
3423 PropertySheet(&psh);
3424
3425 /* Wait for any pending installation */
3431
3432 if (SetupData.hBoldFont)
3436
3437 /* Unregister the TreeList control */
3438 // UnregisterTreeListClass(hInst);
3440
3441 if (hHotkeyThread)
3442 {
3443 PostThreadMessageW(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
3444 CloseHandle(hHotkeyThread);
3445 }
3446
3447Quit:
3448 /* Setup has finished */
3450
3451 /* Free the NT to Win32 path prefix mapping list */
3453
3454 /* Force reboot if there are no other user-interactive windows opened */
3456
3457 /* System rebooting will be done by Winlogon if necessary */
3459 {
3460#if 1 // TESTING: Disable for testing the installer locally.
3464#else
3465 DisplayMessage(NULL, MB_ICONWARNING, L"Restarting", L"Setup is now restarting your computer!");
3466#endif
3467 }
3468 return 0;
3469}
#define IDB_HEADER
Definition: resource.h:30
static INT_PTR CALLBACK ProcessDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:2270
static INT_PTR CALLBACK TypeDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:423
static HFONT CreateBoldFont(_In_opt_ HFONT hOrigFont, _In_opt_ INT PointSize)
Create a bold font derived from the provided font.
Definition: reactos.c:71
static BOOL AreThereInteractiveWindows(_In_opt_ HWND hWndExclude)
Detects whether there exist interactive closable windows opened.
Definition: reactos.c:2451
HANDLE ProcessHeap
Definition: reactos.c:23
BOOL LoadSetupData(IN OUT PSETUPDATA pSetupData)
Definition: reactos.c:2666
static INT_PTR CALLBACK UpgradeRepairDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:795
static HFONT CreateTitleFont(_In_opt_ HFONT hOrigFont)
Definition: reactos.c:105
INT __cdecl DisplayError(_In_opt_ HWND hWnd, _In_ UINT uIDTitle, _In_ UINT uIDMessage,...)
Definition: reactos.c:262
static INT_PTR CALLBACK FinishDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:2469
VOID FreeNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:2766
static INT_PTR CALLBACK DeviceDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:987
static INT_PTR CALLBACK SummaryDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:1097
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:243
VOID InitNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:2758
static BOOLEAN IsUnattendedSetup
Definition: reactos.c:25
static INT_PTR CALLBACK StartDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: reactos.c:353
SETUPDATA SetupData
Definition: reactos.c:24
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: reactos.c:3076
BOOL EnablePrivilege(IN LPCWSTR lpszPrivilegeName, IN BOOL bEnablePrivilege)
Definition: reactos.c:3046
#define IDS_TYPETITLE
Definition: resource.h:98
#define IDD_DRIVEPAGE
Definition: resource.h:49
#define IDS_DRIVESUBTITLE
Definition: resource.h:105
#define IDS_PROCESSSUBTITLE
Definition: resource.h:109
#define IDS_TYPESUBTITLE
Definition: resource.h:99
#define IDS_UPDATETITLE
Definition: resource.h:100
#define IDS_PROCESSTITLE
Definition: resource.h:108
#define IDS_UPDATESUBTITLE
Definition: resource.h:101
#define IDS_CAPTION
Definition: resource.h:97
#define IDS_DEVICETITLE
Definition: resource.h:102
#define IDD_ABORTPAGE
Definition: resource.h:78
#define IDD_SUMMARYPAGE
Definition: resource.h:58
#define IDS_DRIVETITLE
Definition: resource.h:104
#define IDB_WATERMARK
Definition: resource.h:13
#define IDD_PROCESSPAGE
Definition: resource.h:69
#define IDS_NO_TXTSETUP_SIF
Definition: resource.h:112
#define IDD_UPDATEREPAIRPAGE
Definition: resource.h:39
#define IDS_SUMMARYTITLE
Definition: resource.h:106
#define IDS_DEVICESUBTITLE
Definition: resource.h:103
#define IDD_FINISHPAGE
Definition: resource.h:74
#define IDS_SUMMARYSUBTITLE
Definition: resource.h:107
#define IDD_TYPEPAGE
Definition: resource.h:33
#define IDD_DEVICEPAGE
Definition: resource.h:43
#define IDD_STARTPAGE
Definition: resource.h:27
BOOL Error
Definition: chkdsk.c:66
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
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
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
INT_PTR CALLBACK DriveDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: drivepage.c:1595
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
HINSTANCE hInst
Definition: dxdiag.c:13
@ ERROR_LOAD_TXTSETUPSIF
Definition: errorcode.h:24
@ ERROR_NO_SOURCE_DRIVE
Definition: errorcode.h:23
unsigned int UINT
Definition: sysinfo.c:13
SPFILE_EXPORTS SpFileExports
Definition: fileqsup.c:23
SPINF_EXPORTS SpInfExports
Definition: infsupp.c:24
LONG_PTR LPARAM
Definition: minwindef.h:175
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define PROPSHEETHEADER
Definition: prsht.h:392
#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 ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
ERROR_NUMBER NTAPI InitializeSetup(_Inout_ PUSETUP_DATA pSetupData, _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine, _In_ PSPFILE_EXPORTS pSpFileExports, _In_ PSPINF_EXPORTS pSpInfExports)
Definition: setuplib.c:1020
BOOLEAN NTAPI CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:32
VOID NTAPI FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1104
USETUP_DATA USetupData
Definition: reactos.h:134
HINSTANCE hInstance
Definition: reactos.h:121
HFONT hBoldFont
Definition: reactos.h:126
HFONT hTitleFont
Definition: reactos.h:125
BOOL bStopInstall
Definition: reactos.h:130
HANDLE hInstallThread
Definition: reactos.h:128
BOOL bMustReboot
Definition: reactos.h:123
HANDLE hHaltInstallEvent
Definition: reactos.h:129
NT_WIN32_PATH_MAPPING_LIST MappingList
Definition: reactos.h:132
BOOL bUnattend
Definition: reactos.h:122
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
int TreeListRegister(HINSTANCE hInstance)
Definition: treelist.c:394
BOOL TreeListUnregister(HINSTANCE hInstance)
Definition: treelist.c:429
uint32_t ULONG
Definition: typedefs.h:59
#define DeleteFont(hfont)
Definition: windowsx.h:78
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:427
#define WM_QUIT
Definition: winuser.h:1651
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
#define EWX_REBOOT
Definition: winuser.h:646
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONWARNING
Definition: winuser.h:797
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ AddNTOSInstallationItem()

static VOID NTAPI AddNTOSInstallationItem ( IN HWND  hWndList,
IN LVITEM plvItem,
IN PGENERIC_LIST_ENTRY  Entry,
IN OUT PWSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 730 of file reactos.c.

736{
738 PVOLINFO VolInfo = (NtOsInstall->Volume ? &NtOsInstall->Volume->Info : NULL);
739
740 if (VolInfo && VolInfo->DriveLetter)
741 {
742 /* We have retrieved a partition that is mounted */
743 StringCchPrintfW(Buffer, cchBufferSize,
744 L"%c:%s",
745 VolInfo->DriveLetter,
746 NtOsInstall->PathComponent);
747 }
748 else
749 {
750 /* We failed somewhere, just show the NT path */
751 StringCchPrintfW(Buffer, cchBufferSize,
752 L"%wZ",
753 &NtOsInstall->SystemNtPath);
754 }
755
756 plvItem->mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
757 plvItem->iItem = 0;
758 plvItem->iSubItem = 0;
759 plvItem->lParam = (LPARAM)Entry;
760 plvItem->pszText = NtOsInstall->InstallationName;
761
762 /* Associate vendor icon */
763 if (FindSubStrI(NtOsInstall->VendorName, VENDOR_REACTOS))
764 {
765 plvItem->mask |= LVIF_IMAGE;
766 plvItem->iImage = 0;
767 }
768 else if (FindSubStrI(NtOsInstall->VendorName, VENDOR_MICROSOFT))
769 {
770 plvItem->mask |= LVIF_IMAGE;
771 plvItem->iImage = 1;
772 }
773
774 plvItem->iItem = SendMessageW(hWndList, LVM_INSERTITEMW, 0, (LPARAM)plvItem);
775
776 plvItem->iSubItem = 1;
777 plvItem->pszText = Buffer; // SystemRootPath;
778 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
779
780 plvItem->iSubItem = 2;
781 plvItem->pszText = NtOsInstall->VendorName;
782 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
783}
static HWND hWndList[5+1]
Definition: SetParent.c:10
Definition: bufpool.h:45
PVOID NTAPI GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:134
#define VENDOR_MICROSOFT
Definition: osdetect.h:13
struct _NTOS_INSTALLATION * PNTOS_INSTALLATION
#define VENDOR_REACTOS
Definition: osdetect.h:12
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2692
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVIF_IMAGE
Definition: commctrl.h:2315
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
Entry
Definition: section.c:5216
LPTSTR FindSubStrI(LPCTSTR str, LPCTSTR strSearch)
Definition: stringutils.c:183
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
WCHAR InstallationName[MAX_PATH]
Definition: osdetect.h:26
UNICODE_STRING SystemNtPath
Definition: osdetect.h:21
WCHAR VendorName[MAX_PATH]
Definition: osdetect.h:27
PVOLENTRY Volume
Definition: osdetect.h:25
PCWSTR PathComponent
Definition: osdetect.h:22
VOLINFO Info
Definition: partlist.h:47
WCHAR DriveLetter
Definition: volutil.h:20
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by UpgradeRepairDlgProc().

◆ AreThereInteractiveWindows()

static BOOL AreThereInteractiveWindows ( _In_opt_ HWND  hWndExclude)
static

Detects whether there exist interactive closable windows opened.

Definition at line 2451 of file reactos.c.

2453{
2454 /* Return success if a shell is active */
2455 if (IsShellActive())
2456 {
2457 return TRUE;
2458 }
2459 /* Otherwise, check for user-interactive closable windows */
2460 else
2461 {
2462 CLOSABLE_WND_INFO Info = {hWndExclude, FALSE};
2464 return Info.Found;
2465 }
2466}
static BOOL IsShellActive(VOID)
Detects whether a Windows shell is active.
Definition: reactos.c:2393
static BOOL CALLBACK FindUserClosableWindowProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: reactos.c:2416
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by _tWinMain(), and FinishDlgProc().

◆ CenterWindow()

static VOID CenterWindow ( HWND  hWnd)
static

Definition at line 44 of file reactos.c.

45{
47 RECT rcParent;
48 RECT rcWindow;
49
51 if (hWndParent == NULL)
53
54 GetWindowRect(hWndParent, &rcParent);
55 GetWindowRect(hWnd, &rcWindow);
56
59 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
60 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
61 0,
62 0,
64}
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
HWND WINAPI GetParent(_In_ HWND)

Referenced by CEditCompatModes::OnInitDialog(), CConfirmReplace::OnInitDialog(), CZipPassword::OnInitDialog(), and StartDlgProc().

◆ ChkdskCallback()

static BOOLEAN NTAPI ChkdskCallback ( _In_ CALLBACKCOMMAND  Command,
_In_ ULONG  Modifier,
_In_ PVOID  Argument 
)
static

Definition at line 1354 of file reactos.c.

1358{
1359 switch (Command)
1360 {
1361 default:
1362 DPRINT("Unknown callback %lu\n", (ULONG)Command);
1363 break;
1364 }
1365
1366 return TRUE;
1367}
#define DPRINT
Definition: sndvol32.h:73
Definition: shell.h:41

◆ ConvertNtPathToWin32Path()

BOOL ConvertNtPathToWin32Path ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList,
OUT PWSTR  pwszPath,
IN DWORD  cchPathMax,
IN PCWSTR  pwszNTPath 
)

Definition at line 2787 of file reactos.c.

2792{
2793 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
2794 PLIST_ENTRY ListEntry;
2796 PCWSTR pwszNtPathToMap = pwszNTPath;
2797 PCWSTR pwszRemaining = NULL;
2798 DWORD cchDrives;
2799 PWCHAR pwszDrive;
2800 WCHAR wszDrives[512];
2801 WCHAR wszNTPath[MAX_PATH];
2802 WCHAR TargetPath[MAX_PATH];
2803
2804 *pwszPath = UNICODE_NULL;
2805
2806 /*
2807 * We find first a mapping inside the MappingList. If one is found, use it
2808 * to build the Win32 path. If there is none, we need to create one by
2809 * checking the Win32 drives (and possibly NT symlinks too).
2810 * In case of success, add the newly found mapping to the list and use it
2811 * to build the Win32 path.
2812 */
2813
2814 for (ListEntry = MappingList->List.Flink;
2815 ListEntry != &MappingList->List;
2816 ListEntry = ListEntry->Flink)
2817 {
2818 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2819
2820 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
2821
2822 /* Check whether the queried NT path prefixes the user-provided NT path */
2823 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
2824 if (FoundDrive)
2825 {
2826 /* Found it! */
2827
2828 /* Set the pointers and go build the Win32 path */
2829 pwszDrive = Entry->Win32Path;
2830 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
2831 goto Quit;
2832 }
2833 }
2834
2835 /*
2836 * No mapping exists for this path yet: try to find one now.
2837 */
2838
2839 /* Retrieve the mounted drives (available drive letters) */
2840 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
2841 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
2842 {
2843 /* Buffer too small or failure */
2844 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
2845 return FALSE;
2846 }
2847
2848/* We go back there once if RetryOnce == TRUE */
2849Retry:
2850
2851 /* Enumerate the mounted drives */
2852 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
2853 {
2854 /* Retrieve the NT path corresponding to the current Win32 DOS path */
2855 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
2856 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
2857 pwszDrive[2] = L'\\'; // Restore the backslash
2858
2859 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
2860
2861 /* Check whether the queried NT path prefixes the user-provided NT path */
2862 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2863 if (!FoundDrive)
2864 {
2865 PWCHAR ptr, ptr2;
2866
2867 /*
2868 * Check whether this was a network share that has a drive letter,
2869 * but the user-provided NT path points to this share without
2870 * mentioning the drive letter.
2871 *
2872 * The format is: \Device<network_redirector>\;X:<data>\share\path
2873 * The corresponding drive letter is 'X'.
2874 * A system-provided network redirector (LanManRedirector or Mup)
2875 * or a 3rd-party one may be used.
2876 *
2877 * We check whether the user-provided NT path has the form:
2878 * \Device<network_redirector><data>\share\path
2879 * as it obviously did not have the full form (the previous check
2880 * would have been OK otherwise).
2881 */
2882 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
2883 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
2884 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
2885 {
2886 /*
2887 * Normally the specified drive letter should correspond
2888 * to the one used for the mapping. But we will ignore
2889 * if it happens not to be the case.
2890 */
2891 if (pwszDrive[0] != ptr[1])
2892 {
2893 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
2894 pwszDrive[0], ptr[1]);
2895 }
2896
2897 /* Remove the drive letter from the NT network share path */
2898 ptr2 = ptr + 3;
2899 /* Swallow as many possible consecutive backslashes as there could be */
2900 while (*ptr2 == L'\\') ++ptr2;
2901
2902 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
2903
2904 /* Now do the check again */
2905 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
2906 }
2907 }
2908 if (FoundDrive)
2909 {
2910 /* Found it! */
2911
2912 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
2913
2914 if (pwszNtPathToMap == pwszNTPath)
2915 {
2916 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
2917 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
2918 }
2919 break;
2920 }
2921 }
2922
2923 if (FoundDrive)
2924 {
2925 /* A mapping was found, add it to the cache */
2927 if (!Entry)
2928 {
2929 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
2930 return FALSE;
2931 }
2932 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
2933 pwszNTPath, pwszRemaining - pwszNTPath);
2934 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
2935
2936 /* Insert it as the most recent entry */
2937 InsertHeadList(&MappingList->List, &Entry->ListEntry);
2938 MappingList->MappingsCount++;
2939
2940 /* Set the pointers and go build the Win32 path */
2941 pwszDrive = Entry->Win32Path;
2942 goto Quit;
2943 }
2944
2945 /*
2946 * We failed, perhaps because the beginning of the NT path used a symlink.
2947 * Try to see whether this is the case by attempting to resolve it.
2948 * If the symlink resolution gives nothing, or we already failed once,
2949 * there is no hope in converting the path to Win32.
2950 * Otherwise, symlink resolution succeeds but we need to recheck again
2951 * the drives list.
2952 */
2953
2954 /*
2955 * In theory we would have to parse each element in the NT path and going
2956 * until finding a symlink object (otherwise we would fail straight away).
2957 * However here we can use guessing instead, since we know which kind of
2958 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
2959 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
2960 * are supported in setuplib\utils\arcname.c .
2961 *
2962 * But actually, all the supported names in arcname.c are real devices,
2963 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
2964 * just check for it.
2965 */
2966 if (!RetryOnce && !FoundDrive)
2967 {
2968 ULONG DiskNumber, PartitionNumber;
2969 INT Length;
2970
2973 HANDLE LinkHandle;
2974 UNICODE_STRING SymLink, Target;
2975
2976 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
2977 &DiskNumber, &PartitionNumber, &Length) != 2)
2978 {
2979 /* Definitively not a recognized path, bail out */
2980 return FALSE;
2981 }
2982
2983 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
2984 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
2985 SymLink.Length = SymLink.MaximumLength;
2986
2988 &SymLink,
2990 NULL,
2991 NULL);
2992 Status = NtOpenSymbolicLinkObject(&LinkHandle,
2995 if (!NT_SUCCESS(Status))
2996 {
2997 /* Not a symlink, or something else happened: bail out */
2998 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
2999 &SymLink, Status);
3000 return FALSE;
3001 }
3002
3003 *TargetPath = UNICODE_NULL;
3004 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
3005
3006 /* Resolve the link and close its handle */
3008 NtClose(LinkHandle);
3009
3010 /* Check for success */
3011 if (!NT_SUCCESS(Status))
3012 {
3013 /* Not a symlink, or something else happened: bail out */
3014 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
3015 &SymLink, Status);
3016 return FALSE;
3017 }
3018
3019 /* Set the pointers */
3020 pwszRemaining = pwszNTPath + Length;
3021 pwszNtPathToMap = TargetPath; // Point to our local buffer
3022
3023 /* Retry once */
3024 RetryOnce = TRUE;
3025 goto Retry;
3026 }
3027
3028 ASSERT(!FoundDrive);
3029
3030Quit:
3031 if (FoundDrive)
3032 {
3033 StringCchPrintfW(pwszPath, cchPathMax,
3034 L"%s%s",
3035 pwszDrive,
3036 pwszRemaining);
3037 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
3038 return TRUE;
3039 }
3040
3041 return FALSE;
3042}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:312
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define wcschr
Definition: compat.h:17
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
DWORD WINAPI GetLogicalDriveStringsW(IN DWORD nBufferLength, IN LPWSTR lpBuffer)
Definition: disk.c:73
#define SYMBOLIC_LINK_QUERY
Definition: volume.c:47
_ACRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *,...)
Definition: scanf.c:438
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
#define InsertHeadList(ListHead, Entry)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:24
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ASSERT(a)
Definition: mode.c:44
static PVOID ptr
Definition: dispmode.c:27
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3411
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
USHORT MaximumLength
Definition: env_spec_w32.h:370
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061

Referenced by SetupOpenInfFileExW().

◆ CreateBoldFont()

static HFONT CreateBoldFont ( _In_opt_ HFONT  hOrigFont,
_In_opt_ INT  PointSize 
)
static

Create a bold font derived from the provided font.

Definition at line 71 of file reactos.c.

74{
75 LOGFONTW lf = {0};
76
77 if (hOrigFont)
78 {
79 GetObjectW(hOrigFont, sizeof(lf), &lf);
80 }
81 else
82 {
83 NONCLIENTMETRICSW ncm;
84 ncm.cbSize = sizeof(ncm);
85 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
86 lf = ncm.lfMessageFont;
87 }
88
89 /* Make the font bold, keeping the other attributes */
90 lf.lfWeight = FW_BOLD;
91
92 /* Determine the font height (logical units) if necessary */
93 if (PointSize)
94 {
95 HDC hdc = GetDC(NULL);
96 lf.lfHeight = -MulDiv(PointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
97 // lf.lfWidth = 0;
99 }
100
101 return CreateFontIndirect(&lf);
102}
HDC hdc
Definition: main.c:9
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
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define CreateFontIndirect
Definition: wingdi.h:4890
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by _tWinMain(), CreateTitleFont(), and ProgressDlg::ProcessWindowMessage().

◆ CreateListViewColumns()

BOOL CreateListViewColumns ( IN HINSTANCE  hInstance,
IN HWND  hWndListView,
IN const UINT pIDs,
IN const INT pColsWidth,
IN const INT pColsAlign,
IN UINT  nNumOfColumns 
)

Definition at line 564 of file reactos.c.

571{
572 UINT i;
573 LVCOLUMN lvC;
574 WCHAR szText[50];
575
576 /* Create the columns */
577 lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
578 lvC.pszText = szText;
579
580 /* Load the column labels from the resource file */
581 for (i = 0; i < nNumOfColumns; i++)
582 {
583 lvC.iSubItem = i;
584 lvC.cx = pColsWidth[i];
585 lvC.fmt = pColsAlign[i];
586
587 LoadStringW(hInstance, pIDs[i], szText, ARRAYSIZE(szText));
588
589 if (ListView_InsertColumn(hWndListView, i, &lvC) == -1)
590 return FALSE;
591 }
592
593 return TRUE;
594}
HINSTANCE hInstance
Definition: charmap.c:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
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
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2641
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVCOLUMN
Definition: commctrl.h:2586
#define LoadStringW
Definition: utils.h:64

Referenced by UpgradeRepairDlgProc().

◆ CreateTitleFont()

static HFONT CreateTitleFont ( _In_opt_ HFONT  hOrigFont)
inlinestatic

Definition at line 105 of file reactos.c.

107{
108 /* Title font is 12pt bold */
109 return CreateBoldFont(hOrigFont, 12);
110}

Referenced by _tWinMain().

◆ DeviceDlgProc()

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

Definition at line 987 of file reactos.c.

992{
993 PSETUPDATA pSetupData;
994 HWND hList;
995
996 /* Retrieve pointer to the global setup data */
997 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
998
999 switch (uMsg)
1000 {
1001 case WM_INITDIALOG:
1002 {
1003 /* Save pointer to the global setup data */
1004 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1005 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1006
1007 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
1009
1010 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
1012
1013 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
1015
1016 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
1017 // InitGenericComboList(hList, pSetupData->USetupData.LayoutList, GetSettingDescription);
1018
1019 break;
1020 }
1021
1022 case WM_NOTIFY:
1023 {
1024 LPNMHDR lpnm = (LPNMHDR)lParam;
1025
1026 switch (lpnm->code)
1027 {
1028 case PSN_SETACTIVE:
1030 break;
1031
1033 {
1034 /* Focus on "Computer" list */
1036 return TRUE;
1037 }
1038
1039 case PSN_QUERYCANCEL:
1040 {
1041 if (DisplayMessage(GetParent(hwndDlg),
1045 {
1046 /* Go to the Abort page */
1048 }
1049
1050 /* Do not close the wizard too soon */
1052 return TRUE;
1053 }
1054
1055 case PSN_WIZNEXT: /* Set the selected data */
1056 {
1057 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
1060
1061 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
1064
1065 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
1068
1069 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
1070 // SetCurrentListEntry(pSetupData->USetupData.LayoutList,
1071 // GetSelectedComboListItem(hList));
1072
1073 return TRUE;
1074 }
1075
1076 case PSN_WIZBACK:
1077 {
1078 /* Return to the Install type selection page instead of the Repair/Upgrade page */
1080 return TRUE;
1081 }
1082
1083 default:
1084 break;
1085 }
1086 }
1087 break;
1088
1089 default:
1090 break;
1091 }
1092
1093 return FALSE;
1094}
#define IDC_DISPLAY
Definition: resource.h:19
PVOID GetSelectedComboListItem(IN HWND hWndList)
Definition: reactos.c:641
static VOID NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
Definition: reactos.c:719
VOID InitGenericComboList(IN HWND hWndList, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: reactos.c:603
struct _SETUPDATA * PSETUPDATA
#define IDC_KEYBOARD
Definition: resource.h:46
#define IDC_COMPUTER
Definition: resource.h:44
#define IDS_ABORTSETUP2
Definition: resource.h:111
#define IDS_ABORTSETUP
Definition: resource.h:110
LPARAM lParam
Definition: combotst.c:139
VOID NTAPI SetCurrentListEntry(IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:91
HWND hList
Definition: livecd.c:10
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define PSN_WIZNEXT
Definition: prsht.h:121
#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_QUERYINITIALFOCUS
Definition: prsht.h:126
#define PropSheet_SetCurSelByID(d, i)
Definition: prsht.h:354
#define PSN_WIZBACK
Definition: prsht.h:120
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
PGENERIC_LIST DisplayList
Definition: setuplib.h:139
PGENERIC_LIST ComputerList
Definition: setuplib.h:138
PGENERIC_LIST KeyboardList
Definition: setuplib.h:140
UINT code
Definition: winuser.h:3267
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define GetWindowLongPtrW
Definition: winuser.h:4983
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct tagNMHDR * LPNMHDR
#define MB_ICONQUESTION
Definition: winuser.h:800
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5512

Referenced by _tWinMain().

◆ DisplayError()

INT __cdecl DisplayError ( _In_opt_ HWND  hWnd,
_In_ UINT  uIDTitle,
_In_ UINT  uIDMessage,
  ... 
)

Definition at line 262 of file reactos.c.

267{
268 INT iRes;
270
271 va_start(args, uIDMessage);
273 MAKEINTRESOURCEW(uIDTitle),
274 MAKEINTRESOURCEW(uIDMessage),
275 args);
276 va_end(args);
277
278 return iRes;
279}
INT DisplayMessageV(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage, _In_ va_list args)
Definition: reactos.c:173
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define args
Definition: format.c:66
Definition: match.c:390
#define MB_OK
Definition: winuser.h:801

Referenced by _tWinMain(), FsVolCallback(), and PrepareAndDoCopyThread().

◆ DisplayMessage()

◆ DisplayMessageV()

INT DisplayMessageV ( _In_opt_ HWND  hWnd,
_In_ UINT  uType,
_In_opt_ PCWSTR  pszTitle,
_In_opt_ PCWSTR  pszFormatMessage,
_In_ va_list  args 
)

Definition at line 173 of file reactos.c.

179{
180 INT iRes;
182 MSGBOXPARAMSW mb = {0};
184 WCHAR StaticBuffer[256];
185 PWSTR Buffer = StaticBuffer; // Use the static buffer by default.
186
187 /* We need to retrieve the current module's instance handle if either
188 * the title or the format message is specified by a resource ID */
189 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
190 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
191
192 /* Retrieve the format message string if this is a resource */
193 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage))
194 {
195 Format = NULL;
196 (void)LoadAllocStringW(hInstance, PtrToUlong(pszFormatMessage), &Format, 0);
197 }
198 else
199 {
200 Format = (PWSTR)pszFormatMessage;
201 }
202
203 if (Format)
204 {
205 /* Format the message and retrieve its length. If it is too long,
206 * an auxiliary buffer is allocated; otherwise the static buffer
207 * is used. The string is built to be NUL-terminated. */
209 if (!Buffer)
210 {
211 /* Allocation failed, use the original format string verbatim */
212 Buffer = Format;
213 }
214 }
215 else
216 {
217 Format = (PWSTR)pszFormatMessage;
218 Buffer = Format;
219 }
220
221 /* Display the message */
222 mb.cbSize = sizeof(mb);
223 mb.hwndOwner = hWnd;
224 mb.hInstance = hInstance;
225 mb.lpszText = Buffer;
226 mb.lpszCaption = pszTitle;
227 mb.dwStyle = uType;
229 iRes = MessageBoxIndirectW(&mb);
230
231 /* Free the buffers if needed */
232 if ((Buffer != StaticBuffer) && (Buffer != Format))
234
235 if (Format && (Format != pszFormatMessage))
237
238 return iRes;
239}
size_t LoadAllocStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
Definition: reactos.c:113
size_t FormatAllocStringWV(_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
Definition: reactos.c:148
#define HeapFree(x, y, z)
Definition: compat.h:735
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define IS_INTRESOURCE(x)
Definition: loader.c:613
#define PtrToUlong(u)
Definition: config.h:107
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD dwLanguageId
Definition: winuser.h:3453
LPCWSTR lpszCaption
Definition: winuser.h:3448
HWND hwndOwner
Definition: winuser.h:3445
LPCWSTR lpszText
Definition: winuser.h:3447
HINSTANCE hInstance
Definition: winuser.h:3446
DWORD dwStyle
Definition: winuser.h:3449
uint16_t * PWSTR
Definition: typedefs.h:56
int WINAPI MessageBoxIndirectW(_In_ CONST MSGBOXPARAMSW *lpmbp)

Referenced by DisplayError(), and DisplayMessage().

◆ EnablePrivilege()

BOOL EnablePrivilege ( IN LPCWSTR  lpszPrivilegeName,
IN BOOL  bEnablePrivilege 
)

Definition at line 3046 of file reactos.c.

3049{
3050 BOOL Success;
3051 HANDLE hToken;
3053
3056 &hToken);
3057 if (!Success) return Success;
3058
3060 lpszPrivilegeName,
3061 &tp.Privileges[0].Luid);
3062 if (!Success) goto Quit;
3063
3064 tp.PrivilegeCount = 1;
3065 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
3066
3067 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
3068
3069Quit:
3070 CloseHandle(hToken);
3071 return Success;
3072}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define GetCurrentProcess()
Definition: compat.h:759
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
@ Success
Definition: eventcreate.c:712
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:942
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by _tWinMain().

◆ FileCopyCallback()

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

Definition at line 1717 of file reactos.c.

1721{
1723 PFILEPATHS_W FilePathInfo;
1724 PCWSTR SrcFileName, DstFileName;
1725
1726 WaitForSingleObject(CopyContext->pSetupData->hHaltInstallEvent, INFINITE);
1727 if (CopyContext->pSetupData->bStopInstall)
1728 return FILEOP_ABORT; // Stop committing files
1729
1730 switch (Notification)
1731 {
1733 {
1734 CopyContext->TotalOperations = (ULONG)Param2;
1735 CopyContext->CompletedOperations = 0;
1736
1737 /* Set up the progress bar */
1739 PBM_SETRANGE, 0,
1740 MAKELPARAM(0, CopyContext->TotalOperations));
1742 PBM_SETSTEP, 1, 0);
1744 PBM_SETPOS, 0, 0);
1745 break;
1746 }
1747
1751 {
1752 FilePathInfo = (PFILEPATHS_W)Param1;
1753
1755 {
1756 /* Display delete message */
1757 ASSERT(Param2 == FILEOP_DELETE);
1758
1759 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1760 if (DstFileName) ++DstFileName;
1761 else DstFileName = FilePathInfo->Target;
1762
1765 IDS_DELETING, // STRING_DELETING
1766 DstFileName);
1767 }
1769 {
1770 UINT uMsgID;
1771
1772 /* Display move/rename message */
1773 ASSERT(Param2 == FILEOP_RENAME);
1774
1775 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
1776 if (SrcFileName) ++SrcFileName;
1777 else SrcFileName = FilePathInfo->Source;
1778
1779 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1780 if (DstFileName) ++DstFileName;
1781 else DstFileName = FilePathInfo->Target;
1782
1783 if (!_wcsicmp(SrcFileName, DstFileName))
1784 uMsgID = IDS_MOVING; // STRING_MOVING
1785 else
1786 uMsgID = IDS_RENAMING; // STRING_RENAMING
1789 uMsgID,
1790 SrcFileName, DstFileName);
1791 }
1793 {
1794 /* Display copy message */
1795 ASSERT(Param2 == FILEOP_COPY);
1796
1797 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1798 if (DstFileName) ++DstFileName;
1799 else DstFileName = FilePathInfo->Target;
1800
1803 IDS_COPYING, // STRING_COPYING
1804 DstFileName);
1805 }
1806 break;
1807 }
1808
1810 {
1811 FilePathInfo = (PFILEPATHS_W)Param1;
1812
1813 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
1814 FilePathInfo->Target, FilePathInfo->Win32Error);
1815 return FILEOP_SKIP;
1816 }
1817
1821 {
1822 CopyContext->CompletedOperations++;
1823
1824 /* SYSREG checkpoint */
1825 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
1826 DPRINT1("CHECKPOINT:HALF_COPIED\n");
1827
1829 break;
1830 }
1831 }
1832
1833 return FILEOP_DOIT;
1834}
VOID __cdecl SetWindowResPrintfW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID,...)
Definition: reactos.c:339
struct _COPYCONTEXT * PCOPYCONTEXT
UI_CONTEXT UiContext
Definition: reactos.c:38
#define IDS_DELETING
Definition: resource.h:145
#define IDS_MOVING
Definition: resource.h:143
#define IDS_COPYING
Definition: resource.h:142
#define IDS_RENAMING
Definition: resource.h:144
#define wcsrchr
Definition: compat.h:16
BOOL WINAPI CopyContext(CONTEXT *dst, DWORD context_flags, CONTEXT *src)
Definition: memory.c:1633
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define SPFILENOTIFY_ENDDELETE
Definition: fileqsup.h:28
#define FILEOP_COPY
Definition: fileqsup.h:42
struct _FILEPATHS_W * PFILEPATHS_W
#define FILEOP_SKIP
Definition: fileqsup.h:49
#define SPFILENOTIFY_STARTDELETE
Definition: fileqsup.h:27
#define SPFILENOTIFY_STARTSUBQUEUE
Definition: fileqsup.h:24
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define SPFILENOTIFY_ENDCOPY
Definition: fileqsup.h:36
#define SPFILENOTIFY_STARTCOPY
Definition: fileqsup.h:35
#define SPFILENOTIFY_COPYERROR
Definition: fileqsup.h:37
#define FILEOP_RENAME
Definition: fileqsup.h:43
#define SPFILENOTIFY_STARTRENAME
Definition: fileqsup.h:31
#define SPFILENOTIFY_ENDRENAME
Definition: fileqsup.h:32
#define FILEOP_DELETE
Definition: fileqsup.h:44
#define FILEOP_ABORT
Definition: fileqsup.h:47
#define PBM_SETSTEP
Definition: commctrl.h:2191
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_SETRANGE
Definition: commctrl.h:2188
#define PBM_STEPIT
Definition: commctrl.h:2192
_In_ PVOID Context
Definition: storport.h:2269
UINT Win32Error
Definition: fileqsup.h:62
PCWSTR Source
Definition: fileqsup.h:61
PCWSTR Target
Definition: fileqsup.h:60
HWND hWndItem
Definition: reactos.h:72
HWND hWndProgress
Definition: reactos.h:73
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
#define MAKELPARAM(l, h)
Definition: winuser.h:4116

Referenced by PrepareAndDoCopyThread().

◆ FindUserClosableWindowProc()

static BOOL CALLBACK FindUserClosableWindowProc ( _In_ HWND  hWnd,
_In_ LPARAM  lParam 
)
static

Definition at line 2416 of file reactos.c.

2419{
2421 HMENU hSysMenu;
2422 MENUITEMINFOW mii;
2423
2424 /* Skip the window to exclude */
2425 if (hWnd == pInfo->hWndExclude)
2426 return TRUE;
2427
2428 /* Skip non-interactive windows */
2430 return TRUE;
2431
2432 hSysMenu = GetSystemMenu(hWnd, FALSE);
2433 if (!hSysMenu)
2434 return TRUE; /* No menu: skip the window */
2435
2436 mii.cbSize = sizeof(mii);
2437 mii.fMask = MIIM_STATE;
2438 if (!GetMenuItemInfoW(hSysMenu, SC_CLOSE, FALSE, &mii))
2439 return TRUE; /* No close item: skip the window */
2440
2441 pInfo->Found |= !(mii.fState & MFS_DISABLED);
2442
2443 /* Continue enumeration (return TRUE) if no close item is enabled;
2444 * otherwise stop the enumeration (return FALSE) */
2445 return !pInfo->Found;
2446}
struct _CLOSABLE_WND_INFO * PCLOSABLE_WND_INFO
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL Found
TRUE if a closable window was found; FALSE if not.
Definition: reactos.c:2412
HWND hWndExclude
Window to exclude from search.
Definition: reactos.c:2411
#define MFS_DISABLED
Definition: winuser.h:760
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
#define MIIM_STATE
Definition: winuser.h:732
#define SC_CLOSE
Definition: winuser.h:2628
BOOL WINAPI IsWindowEnabled(_In_ HWND)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by AreThereInteractiveWindows().

◆ FinishDlgProc()

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

Definition at line 2469 of file reactos.c.

2474{
2475 PSETUPDATA pSetupData;
2476
2477 /* Retrieve pointer to the global setup data */
2478 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
2479
2480 switch (uMsg)
2481 {
2482 case WM_INITDIALOG:
2483 {
2485
2486 /* Save pointer to the global setup data */
2487 pSetupData = (PSETUPDATA)ppsp->lParam;
2488 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
2489
2490 /* Set the stop-install flag if the user is aborting
2491 * the installation: TRUE if Abort, FALSE if Finish. */
2492 pSetupData->bStopInstall = (ppsp->pszTemplate == MAKEINTRESOURCEW(IDD_ABORTPAGE));
2493
2494 /* Set title font */
2495 SetDlgItemFont(hwndDlg, IDC_FINISHTITLE, pSetupData->hTitleFont, TRUE);
2496
2497 /* We need to reboot at the end of the installation if this is an
2498 * unattended setup, or if there is no shell active. If there are
2499 * other user-interactive windows opened, we pause in WM_ACTIVATE
2500 * the inevitable reboot countdown when the wizard is deactivated,
2501 * and restart it when the wizard is reactivated. */
2502 pSetupData->bMustReboot = SetupData.bUnattend;
2503 pSetupData->bMustReboot |= !IsShellActive();
2504
2505 /* If we must reboot, display the countdown gauge. In any
2506 * case, let the user restart now or postpone it to later. */
2507 if (pSetupData->bMustReboot)
2508 {
2509 /* "Setup will now restart your computer..." is shown */
2512 }
2513 else
2514 {
2515 /* We should not reboot automatically, change the finish
2516 * text to "Setup needs to restart your computer..." */
2517 UINT uMsgID = (!pSetupData->bStopInstall ? IDS_FINISH_NO_REBOOT
2520 pSetupData->hInstance,
2521 uMsgID);
2522
2523 /* Hide and disable the countdown gauge */
2526 }
2527
2528 /* If the installation is aborted, change the "Cancel" button text to "Close" */
2529 if (pSetupData->bStopInstall)
2530 {
2532 GetModuleHandleW(L"comctl32.dll"),
2533 IDS_CLOSE);
2534 }
2535
2536 /* Ensure that the installer wizard window is made visible and focused */
2537 ShowWindow(GetParent(hwndDlg), SW_SHOW);
2539 break;
2540 }
2541
2542 case WM_DESTROY:
2543 return TRUE;
2544
2545 case WM_ACTIVATE:
2546 {
2547 /* Only care about (de)activation only if we must reboot */
2548 if (!pSetupData->bMustReboot)
2549 break;
2550
2551 if (LOWORD(wParam) == WA_INACTIVE)
2552 {
2553 /* Wizard window is deactivated, check whether there are
2554 * interactive windows. If so, pause the countdown. */
2556 KillTimer(hwndDlg, 1);
2557 }
2558 else
2559 {
2560 /* Wizard window is reactivated, re-enable the countdown */
2561 SetTimer(hwndDlg, 1, 50, NULL);
2562 }
2563 break;
2564 }
2565
2566 case WM_TIMER:
2567 {
2568 HWND hWndProgress;
2569 INT Position;
2570
2571 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2572 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2573 if (Position == 300)
2574 {
2575 KillTimer(hwndDlg, 1);
2577 }
2578 else
2579 {
2580 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2581 }
2582 return TRUE;
2583 }
2584
2585 case WM_NOTIFY:
2586 {
2587 LPNMHDR lpnm = (LPNMHDR)lParam;
2588
2589 switch (lpnm->code)
2590 {
2591 case PSN_SETACTIVE:
2592 {
2593 HWND hWndParent = GetParent(hwndDlg);
2594
2595 /* Only "Finish" for closing the wizard, and hide "Back" and "Next" */
2597 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2600
2601 /* Change the "Finish" button text to "Restart" */
2603 pSetupData->hInstance,
2605
2606 if (pSetupData->bMustReboot)
2607 {
2608 RECT rcBtn1, rcBtn2;
2609
2610 /* Move the "Finish"/"Restart" button to where the "Close"/"Cancel" button is */
2612 MapWindowPoints(HWND_DESKTOP /*NULL*/, hWndParent, (LPPOINT)&rcBtn1, sizeof(RECT)/sizeof(POINT));
2614 MapWindowPoints(HWND_DESKTOP /*NULL*/, hWndParent, (LPPOINT)&rcBtn2, sizeof(RECT)/sizeof(POINT));
2616 HWND_TOP,
2617 rcBtn1.left + (rcBtn2.right - rcBtn1.right),
2618 rcBtn1.top,
2619 0, 0,
2621
2622 /* Hide and disable also the "Close"/"Cancel" buttons since we can only finish now */
2625
2626 /* Set up the reboot progress bar and countdown timer.
2627 * 300 steps at 50 ms each: 15 seconds */
2630 SetTimer(hwndDlg, 1, 50, NULL);
2631 }
2632 else if (!pSetupData->bStopInstall)
2633 {
2634 /* Keep the "Cancel" button shown and change its text to "Postpone" */
2635 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT);
2637 pSetupData->hInstance,
2639 }
2640
2641 break;
2642 }
2643
2644 case PSN_WIZNEXT:
2645 case PSN_WIZFINISH:
2646 {
2647 /* Press on "Finish"/"Restart" button */
2648 pSetupData->bMustReboot = TRUE;
2650 }
2651 case PSN_QUERYCANCEL:
2652 /* Press on "Cancel"/"Postpone" button */
2653 default:
2654 break;
2655 }
2656 break;
2657 }
2658
2659 default:
2660 break;
2661 }
2662
2663 return FALSE;
2664}
VOID PropSheet_SetCloseCancel(_In_ HWND hWndWiz, _In_ BOOL Enable)
Enable or disable the Cancel and the Close title-bar property-sheet buttons.
Definition: reactos.c:1876
VOID SetWindowResTextW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID)
Definition: reactos.c:282
#define IDS_CLOSE
Definition: reactos.h:41
#define ShowDlgItem(hDlg, nID, nCmdShow)
Definition: reactos.h:34
#define ID_WIZFINISH
Definition: reactos.h:48
#define SetDlgItemFont(hDlg, nID, hFont, bRedraw)
Definition: reactos.h:37
#define ID_WIZNEXT
Definition: reactos.h:47
#define ID_WIZBACK
Definition: reactos.h:46
#define IDS_RESTARTBTN
Definition: resource.h:116
#define IDS_ABORT_NO_REBOOT
Definition: resource.h:114
#define IDC_FINISHTEXT
Definition: resource.h:76
#define IDC_FINISHTITLE
Definition: resource.h:75
#define IDS_POSTPONEBTN
Definition: resource.h:117
#define IDS_FINISH_NO_REBOOT
Definition: resource.h:113
#define IDC_RESTART_PROGRESS
Definition: resource.h:77
WPARAM wParam
Definition: combotst.c:138
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
#define LOWORD(l)
Definition: pedump.c:82
#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
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
#define PBM_GETPOS
Definition: commctrl.h:2199
#define __fallthrough
Definition: sal_old.h:314
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTemplate
Definition: prsht.h:218
static COORD Position
Definition: mouse.c:34
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:842
#define WA_INACTIVE
Definition: winuser.h:2664
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define HWND_DESKTOP
Definition: winuser.h:1220
#define WM_ACTIVATE
Definition: winuser.h:1640
#define WM_TIMER
Definition: winuser.h:1770
#define SWP_NOOWNERZORDER
Definition: winuser.h:1260
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define SWP_NOZORDER
Definition: winuser.h:1258
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SendDlgItemMessage
Definition: winuser.h:6008

Referenced by _tWinMain().

◆ FormatAllocStringWV()

size_t FormatAllocStringWV ( _In_opt_ _Outptr_ PWSTR pString,
_In_opt_ size_t  cchBufferLen,
_In_ PCWSTR  pszFormat,
_In_ va_list  args 
)

Definition at line 148 of file reactos.c.

153{
154 size_t Length;
155
156 /* Retrieve the message length. If it is too long, allocate
157 * an auxiliary buffer; otherwise use the caller's buffer. */
158 Length = _vscwprintf(pszFormat, args); // Doesn't count the NUL-terminator.
159 if (!*pString || (Length >= cchBufferLen))
160 {
161 /* Allocate a new buffer, adding a NUL-terminator */
163 if (!*pString)
164 return 0;
165 }
166
167 /* Do the printf */
168 StringCchVPrintfW(*pString, Length + 1, pszFormat, args);
169 return Length;
170}
_ACRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list)
Definition: wcs.c:1787
FxString * pString
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
Definition: strsafe.h:490

Referenced by DisplayMessageV(), and SetWindowResPrintfVW().

◆ FormatCallback()

static BOOLEAN NTAPI FormatCallback ( _In_ CALLBACKCOMMAND  Command,
_In_ ULONG  Modifier,
_In_ PVOID  Argument 
)
static

Definition at line 1306 of file reactos.c.

1310{
1311 switch (Command)
1312 {
1313 case PROGRESS:
1314 {
1315 PULONG Percent = (PULONG)Argument;
1316 DPRINT("%lu percent completed\n", *Percent);
1318 break;
1319 }
1320
1321#if 0
1322 case OUTPUT:
1323 {
1324 PTEXTOUTPUT output = (PTEXTOUTPUT)Argument;
1325 DPRINT("%s\n", output->Output);
1326 break;
1327 }
1328#endif
1329
1330 case DONE:
1331 {
1332#if 0
1333 PBOOLEAN Success = (PBOOLEAN)Argument;
1334 if (*Success == FALSE)
1335 {
1336 DPRINT("FormatEx was unable to complete successfully.\n\n");
1337 }
1338#endif
1339 DPRINT("Done\n");
1340 break;
1341 }
1342
1343 default:
1344 DPRINT("Unknown callback %lu\n", (ULONG)Command);
1345 break;
1346 }
1347
1348 return TRUE;
1349}
#define OUTPUT(ch)
struct TEXTOUTPUT * PTEXTOUTPUT
@ PROGRESS
Definition: fmifs.h:83
#define DONE
Definition: rnr20lib.h:14
PCHAR Output
Definition: fmifs.h:33
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53

Referenced by FsVolCallback().

◆ FreeNtToWin32PathMappingList()

VOID FreeNtToWin32PathMappingList ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList)

Definition at line 2766 of file reactos.c.

2768{
2769 PLIST_ENTRY ListEntry;
2770 PVOID Entry;
2771
2772 while (!IsListEmpty(&MappingList->List))
2773 {
2774 ListEntry = RemoveHeadList(&MappingList->List);
2775 Entry = (PVOID)CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2777 }
2778
2779 MappingList->MappingsCount = 0;
2780}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
void * PVOID
Definition: typedefs.h:50

Referenced by _tWinMain().

◆ FsVolCallback()

static FSVOL_OP CALLBACK FsVolCallback ( _In_opt_ PVOID  Context,
_In_ FSVOLNOTIFY  FormatStatus,
_In_ ULONG_PTR  Param1,
_In_ ULONG_PTR  Param2 
)
static

HACK!!

HACK!!

Definition at line 1372 of file reactos.c.

1377{
1378 PFSVOL_CONTEXT FsVolContext = (PFSVOL_CONTEXT)Context;
1379
1380 switch (FormatStatus)
1381 {
1382 // FIXME: Deprecate!
1384 {
1385 // PPARTENTRY SystemPartition = (PPARTENTRY)Param1;
1386
1387 // FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
1388 // if (ChangeSystemPartitionPage(Ir, SystemPartition))
1389 // return FSVOL_DOIT;
1390 return FSVOL_ABORT;
1391 }
1392
1394 {
1395 switch (Param1)
1396 {
1398 {
1399 // ERROR_WRITE_PTABLE
1401 0, // Default to "Error"
1403 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1404 // TODO: Go back to the partitioning page?
1405 break;
1406 }
1407
1409 {
1410 /* FIXME: improve the error dialog */
1411 //
1412 // Error dialog should say that we cannot find a suitable
1413 // system partition and create one on the system. At this point,
1414 // it may be nice to ask the user whether he wants to continue,
1415 // or use an external drive as the system drive/partition
1416 // (e.g. floppy, USB drive, etc...)
1417 //
1419 0, // Default to "Error"
1421 // FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
1422 // TODO: Go back to the partitioning page
1423 break;
1424 }
1425
1426 default:
1427 break;
1428 }
1429 return FSVOL_ABORT;
1430 }
1431
1434 // NOTE: If needed, clear progress gauges.
1435 return FSVOL_DOIT;
1436
1438 {
1439 if ((FSVOL_OP)Param1 == FSVOL_FORMAT)
1440 {
1441 /*
1442 * In case we just repair an existing installation, or make
1443 * an unattended setup without formatting, just go to the
1444 * filesystem check step.
1445 */
1446 if (FsVolContext->pSetupData->RepairUpdateFlag)
1447 return FSVOL_SKIP;
1450 return FSVOL_SKIP;
1452 /* Set status text */
1454 }
1455 else
1456 if ((FSVOL_OP)Param1 == FSVOL_CHECK)
1457 {
1458 /* Set status text */
1460
1461 /* Filechecking step: set progress marquee style and start it up */
1465 }
1466
1467 return FSVOL_DOIT;
1468 }
1469
1471 {
1472 if ((FSVOL_OP)Param1 == FSVOL_CHECK)
1473 {
1474 /* File-checking finished: stop the progress bar and restore its style */
1477 }
1478 return 0;
1479 }
1480
1482 {
1483 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1484
1485 // FIXME: See also FSVOLNOTIFY_PARTITIONERROR
1486 if (FmtInfo->ErrorStatus == STATUS_PARTITION_FAILURE)
1487 {
1488 // ERROR_WRITE_PTABLE
1490 0, // Default to "Error"
1492 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1493 // TODO: Go back to the partitioning page?
1494 return FSVOL_ABORT;
1495 }
1496 else
1498 {
1499 /* FIXME: show an error dialog */
1500 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
1502 0, // Default to "Error"
1504 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1505 return FSVOL_ABORT;
1506 }
1507 else
1508 if (FmtInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
1509 {
1510 INT nRet;
1511
1513 NULL, // Default to "Error"
1515 FmtInfo->FileSystemName);
1516 if (nRet == IDCANCEL)
1517 {
1518 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1519 return FSVOL_ABORT;
1520 }
1521 else if (nRet == IDOK)
1522 {
1523 return FSVOL_RETRY;
1524 }
1525 }
1526 else if (!NT_SUCCESS(FmtInfo->ErrorStatus))
1527 {
1528 ASSERT(*FmtInfo->Volume->Info.DeviceName);
1529
1530 DPRINT1("FormatPartition() failed with status 0x%08lx\n", FmtInfo->ErrorStatus);
1531
1532 // ERROR_FORMATTING_PARTITION
1534 0, // Default to "Error"
1536 FmtInfo->Volume->Info.DeviceName);
1537 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1538 return FSVOL_ABORT;
1539 }
1540
1541 return FSVOL_RETRY;
1542 }
1543
1545 {
1546 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1547
1548 if (ChkInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
1549 {
1550 INT nRet;
1551
1553 NULL, // Default to "Error"
1555 ChkInfo->Volume->Info.FileSystem);
1556 if (nRet == IDCANCEL)
1557 {
1558 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1559 return FSVOL_ABORT;
1560 }
1561 else if (nRet == IDOK)
1562 {
1563 return FSVOL_SKIP;
1564 }
1565 }
1566 else if (!NT_SUCCESS(ChkInfo->ErrorStatus))
1567 {
1568 DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", ChkInfo->ErrorStatus);
1569
1571 0, // Default to "Error"
1573 ChkInfo->ErrorStatus);
1574 return FSVOL_SKIP;
1575 }
1576
1577 return FSVOL_SKIP;
1578 }
1579
1581 {
1582 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1583 PVOL_CREATE_INFO VolCreate;
1584
1585 ASSERT((FSVOL_OP)Param2 == FSVOL_FORMAT);
1586
1587 /* Find the volume info in the partition TreeList UI.
1588 * If none, don't format it. */
1590 FmtInfo->Volume);
1591 if (!VolCreate)
1592 return FSVOL_SKIP;
1593 ASSERT(VolCreate->Volume == FmtInfo->Volume);
1594
1595 /* If there is no formatting information, skip it */
1596 if (!*VolCreate->FileSystemName)
1597 return FSVOL_SKIP;
1598
1599 ASSERT(*FmtInfo->Volume->Info.DeviceName);
1600
1601 /* Set status text */
1602 if (FmtInfo->Volume->Info.DriveLetter)
1603 {
1606 IDS_FORMATTING_PROGRESS1, // L"Formatting volume %c: (%s) in %s..."
1607 FmtInfo->Volume->Info.DriveLetter,
1608 FmtInfo->Volume->Info.DeviceName,
1609 VolCreate->FileSystemName);
1610 }
1611 else
1612 {
1615 IDS_FORMATTING_PROGRESS2, // L"Formatting volume %s in %s..."
1616 FmtInfo->Volume->Info.DeviceName,
1617 VolCreate->FileSystemName);
1618 }
1619
1620 // StartFormat(FmtInfo, FileSystemList->Selected);
1621 FmtInfo->FileSystemName = VolCreate->FileSystemName;
1622 FmtInfo->MediaFlag = VolCreate->MediaFlag;
1623 FmtInfo->Label = VolCreate->Label;
1624 FmtInfo->QuickFormat = VolCreate->QuickFormat;
1625 FmtInfo->ClusterSize = VolCreate->ClusterSize;
1626 FmtInfo->Callback = FormatCallback;
1627
1628 /* Set up the progress bar */
1630 PBM_SETRANGE, 0, MAKELPARAM(0, 100));
1632 PBM_SETPOS, 0, 0);
1633
1634 return FSVOL_DOIT;
1635 }
1636
1638 {
1639 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1640
1641 // EndFormat(FmtInfo->ErrorStatus);
1642 if (FmtInfo->FileSystemName)
1643 *(PWSTR)FmtInfo->FileSystemName = UNICODE_NULL; // FIXME: HACK!
1644
1645 // /* Reset the file system list */
1646 // ResetFileSystemList();
1647 return 0;
1648 }
1649
1651 {
1652 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1653 PVOL_CREATE_INFO VolCreate;
1654
1655 ASSERT((FSVOL_OP)Param2 == FSVOL_CHECK);
1656
1657 /* Find the volume info in the partition TreeList UI.
1658 * If none, don't check it. */
1660 ChkInfo->Volume);
1661 if (!VolCreate)
1662 return FSVOL_SKIP;
1663 ASSERT(VolCreate->Volume == ChkInfo->Volume);
1664
1665 ASSERT(*ChkInfo->Volume->Info.DeviceName);
1666
1667 /* Set status text */
1668 if (ChkInfo->Volume->Info.DriveLetter)
1669 {
1672 IDS_CHECKING_PROGRESS1, // L"Checking volume %c: (%s)..."
1673 ChkInfo->Volume->Info.DriveLetter,
1674 ChkInfo->Volume->Info.DeviceName);
1675 }
1676 else
1677 {
1680 IDS_CHECKING_PROGRESS2, // L"Checking volume %s..."
1681 ChkInfo->Volume->Info.DeviceName);
1682 }
1683
1684 // StartCheck(ChkInfo);
1685 // TODO: Think about which values could be defaulted...
1686 ChkInfo->FixErrors = TRUE;
1687 ChkInfo->Verbose = FALSE;
1688 ChkInfo->CheckOnlyIfDirty = TRUE;
1689 ChkInfo->ScanDrive = FALSE;
1690 ChkInfo->Callback = ChkdskCallback;
1691
1692 return FSVOL_DOIT;
1693 }
1694
1696 {
1697 // PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1698 // EndCheck(ChkInfo->ErrorStatus);
1699 return 0;
1700 }
1701 }
1702
1703 return 0;
1704}
static BOOLEAN NTAPI FormatCallback(_In_ CALLBACKCOMMAND Command, _In_ ULONG Modifier, _In_ PVOID Argument)
Definition: reactos.c:1306
struct _FSVOL_CONTEXT * PFSVOL_CONTEXT
#define IDS_ERROR_SYSTEM_PARTITION
Definition: resource.h:187
#define IDS_ERROR_FORMAT_UNRECOGNIZED_VOLUME
Definition: resource.h:190
#define IDS_FORMATTING_PROGRESS1
Definition: resource.h:138
#define IDS_ERROR_COULD_NOT_CHECK
Definition: resource.h:199
#define IDS_ERROR_CHECKING_PARTITION
Definition: resource.h:202
#define IDS_ERROR_COULD_NOT_FORMAT
Definition: resource.h:193
#define IDS_CHECKING_PROGRESS2
Definition: resource.h:141
#define IDS_CHECKING_PROGRESS1
Definition: resource.h:140
#define IDC_ITEM
Definition: resource.h:71
#define IDS_FORMATTING_PROGRESS2
Definition: resource.h:139
#define IDS_ERROR_WRITE_PTABLE
Definition: resource.h:183
#define IDS_ERROR_FORMATTING_PARTITION
Definition: resource.h:196
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
PVOL_CREATE_INFO FindVolCreateInTreeByVolume(_In_ HWND hTreeList, _In_ PVOLENTRY Volume)
Definition: drivepage.c:835
#define STATUS_PARTITION_FAILURE
Definition: ntstatus.h:698
#define PBS_MARQUEE
Definition: commctrl.h:2203
#define PBM_SETMARQUEE
Definition: commctrl.h:2204
@ FSVOLNOTIFY_STARTCHECK
Definition: fsutil.h:153
@ FSVOLNOTIFY_ENDQUEUE
Definition: fsutil.h:145
@ FSVOLNOTIFY_STARTSUBQUEUE
Definition: fsutil.h:146
@ FSVOLNOTIFY_ENDFORMAT
Definition: fsutil.h:151
@ FSVOLNOTIFY_STARTFORMAT
Definition: fsutil.h:150
@ FSVOLNOTIFY_STARTQUEUE
Definition: fsutil.h:144
@ FSVOLNOTIFY_ENDSUBQUEUE
Definition: fsutil.h:147
@ FSVOLNOTIFY_PARTITIONERROR
Definition: fsutil.h:149
@ FSVOLNOTIFY_CHECKERROR
Definition: fsutil.h:155
@ ChangeSystemPartition
Definition: fsutil.h:156
@ FSVOLNOTIFY_FORMATERROR
Definition: fsutil.h:152
@ FSVOLNOTIFY_ENDCHECK
Definition: fsutil.h:154
enum _FSVOL_OP FSVOL_OP
struct _FORMAT_VOLUME_INFO * PFORMAT_VOLUME_INFO
@ FSVOL_FORMAT
Definition: fsutil.h:162
@ FSVOL_CHECK
Definition: fsutil.h:163
@ FSVOL_DOIT
Definition: fsutil.h:166
@ FSVOL_ABORT
Definition: fsutil.h:165
@ FSVOL_RETRY
Definition: fsutil.h:167
@ FSVOL_SKIP
Definition: fsutil.h:168
struct _CHECK_VOLUME_INFO * PCHECK_VOLUME_INFO
#define ERROR_SYSTEM_PARTITION_NOT_FOUND
Definition: setuplib.h:188
BOOLEAN Verbose
Definition: fsutil.h:195
NTSTATUS ErrorStatus
Definition: fsutil.h:191
PVOLENTRY Volume
Definition: fsutil.h:189
PFMIFSCALLBACK Callback
Definition: fsutil.h:198
BOOLEAN CheckOnlyIfDirty
Definition: fsutil.h:196
BOOLEAN FixErrors
Definition: fsutil.h:194
BOOLEAN ScanDrive
Definition: fsutil.h:197
PFMIFSCALLBACK Callback
Definition: fsutil.h:183
BOOLEAN QuickFormat
Definition: fsutil.h:181
NTSTATUS ErrorStatus
Definition: fsutil.h:175
PVOLENTRY Volume
Definition: fsutil.h:173
FMIFS_MEDIA_FLAG MediaFlag
Definition: fsutil.h:179
PCWSTR FileSystemName
Definition: fsutil.h:178
PSETUPDATA pSetupData
Definition: reactos.c:1299
BOOLEAN RepairUpdateFlag
Definition: reactos.h:136
HWND hPartList
Definition: reactos.h:70
LONG_PTR dwPbStyle
Definition: reactos.h:74
HWND hwndDlg
Definition: reactos.h:71
LONG FormatPartition
Definition: setuplib.h:133
WCHAR DeviceName[MAX_PATH]
NT device name: "\Device\HarddiskVolumeN".
Definition: volutil.h:18
WCHAR FileSystem[MAX_PATH+1]
Definition: volutil.h:22
Data structure stored when a partition/volume needs to be formatted.
Definition: reactos.h:165
ULONG ClusterSize
Definition: reactos.h:177
BOOLEAN QuickFormat
Definition: reactos.h:176
PVOLENTRY Volume
Definition: reactos.h:166
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:173
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:174
PCWSTR Label
Definition: reactos.h:175
#define STATUS_UNRECOGNIZED_VOLUME
Definition: udferr_usr.h:173
PFMIFSCALLBACK ChkdskCallback
Definition: vfatlib.c:43
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDOK
Definition: winuser.h:841
#define MB_OKCANCEL
Definition: winuser.h:815
#define GWL_STYLE
Definition: winuser.h:863

Referenced by DoChecking(), DoFormatting(), FsVolCommitOpsQueue(), InitSystemPartition(), and PrepareAndDoCopyThread().

◆ GetLocalSetupDllPath()

static PCWSTR GetLocalSetupDllPath ( VOID  )
static

Definition at line 3125 of file reactos.c.

3126{
3127 static WCHAR SetupDllPath[MAX_PATH] = L"";
3128 static BOOL Init = FALSE;
3129 BOOL Success;
3130 DWORD PathSize;
3131
3132 /* Don't rebuild the path if we did it already */
3133 if (Init)
3134 return SetupDllPath;
3135 Init = TRUE;
3136
3137 /*
3138 * Retrieve the full path of the current running Setup instance.
3139 * From this we build the suitable path to the Setup DLL.
3140 */
3141 PathSize = GetModuleFileNameW(NULL, SetupDllPath, _countof(SetupDllPath));
3142 SetupDllPath[_countof(SetupDllPath) - 1] = UNICODE_NULL; // Ensure NUL-termination (see WinXP bug)
3143
3144 Success = ((PathSize != 0) && (PathSize < _countof(SetupDllPath)) &&
3146 if (Success)
3147 {
3148 /* Find the last path separator, remove it as well as the file name */
3149 PWCHAR pch = wcsrchr(SetupDllPath, L'\\');
3150 if (!pch)
3151 pch = SetupDllPath;
3152
3153 /* The Setup DLL is inside the System32 sub-directory */
3154 PathSize = _countof(SetupDllPath) - (pch - SetupDllPath);
3155 Success = SUCCEEDED(StringCchCopyW(pch, PathSize, L"\\system32"));
3156 }
3157 if (!Success)
3158 {
3159 /* Failure: invalidate the path; the DLL won't be found and delay-loaded */
3160 *SetupDllPath = UNICODE_NULL;
3161 }
3162
3163 return SetupDllPath;
3164}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define pch(ap)
Definition: match.c:418
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by setupDelayHook().

◆ GetSelectedComboListItem()

PVOID GetSelectedComboListItem ( IN HWND  hWndList)

Definition at line 641 of file reactos.c.

643{
644 INT Index;
645
647 if (Index == CB_ERR)
648 return NULL;
649
651}
_In_ WDFCOLLECTION _In_ ULONG Index
#define ComboBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:54
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:49
#define CB_ERR
Definition: winuser.h:2471

Referenced by DeviceDlgProc().

◆ GetSelectedListViewItem()

PVOID GetSelectedListViewItem ( IN HWND  hWndList)

Definition at line 699 of file reactos.c.

701{
702 INT Index;
703 LVITEM item;
704
706 if (Index == LB_ERR)
707 return NULL;
708
709 item.mask = LVIF_PARAM;
710 item.iItem = Index;
712
713 return (PVOID)item.lParam;
714}
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2794
#define LVITEM
Definition: commctrl.h:2380
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2399
#define LB_ERR
Definition: winuser.h:2468

Referenced by UpgradeRepairDlgProc().

◆ GetSettingDescription()

static VOID NTAPI GetSettingDescription ( IN PGENERIC_LIST_ENTRY  Entry,
OUT PWSTR  Buffer,
IN SIZE_T  cchBufferSize 
)
static

Definition at line 719 of file reactos.c.

723{
724 StringCchCopyW(Buffer, cchBufferSize,
726}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by DeviceDlgProc(), and SummaryDlgProc().

◆ HotkeyThread()

static DWORD CALLBACK HotkeyThread ( LPVOID  Parameter)
static

Definition at line 3076 of file reactos.c.

3077{
3078 ATOM hotkey;
3079 MSG msg;
3080
3081 DPRINT("HotkeyThread start\n");
3082
3083 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
3084 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
3085 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
3086
3087 while (GetMessageW(&msg, NULL, 0, 0))
3088 {
3089 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
3090 {
3091 WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer.
3092 STARTUPINFOW si = { sizeof(si) };
3094
3095 if (CreateProcessW(NULL,
3096 CmdLine,
3097 NULL,
3098 NULL,
3099 FALSE,
3101 NULL,
3102 NULL,
3103 &si,
3104 &pi))
3105 {
3108 }
3109 else
3110 {
3111 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
3112 }
3113 }
3114 }
3115
3116 UnregisterHotKey(NULL, hotkey);
3117 GlobalDeleteAtom(hotkey);
3118
3119 DPRINT("HotkeyThread terminate\n");
3120 return 0;
3121}
#define msg(x)
Definition: auth_time.c:54
WORD ATOM
Definition: dimm.idl:113
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:444
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:434
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 MOD_SHIFT
Definition: imm.h:186
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define CREATE_NEW_CONSOLE
Definition: winbase.h:185
#define VK_F10
Definition: winuser.h:2300
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define WM_HOTKEY
Definition: winuser.h:1907

Referenced by _tWinMain().

◆ InitGenericComboList()

VOID InitGenericComboList ( IN HWND  hWndList,
IN PGENERIC_LIST  List,
IN PGET_ENTRY_DESCRIPTION  GetEntryDescriptionProc 
)

Definition at line 603 of file reactos.c.

607{
608 INT Index, CurrentEntryIndex = 0;
609 PGENERIC_LIST_ENTRY ListEntry;
611 WCHAR CurrentItemText[256];
612
613 for (Entry = List->ListHead.Flink;
614 Entry != &List->ListHead;
615 Entry = Entry->Flink)
616 {
618
619 if (GetEntryDescriptionProc)
620 {
621 GetEntryDescriptionProc(ListEntry,
622 CurrentItemText,
623 ARRAYSIZE(CurrentItemText));
624 Index = SendMessageW(hWndList, CB_ADDSTRING, 0, (LPARAM)CurrentItemText);
625 }
626 else
627 {
629 }
630
631 if (ListEntry == List->CurrentEntry)
632 CurrentEntryIndex = Index;
633
635 }
636
637 SendMessageW(hWndList, CB_SETCURSEL, CurrentEntryIndex, 0);
638}
Definition: genlist.h:11
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define CB_SETCURSEL
Definition: winuser.h:1990
#define CB_ADDSTRING
Definition: winuser.h:1965

Referenced by DeviceDlgProc().

◆ InitGenericListView()

VOID InitGenericListView ( IN HWND  hWndList,
IN PGENERIC_LIST  List,
IN PADD_ENTRY_ITEM  AddEntryItemProc 
)

Definition at line 662 of file reactos.c.

666{
667 INT CurrentEntryIndex = 0;
668 LVITEM lvItem;
669 PGENERIC_LIST_ENTRY ListEntry;
671 WCHAR CurrentItemText[256];
672
673 for (Entry = List->ListHead.Flink;
674 Entry != &List->ListHead;
675 Entry = Entry->Flink)
676 {
678
679 if (!AddEntryItemProc)
680 continue;
681
682 AddEntryItemProc(hWndList,
683 &lvItem,
684 ListEntry,
685 CurrentItemText,
686 ARRAYSIZE(CurrentItemText));
687
688 if (ListEntry == List->CurrentEntry)
689 CurrentEntryIndex = lvItem.iItem;
690 }
691
692 ListView_EnsureVisible(hWndList, CurrentEntryIndex, FALSE);
693 ListView_SetItemState(hWndList, CurrentEntryIndex,
696}
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2678
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2524

Referenced by UpgradeRepairDlgProc().

◆ InitNtToWin32PathMappingList()

VOID InitNtToWin32PathMappingList ( IN OUT PNT_WIN32_PATH_MAPPING_LIST  MappingList)

Definition at line 2758 of file reactos.c.

2760{
2761 InitializeListHead(&MappingList->List);
2762 MappingList->MappingsCount = 0;
2763}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by _tWinMain().

◆ IsShellActive()

static BOOL IsShellActive ( VOID  )
static

Detects whether a Windows shell is active.

Definition at line 2393 of file reactos.c.

2394{
2395/* See reactos/undocuser.h */
2397
2398 /* Return success if a shell window is present, valid, and interactive */
2399 HWND hWndProgman = GetProgmanWindow();
2400 if (!(hWndProgman && IsWindow(hWndProgman) &&
2401 IsWindowEnabled(hWndProgman) && IsWindowVisible(hWndProgman)))
2402 {
2403 hWndProgman = GetShellWindow();
2404 }
2405 return (hWndProgman && IsWindow(hWndProgman) &&
2406 IsWindowEnabled(hWndProgman) && IsWindowVisible(hWndProgman));
2407}
HWND WINAPI GetProgmanWindow(void)
Definition: input.c:992
HWND WINAPI GetShellWindow(void)
Definition: input.c:974
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by AreThereInteractiveWindows(), and FinishDlgProc().

◆ LoadAllocStringW()

size_t LoadAllocStringW ( _In_opt_ HINSTANCE hInstance hInstance  ,
_In_ UINT  uID,
_In_opt_ _Outptr_ PWSTR pString,
_In_opt_ size_t  cchBufferLen 
)

Definition at line 113 of file reactos.c.

119{
120 PCWSTR pStr;
121 size_t Length;
122
123 /* Try to load the string from the resource */
124 Length = LoadStringW(hInstance, uID, (PWSTR)&pStr, 0);
125 if (Length == 0)
126 {
127 /* No resource string was found, return NULL */
128 *pString = NULL;
129 return 0;
130 }
131
132 /* If the caller gave a pointer to a buffer on input, verify whether it
133 * is large enough to contain the string. If not, allocate a new buffer. */
134 if (!*pString || (cchBufferLen < Length + 1))
135 {
136 /* Allocate a new buffer, adding a NUL-terminator */
137 *pString = HeapAlloc(GetProcessHeap(), 0, (Length + 1) * sizeof(WCHAR));
138 if (!*pString)
139 return 0;
140 }
141
142 /* Copy the string, NUL-terminated */
143 StringCchCopyNW(*pString, Length + 1, pStr, Length);
144 return Length;
145}
_In_ UINT uID
Definition: shlwapi.h:156

Referenced by DisplayMessageV(), SetWindowResPrintfVW(), and SetWindowResTextW().

◆ LoadSetupData()

BOOL LoadSetupData ( IN OUT PSETUPDATA  pSetupData)

Definition at line 2666 of file reactos.c.

2668{
2669 pSetupData->PartitionList = CreatePartitionList();
2670 if (!pSetupData->PartitionList)
2671 {
2672 DPRINT1("Could not enumerate available disks; failing installation\n");
2673 return FALSE;
2674 }
2675
2676 pSetupData->NtOsInstallsList = CreateNTOSInstallationsList(pSetupData->PartitionList);
2677 if (!pSetupData->NtOsInstallsList)
2678 DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
2679
2680 /* Load the hardware, language and keyboard layout lists */
2681
2682 pSetupData->USetupData.ComputerList = CreateComputerTypeList(pSetupData->USetupData.SetupInf);
2683 pSetupData->USetupData.DisplayList = CreateDisplayDriverList(pSetupData->USetupData.SetupInf);
2684 pSetupData->USetupData.KeyboardList = CreateKeyboardDriverList(pSetupData->USetupData.SetupInf);
2685
2686 pSetupData->USetupData.LanguageList = CreateLanguageList(pSetupData->USetupData.SetupInf, pSetupData->DefaultLanguage);
2687
2688 /* If not unattended, overwrite language and locale with
2689 * the current ones of the running ReactOS instance */
2690 if (!IsUnattendedSetup)
2691 {
2692 LCID LocaleID = GetUserDefaultLCID();
2693
2694 StringCchPrintfW(pSetupData->DefaultLanguage,
2695 _countof(pSetupData->DefaultLanguage),
2696 L"%08lx", LocaleID);
2697
2698 StringCchPrintfW(pSetupData->USetupData.LocaleID,
2699 _countof(pSetupData->USetupData.LocaleID),
2700 L"%08lx", LocaleID);
2701 }
2702
2703 /* new part */
2704 pSetupData->SelectedLanguageId = pSetupData->DefaultLanguage;
2705 wcscpy(pSetupData->DefaultLanguage, pSetupData->USetupData.LocaleID); // FIXME: In principle, only when unattended.
2706 pSetupData->USetupData.LanguageId = (LANGID)(wcstol(pSetupData->SelectedLanguageId, NULL, 16) & 0xFFFF);
2707
2708 pSetupData->USetupData.LayoutList = CreateKeyboardLayoutList(pSetupData->USetupData.SetupInf,
2709 pSetupData->SelectedLanguageId,
2710 pSetupData->DefaultKBLayout);
2711
2712 /* If not unattended, overwrite keyboard layout with
2713 * the current one of the running ReactOS instance */
2714 if (!IsUnattendedSetup)
2715 {
2716 C_ASSERT(_countof(pSetupData->DefaultKBLayout) >= KL_NAMELENGTH);
2717 /* If the call fails, keep the default already stored in the buffer */
2718 GetKeyboardLayoutNameW(pSetupData->DefaultKBLayout);
2719 }
2720
2721 /* Change the default entries in the language and keyboard layout lists */
2722 {
2723 PGENERIC_LIST LanguageList = pSetupData->USetupData.LanguageList;
2724 PGENERIC_LIST LayoutList = pSetupData->USetupData.LayoutList;
2725 PGENERIC_LIST_ENTRY ListEntry;
2726
2727 /* Search for default language */
2728 for (ListEntry = GetFirstListEntry(LanguageList); ListEntry;
2729 ListEntry = GetNextListEntry(ListEntry))
2730 {
2731 PCWSTR LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
2732 if (!_wcsicmp(pSetupData->DefaultLanguage, LocaleId))
2733 {
2734 DPRINT("found %S in LanguageList\n", LocaleId);
2735 SetCurrentListEntry(LanguageList, ListEntry);
2736 break;
2737 }
2738 }
2739
2740 /* Search for default layout */
2741 for (ListEntry = GetFirstListEntry(LayoutList); ListEntry;
2742 ListEntry = GetNextListEntry(ListEntry))
2743 {
2744 PCWSTR pszLayoutId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
2745 if (!_wcsicmp(pSetupData->DefaultKBLayout, pszLayoutId))
2746 {
2747 DPRINT("Found %S in LayoutList\n", pszLayoutId);
2748 SetCurrentListEntry(LayoutList, ListEntry);
2749 break;
2750 }
2751 }
2752 }
2753
2754 return TRUE;
2755}
DWORD Id
PGENERIC_LIST CreateKeyboardDriverList(IN HINF InfFile)
Definition: settings.c:1072
PGENERIC_LIST CreateComputerTypeList(IN HINF InfFile)
Definition: settings.c:524
PGENERIC_LIST CreateDisplayDriverList(IN HINF InfFile)
Definition: settings.c:708
PGENERIC_LIST CreateKeyboardLayoutList(IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
Definition: settings.c:1209
PGENERIC_LIST CreateLanguageList(IN HINF InfFile, OUT PWSTR DefaultLanguage)
Definition: settings.c:1159
struct _GENENTRY * PGENENTRY
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
#define C_ASSERT(e)
Definition: intsafe.h:73
USHORT LANGID
Definition: mui.h:9
PGENERIC_LIST_ENTRY NTAPI GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:110
PGENERIC_LIST_ENTRY NTAPI GetNextListEntry(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:121
PGENERIC_LIST NTAPI CreateNTOSInstallationsList(_In_ PPARTLIST PartList)
Create a list of available NT OS installations on the computer, by searching for recognized ones on e...
Definition: osdetect.c:768
DWORD LCID
Definition: nls.h:13
wcscpy
PPARTLIST NTAPI CreatePartitionList(VOID)
Definition: partlist.c:2043
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:437
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
#define KL_NAMELENGTH
Definition: winuser.h:122

Referenced by _tWinMain().

◆ PrepareAndDoCopyThread()

static DWORD WINAPI PrepareAndDoCopyThread ( IN LPVOID  Param)
static

Definition at line 1888 of file reactos.c.

1890{
1891 PSETUPDATA pSetupData;
1892 HWND hwndDlg = (HWND)Param;
1893 HWND hWndProgress;
1894 LONG_PTR dwStyle;
1895 ERROR_NUMBER ErrorNumber;
1898 FSVOL_CONTEXT FsVolContext;
1901
1902 /* Retrieve pointer to the global setup data */
1903 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1904
1905 /* Get the progress handle */
1906 hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS);
1907
1908 /* Setup global UI context */
1909 UiContext.hwndDlg = hwndDlg;
1911 UiContext.hWndProgress = hWndProgress;
1912 UiContext.dwPbStyle = 0;
1913
1914
1915 /* Disable the Close/Cancel buttons during all partition operations */
1916 // TODO: Consider, alternatively, to just show an info-box saying
1917 // that the installation process cannot be canceled at this stage?
1918 // PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
1920
1921
1922 /*
1923 * Find/Set the system partition, and apply all pending partition operations.
1924 */
1925
1926 /* Create context for the volume/partition operations */
1927 FsVolContext.pSetupData = pSetupData;
1928
1929 /* Set status text */
1931 pSetupData->hInstance,
1933 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1934
1935 /* Find or set the active system partition before starting formatting */
1940 &FsVolContext);
1941 // if (!Success)
1942 // return FsVolContext.NextPageOnAbort;
1943 //
1944 // FIXME?? If cannot use any system partition, install FreeLdr on floppy / removable media??
1945 //
1946 if (!Success)
1947 {
1948 /* Display an error if an unexpected failure happened */
1949 MessageBoxW(GetParent(hwndDlg), L"Failed to find or set the system partition!", L"Error", MB_ICONERROR);
1950
1951 /* Re-enable the Close/Cancel buttons */
1953
1954 /*
1955 * We failed due to an unexpected error, keep on the copy page to view the current state,
1956 * but enable the "Next" button to allow the user to continue to the Abort page.
1957 */
1959 return 1;
1960 }
1961
1962
1963 /* Set status text */
1965 pSetupData->hInstance,
1967 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1968
1969 /* Apply all pending operations on partitions: formatting and checking */
1974 &FsVolContext);
1975 if (!Success)
1976 {
1977 /* Display an error if an unexpected failure happened */
1978 MessageBoxW(GetParent(hwndDlg), L"Failed to prepare the partitions!", L"Error", MB_ICONERROR);
1979
1980 /* Re-enable the Close/Cancel buttons */
1982
1983 /*
1984 * We failed due to an unexpected error, keep on the copy page to view the current state,
1985 * but enable the "Next" button to allow the user to continue to the Abort page.
1986 */
1988 return 1;
1989 }
1990
1991
1992 /* Re-enable the Close/Cancel buttons */
1994
1995
1996
1997 /* Re-calculate the final destination paths */
1999 Status = InitDestinationPaths(&pSetupData->USetupData,
2000 NULL, // pSetupData->USetupData.InstallationDirectory,
2002 if (!NT_SUCCESS(Status))
2003 {
2004 DisplayMessage(GetParent(hwndDlg), MB_ICONERROR, L"Error", L"InitDestinationPaths() failed with status 0x%08lx\n", Status);
2005
2006 /*
2007 * We failed due to an unexpected error, keep on the copy page to view the current state,
2008 * but enable the "Next" button to allow the user to continue to the Abort page.
2009 */
2011 return 1;
2012 }
2013
2014
2015
2016 /*
2017 * Preparation of the list of files to be copied
2018 */
2019
2020 /* Set status text */
2022 pSetupData->hInstance,
2024 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2025
2026 /* Set progress marquee style and start it up */
2027 dwStyle = GetWindowLongPtrW(hWndProgress, GWL_STYLE);
2028 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle | PBS_MARQUEE);
2029 SendMessageW(hWndProgress, PBM_SETMARQUEE, TRUE, 0);
2030
2031 /* Prepare the list of files */
2032 /* ErrorNumber = */ Success = PrepareFileCopy(&pSetupData->USetupData, NULL);
2033
2034 /* Stop progress and restore its style */
2035 SendMessageW(hWndProgress, PBM_SETMARQUEE, FALSE, 0);
2036 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle);
2037
2038 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
2039 {
2040 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
2041 if (!pSetupData->bStopInstall)
2042 MessageBoxW(GetParent(hwndDlg), L"Failed to prepare the list of files!", L"Error", MB_ICONERROR);
2043
2044 /*
2045 * If we failed due to an unexpected error, keep on the copy page to view the current state,
2046 * but enable the "Next" button to allow the user to continue to the Abort page.
2047 * Otherwise we have been cancelled by the user, who has already switched to the Abort page.
2048 */
2049 if (!pSetupData->bStopInstall)
2051 return 1;
2052 }
2053
2054
2055 /*
2056 * Perform the file copy
2057 */
2058
2059 /* Set status text */
2061 pSetupData->hInstance,
2063 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2064
2065 /* Create context for the copy process */
2066 CopyContext.pSetupData = pSetupData;
2067 CopyContext.TotalOperations = 0;
2068 CopyContext.CompletedOperations = 0;
2069
2070 /* Do the file copying - The callback handles whether or not we should stop file copying */
2071 if (!DoFileCopy(&pSetupData->USetupData, FileCopyCallback, &CopyContext))
2072 {
2073 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
2074 if (!pSetupData->bStopInstall)
2075 MessageBoxW(GetParent(hwndDlg), L"Failed to copy the files!", L"Error", MB_ICONERROR);
2076
2077 /*
2078 * If we failed due to an unexpected error, keep on the copy page to view the current state,
2079 * but enable the "Next" button to allow the user to continue to the Abort page.
2080 * Otherwise we have been cancelled by the user, who has already switched to the Abort page.
2081 */
2082 if (!pSetupData->bStopInstall)
2084 return 1;
2085 }
2086
2087 // /* Set status text */
2088 // SetWindowResTextW(GetDlgItem(hwndDlg, IDC_ACTIVITY),
2089 // pSetupData->hInstance,
2090 // IDS_INSTALL_FINALIZE);
2091 // SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2092
2093 /* Create the $winnt$.inf file */
2094 InstallSetupInfFile(&pSetupData->USetupData);
2095
2096
2097 /*
2098 * Create or update the registry hives
2099 */
2100
2101 /* Set status text */
2103 pSetupData->hInstance,
2106 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2107
2108 /* Set up the progress bar */
2109 SendMessageW(hWndProgress,
2110 PBM_SETRANGE, 0,
2111 MAKELPARAM(0, 8)); // FIXME: hardcoded number of steps, see StringIDs[] array in RegistryStatus()
2112 SendMessageW(hWndProgress,
2113 PBM_SETSTEP, 1, 0);
2114 SendMessageW(hWndProgress,
2115 PBM_SETPOS, 0, 0);
2116
2117 ErrorNumber = UpdateRegistry(&pSetupData->USetupData,
2118 pSetupData->RepairUpdateFlag,
2119 pSetupData->PartitionList,
2120 InstallVolume->Info.DriveLetter,
2121 pSetupData->SelectedLanguageId,
2123 NULL /* SubstSettings */);
2124 DBG_UNREFERENCED_PARAMETER(ErrorNumber);
2126
2127 /*
2128 * And finally, install the bootloader
2129 */
2130
2131 /* Set status text */
2133 pSetupData->hInstance,
2135 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2136
2138 StringCchPrintfW(PathBuffer, _countof(PathBuffer),
2139 L"%s\\", SystemPartition->DeviceName);
2140 RtlCreateUnicodeString(&pSetupData->USetupData.SystemRootPath, PathBuffer);
2141 DPRINT1("SystemRootPath: %wZ\n", &pSetupData->USetupData.SystemRootPath);
2142
2143 switch (pSetupData->USetupData.BootLoaderLocation)
2144 {
2145 /* Install on removable disk */
2146 case 1:
2147 {
2148 // TODO: So far SETUP only supports the 1st floppy.
2149 // Use a simple UI like comdlg32's DlgDirList* to show
2150 // a list of drives that the user could select.
2151 static const UNICODE_STRING FloppyDrive = RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\");
2152 static const WCHAR DriveLetter = L'A';
2153
2154 INT nRet;
2155 RetryCancel:
2156 nRet = DisplayMessage(GetParent(hwndDlg),
2158 L"Bootloader installation",
2159 L"Please insert a blank floppy disk in drive %c: .\n"
2160 L"All data in the floppy disk will be erased!\n"
2161 L"\nClick on OK to continue."
2162 L"\nClick on CANCEL to skip bootloader installation.",
2163 DriveLetter);
2164 if (nRet != IDOK)
2165 break; /* Skip installation */
2166
2167 Retry:
2169 &FloppyDrive,
2170 &pSetupData->USetupData.SourceRootPath,
2171 &pSetupData->USetupData.DestinationArcPath);
2172 if (Status == STATUS_SUCCESS)
2173 break; /* Successful installation */
2174
2176 {
2177 // ERROR_NO_FLOPPY
2178 nRet = DisplayMessage(GetParent(hwndDlg),
2180 NULL, // Default to "Error"
2181 L"No disk detected in drive %c: .",
2182 DriveLetter);
2183 if (nRet == IDRETRY)
2184 goto Retry;
2185 }
2186 else if ((Status == ERROR_WRITE_BOOT) ||
2188 {
2189 /* Error when writing the boot code */
2190 DisplayError(GetParent(hwndDlg),
2191 0, // Default to "Error"
2193 }
2194 else if (!NT_SUCCESS(Status))
2195 {
2196 /* Any other NTSTATUS failure code */
2197 DPRINT1("InstallBootcodeToRemovable() failed: Status 0x%lx\n", Status);
2198 DisplayError(GetParent(hwndDlg),
2199 0, // Default to "Error"
2201 Status);
2202 }
2203 goto RetryCancel;
2204 }
2205
2206 /* Install on hard-disk */
2207 case 2: // System partition / MBR and VBR (on BIOS-based PC)
2208 case 3: // VBR only (on BIOS-based PC)
2209 {
2210 /* Copy FreeLoader to the disk and save the boot entries */
2212 pSetupData->USetupData.ArchType,
2213 &pSetupData->USetupData.SystemRootPath,
2214 &pSetupData->USetupData.SourceRootPath,
2215 &pSetupData->USetupData.DestinationArcPath,
2216 (pSetupData->USetupData.BootLoaderLocation == 2)
2217 ? 1 /* Install MBR and VBR */
2218 : 0 /* Install VBR only */);
2219 if (Status == STATUS_SUCCESS)
2220 break; /* Successful installation */
2221
2222 if (Status == ERROR_WRITE_BOOT)
2223 {
2224 /* Error when writing the VBR */
2225 DisplayError(GetParent(hwndDlg),
2226 0, // Default to "Error"
2228 SystemVolume->Info.FileSystem);
2229 }
2230 else if (Status == ERROR_INSTALL_BOOTCODE)
2231 {
2232 /* Error when writing the MBR */
2233 DisplayError(GetParent(hwndDlg),
2234 0, // Default to "Error"
2236 L"MBR");
2237 }
2238 else if (Status == STATUS_NOT_SUPPORTED)
2239 {
2240 DisplayError(GetParent(hwndDlg),
2241 0, // Default to "Error"
2243 }
2244 else if (!NT_SUCCESS(Status))
2245 {
2246 /* Any other NTSTATUS failure code */
2247 DPRINT1("InstallBootManagerAndBootEntries() failed: Status 0x%lx\n", Status);
2248 DisplayError(GetParent(hwndDlg),
2249 0, // Default to "Error"
2251 Status);
2252 }
2253 break;
2254 }
2255
2256 /* Skip installation */
2257 case 0:
2258 default:
2259 break;
2260 }
2261
2262
2263 /* We are done! Switch to the Finish page */
2265 return 0;
2266}
unsigned char BOOLEAN
Definition: actypes.h:127
BOOLEAN NTAPI PrepareFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
Definition: install.c:685
BOOLEAN NTAPI DoFileCopy(IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
Definition: install.c:828
static VOID __cdecl RegistryStatus(IN REGISTRY_STATUS RegStatus,...)
Definition: reactos.c:1838
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1372
#define SystemVolume
Definition: reactos.c:35
#define InstallVolume
Definition: reactos.c:30
PPARTENTRY InstallPartition
Definition: reactos.c:28
PPARTENTRY SystemPartition
Definition: reactos.c:33
static UINT CALLBACK FileCopyCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: reactos.c:1717
#define IDS_CONFIG_SYSTEM_PARTITION
Definition: resource.h:146
#define IDS_COPYING_FILES
Definition: resource.h:149
#define IDS_ERROR_BOOTLDR_FAILED
Definition: resource.h:212
#define IDS_PREPARE_FILES
Definition: resource.h:148
#define IDS_PREPARE_PARTITIONS
Definition: resource.h:147
#define IDS_ERROR_BOOTLDR_ARCH_UNSUPPORTED
Definition: resource.h:210
#define IDC_PROCESSPROGRESS
Definition: resource.h:72
#define IDS_ERROR_INSTALL_BOOTCODE
Definition: resource.h:207
#define IDS_ERROR_WRITE_BOOT
Definition: resource.h:205
#define IDS_ERROR_INSTALL_BOOTCODE_REMOVABLE
Definition: resource.h:208
#define IDS_UPDATE_REGISTRY
Definition: resource.h:151
#define IDC_ACTIVITY
Definition: resource.h:70
#define IDS_INSTALL_BOOTLOADER
Definition: resource.h:153
#define IDS_CREATE_REGISTRY
Definition: resource.h:150
NTSTATUS NTAPI InstallBootcodeToRemovable(_In_ ARCHITECTURE_TYPE ArchType, _In_ PCUNICODE_STRING RemovableRootPath, _In_ PCUNICODE_STRING SourceRootPath, _In_ PCUNICODE_STRING DestinationArcPath)
Definition: bootsup.c:1830
NTSTATUS NTAPI InstallBootManagerAndBootEntries(_In_ ARCHITECTURE_TYPE ArchType, _In_ PCUNICODE_STRING SystemRootPath, _In_ PCUNICODE_STRING SourceRootPath, _In_ PCUNICODE_STRING DestinationArcPath, _In_ ULONG_PTR Options)
Installs FreeLoader on the system and configure the boot entries.
Definition: bootsup.c:1674
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
HANDLE HWND
Definition: compat.h:19
static PDISK_IMAGE FloppyDrive[2]
Definition: dskbios32.c:36
enum _ERROR_NUMBER ERROR_NUMBER
@ ERROR_WRITE_BOOT
Definition: errorcode.h:28
@ ERROR_INSTALL_BOOTCODE
Definition: errorcode.h:35
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define RTL_NUMBER_OF_FIELD(type, field)
Definition: ntbasedef.h:715
#define DBG_UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:330
BOOLEAN NTAPI FsVolCommitOpsQueue(_In_ PPARTLIST PartitionList, _In_ PVOLENTRY SystemVolume, _In_ PVOLENTRY InstallVolume, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Definition: fsutil.c:1097
VOID NTAPI InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:208
NTSTATUS NTAPI InitDestinationPaths(_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
Definition: setuplib.c:864
BOOLEAN NTAPI InitSystemPartition(_In_ PPARTLIST PartitionList, _In_ PPARTENTRY InstallPartition, _Out_ PPARTENTRY *pSystemPartition, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Find or set the active system partition.
Definition: setuplib.c:679
ERROR_NUMBER NTAPI UpdateRegistry(IN OUT PUSETUP_DATA pSetupData, IN BOOLEAN RepairUpdateFlag, IN PPARTLIST PartitionList, IN WCHAR DestinationDriveLetter, IN PCWSTR SelectedLanguageId, IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
Definition: setuplib.c:1155
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define STATUS_SUCCESS
Definition: shellext.h:65
WCHAR DeviceName[MAX_PATH]
NT device name: "\Device\HarddiskM\PartitionN".
Definition: partlist.h:77
PCWSTR SelectedLanguageId
Definition: reactos.h:149
PPARTLIST PartitionList
Definition: reactos.h:138
UNICODE_STRING SystemRootPath
Definition: setuplib.h:119
UNICODE_STRING SourceRootPath
Definition: setuplib.h:101
LONG BootLoaderLocation
Definition: setuplib.h:132
ARCHITECTURE_TYPE ArchType
Definition: setuplib.h:145
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:122
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
#define MB_RETRYCANCEL
Definition: winuser.h:816
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define IDRETRY
Definition: winuser.h:844

Referenced by ProcessDlgProc().

◆ ProcessDlgProc()

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

Definition at line 2270 of file reactos.c.

2275{
2276 PSETUPDATA pSetupData;
2277
2278 /* Retrieve pointer to the global setup data */
2279 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
2280
2281 switch (uMsg)
2282 {
2283 case WM_INITDIALOG:
2284 {
2285 /* Save pointer to the global setup data */
2286 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
2287 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
2288
2289 /* Reset status text */
2290 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"");
2291 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2292 break;
2293 }
2294
2295 case WM_NOTIFY:
2296 {
2297 LPNMHDR lpnm = (LPNMHDR)lParam;
2298
2299 switch (lpnm->code)
2300 {
2301 case PSN_SETACTIVE:
2302 {
2303 /* Create the file-copy halt (manual-reset) event */
2304 pSetupData->hHaltInstallEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
2305 if (!pSetupData->hHaltInstallEvent)
2306 break;
2307 pSetupData->bStopInstall = FALSE;
2308
2309 /* Start the prepare-and-copy files thread */
2310 pSetupData->hInstallThread =
2311 CreateThread(NULL, 0,
2313 (PVOID)hwndDlg,
2315 NULL);
2316 if (!pSetupData->hInstallThread)
2317 {
2318 CloseHandle(pSetupData->hHaltInstallEvent);
2319 pSetupData->hHaltInstallEvent = NULL;
2320
2321 MessageBoxW(GetParent(hwndDlg), L"Cannot create the prepare-and-copy files thread!", L"Error", MB_ICONERROR);
2322 break;
2323 }
2324
2325 /* Disable all buttons during installation, they will be
2326 * re-enabled by the installation thread; hide "Back" */
2328 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
2330
2331 /* Resume the installation thread */
2332 ResumeThread(pSetupData->hInstallThread);
2333 break;
2334 }
2335
2336 case PSN_QUERYCANCEL:
2337 {
2338 /* Halt the on-going file copy */
2339 ResetEvent(pSetupData->hHaltInstallEvent);
2340
2341 if (DisplayMessage(GetParent(hwndDlg),
2345 {
2346 /* Stop the file copy thread */
2347 pSetupData->bStopInstall = TRUE;
2348 SetEvent(pSetupData->hHaltInstallEvent);
2349
2350#if 0
2351 /* Wait for any pending installation */
2353 CloseHandle(pSetupData->hInstallThread);
2354 pSetupData->hInstallThread = NULL;
2355 CloseHandle(pSetupData->hHaltInstallEvent);
2356 pSetupData->hHaltInstallEvent = NULL;
2357#endif
2358
2359 // TODO: Unwind installation?!
2360
2361 /* Go to the Abort page */
2363 }
2364 else
2365 {
2366 /* We don't stop installation, resume file copy */
2367 SetEvent(pSetupData->hHaltInstallEvent);
2368 }
2369
2370 /* Do not close the wizard too soon */
2372 return TRUE;
2373 }
2374
2375 default:
2376 break;
2377 }
2378 break;
2379 }
2380
2381 default:
2382 break;
2383 }
2384
2385 return FALSE;
2386}
static DWORD WINAPI PrepareAndDoCopyThread(IN LPVOID Param)
Definition: reactos.c:1888
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:567
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:650
#define CREATE_SUSPENDED
Definition: winbase.h:183

Referenced by _tWinMain().

◆ PropSheet_SetCloseCancel()

VOID PropSheet_SetCloseCancel ( _In_ HWND  hWndWiz,
_In_ BOOL  Enable 
)

Enable or disable the Cancel and the Close title-bar property-sheet buttons.

The buttons are however kept visible in case they are disabled (this informs the user they are disabled only temporarily).

Definition at line 1876 of file reactos.c.

1879{
1880 EnableDlgItem(hWndWiz, IDCANCEL, Enable);
1882 SC_CLOSE,
1884}
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_GRAYED
Definition: winuser.h:129

Referenced by FinishDlgProc(), and PrepareAndDoCopyThread().

◆ RegistryStatus()

static VOID __cdecl RegistryStatus ( IN REGISTRY_STATUS  RegStatus,
  ... 
)
static

Definition at line 1838 of file reactos.c.

1839{
1840 /* WARNING: Please keep this lookup table in sync with the resources! */
1841 static const UINT StringIDs[] =
1842 {
1843 IDS_REG_DONE, /* Success */
1844 IDS_REG_REGHIVEUPDATE, /* RegHiveUpdate */
1845 IDS_REG_IMPORTFILE, /* ImportRegHive */
1846 IDS_REG_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
1847 IDS_REG_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
1848 IDS_REG_ADDKBLAYOUTS, /* KeybLayouts */
1849 IDS_REG_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
1850 IDS_REG_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
1851 };
1852
1853 if (RegStatus < _countof(StringIDs))
1854 {
1855 va_list args;
1856 va_start(args, RegStatus);
1858 va_end(args);
1859 }
1860 else
1861 {
1863 }
1864
1866}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:301
#define IDS_REG_REGHIVEUPDATE
Definition: resource.h:156
#define IDS_REG_CODEPAGEINFOUPDATE
Definition: resource.h:162
#define IDS_REG_DONE
Definition: resource.h:155
#define IDS_REG_IMPORTFILE
Definition: resource.h:157
#define IDS_REG_UNKNOWN
Definition: resource.h:163
#define IDS_REG_KEYBOARDSETTINGSUPDATE
Definition: resource.h:161
#define IDS_REG_ADDKBLAYOUTS
Definition: resource.h:160
#define IDS_REG_LOCALESETTINGSUPDATE
Definition: resource.h:159
#define IDS_REG_DISPLAYSETTINGSUPDATE
Definition: resource.h:158

Referenced by PrepareAndDoCopyThread().

◆ setupDelayHook()

static FARPROC WINAPI setupDelayHook ( unsigned  dliNotify,
PDelayLoadInfo  pdli 
)
static

Controls the delay-loading of Setup DLLs from a suitable path.

See also
https://stackoverflow.com/a/75325443 https://devblogs.microsoft.com/oldnewthing/20170126-00/?p=95265

Definition at line 3184 of file reactos.c.

3185{
3186 static CHAR dllPath[MAX_PATH];
3187 static PCWSTR setupDllPath = NULL;
3188
3189 switch (dliNotify)
3190 {
3192 {
3193 // NOTE: Add any other needed setup-specific DLLs there.
3194 if (_stricmp(pdli->szDll, "setuplib.dll") == 0)
3195 {
3196 if (!setupDllPath)
3197 setupDllPath = GetLocalSetupDllPath();
3198 if (setupDllPath && *setupDllPath &&
3199 SUCCEEDED(StringCchPrintfA(dllPath, _countof(dllPath), "%S\\%s",
3200 setupDllPath, pdli->szDll)))
3201 {
3202 pdli->szDll = dllPath; /* Set szDll to the new path */
3203 }
3204 }
3205 break; /* Load the DLL using the modified path */
3206 }
3207
3208 case dliFailLoadLib:
3209 {
3210 /*
3211 * Library loading failed.
3212 * Raise a hard error instead of the default
3213 * exception, and "cleanly" kill the process.
3214 */
3215 ANSI_STRING DllPathA;
3217 ULONG_PTR Parameters[] = {(ULONG_PTR)&DllPathU};
3219
3220 RtlInitAnsiString(&DllPathA, pdli->szDll);
3221 RtlAnsiStringToUnicodeString(&DllPathU, &DllPathA, FALSE);
3224 0x1,
3225 Parameters,
3226 OptionOk,
3227 &Response);
3228 ExitProcess(-1);
3229 break;
3230 }
3231
3232 default:
3233 break;
3234 }
3235
3236 return NULL;
3237}
#define DECLARE_UNICODE_STRING_SIZE(_var, _size)
Definition: reactos.c:3167
static PCWSTR GetLocalSetupDllPath(VOID)
Definition: reactos.c:3125
#define _stricmp
Definition: cat.c:22
@ dliFailLoadLib
Definition: delayimp.h:37
@ dliNotePreLoadLibrary
Definition: delayimp.h:35
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1330
#define ULONG_PTR
Definition: config.h:101
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
#define HARDERROR_OVERRIDE_ERRORMODE
Definition: extypes.h:146
@ OptionOk
Definition: extypes.h:187
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:639
char CHAR
Definition: pedump.c:57
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
Definition: strsafe.h:520
LPCSTR szDll
Definition: delayimp.h:70
Definition: ncftp.h:89
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869

◆ SetWindowResPrintfVW()

VOID SetWindowResPrintfVW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID,
_In_ va_list  args 
)

Definition at line 301 of file reactos.c.

306{
307 WCHAR ResBuffer[256];
308 WCHAR szText[256];
309 PWSTR ResFmt = ResBuffer; // Use the static buffers by default.
310 PWSTR String = szText;
311
312 /* Try to load the string from the resource */
313 (void)LoadAllocStringW(hInstance, uID, &ResFmt, _countof(ResBuffer));
314 if (!ResFmt)
315 return;
316
317 /* Format the string and retrieve its length. If it is too long,
318 * an auxiliary buffer is allocated; otherwise the static buffer
319 * is used. The string is built to be NUL-terminated. */
320 (void)FormatAllocStringWV(&String, _countof(szText), ResFmt, args);
321 if (!String)
322 {
323 /* Allocation failed, use the original format string verbatim */
324 String = ResFmt;
325 }
326
328
329 /* Free the buffers if needed */
330 if ((String != szText) && (String != ResFmt))
332
333 if (ResFmt && (ResFmt != ResBuffer))
334 HeapFree(GetProcessHeap(), 0, ResFmt);
335}
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by RegistryStatus(), and SetWindowResPrintfW().

◆ SetWindowResPrintfW()

VOID __cdecl SetWindowResPrintfW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID,
  ... 
)

Definition at line 339 of file reactos.c.

344{
346
347 va_start(args, uID);
349 va_end(args);
350}

Referenced by FileCopyCallback(), FsVolCallback(), and RegistryStatus().

◆ SetWindowResTextW()

VOID SetWindowResTextW ( _In_ HWND  hWnd,
_In_opt_ HINSTANCE  hInstance,
_In_ UINT  uID 
)

Definition at line 282 of file reactos.c.

287{
288 WCHAR szText[256];
289 PWSTR String = szText; // Use the static buffer by default.
290
291 /* Try to load the string from the resource */
293 if (!String)
294 return;
296 if (String != szText)
298}

Referenced by FinishDlgProc(), PrepareAndDoCopyThread(), and SummaryDlgProc().

◆ StartDlgProc()

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

Definition at line 353 of file reactos.c.

358{
359 PSETUPDATA pSetupData;
360
361 /* Retrieve pointer to the global setup data */
362 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
363
364 switch (uMsg)
365 {
366 case WM_INITDIALOG:
367 {
368 /* Save pointer to the global setup data */
369 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
370 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
371
372 /* Set title font */
373 SetDlgItemFont(hwndDlg, IDC_STARTTITLE, pSetupData->hTitleFont, TRUE);
374
375 // TEMPTEMP: Set the ReactOS-Alpha information in bold.
376 // TODO: Remove once we reach 0.5/Beta :)
377 SetDlgItemFont(hwndDlg, IDC_WARNTEXT1, pSetupData->hBoldFont, TRUE);
378 SetDlgItemFont(hwndDlg, IDC_WARNTEXT2, pSetupData->hBoldFont, TRUE);
379 SetDlgItemFont(hwndDlg, IDC_WARNTEXT3, pSetupData->hBoldFont, TRUE);
380
381 /* Center the wizard window */
382 CenterWindow(GetParent(hwndDlg));
383 break;
384 }
385
386 case WM_NOTIFY:
387 {
388 LPNMHDR lpnm = (LPNMHDR)lParam;
389
390 switch (lpnm->code)
391 {
392 case PSN_SETACTIVE:
393 {
394 /* Only "Next" and "Cancel" for the first page and hide "Back" */
396 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
398 break;
399 }
400
401 case PSN_KILLACTIVE:
402 {
403 /* Show "Back" button */
404 // PropSheet_ShowWizButtons(GetParent(hwndDlg), PSWIZB_BACK, PSWIZB_BACK);
406 break;
407 }
408
409 default:
410 break;
411 }
412 }
413 break;
414
415 default:
416 break;
417 }
418
419 return FALSE;
420}
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:44
#define IDC_WARNTEXT2
Definition: resource.h:30
#define IDC_WARNTEXT1
Definition: resource.h:29
#define IDC_WARNTEXT3
Definition: resource.h:31
#define IDC_STARTTITLE
Definition: resource.h:28
#define PSN_KILLACTIVE
Definition: prsht.h:116

Referenced by _tWinMain().

◆ SummaryDlgProc()

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

Definition at line 1097 of file reactos.c.

1102{
1103 static WCHAR szOrgWizNextBtnText[260]; // TODO: Make it dynamic
1104
1105 PSETUPDATA pSetupData;
1106
1107 /* Retrieve pointer to the global setup data */
1108 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1109
1110 switch (uMsg)
1111 {
1112 case WM_INITDIALOG:
1113 {
1114 /* Save pointer to the global setup data */
1115 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1116 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1117 break;
1118 }
1119
1120 case WM_COMMAND:
1121 {
1123 {
1124 // Ideally we could add the PSWIZBF_ELEVATIONREQUIRED style.
1127 else
1129 }
1130 break;
1131 }
1132
1133 case WM_NOTIFY:
1134 {
1135 LPNMHDR lpnm = (LPNMHDR)lParam;
1136
1137 switch (lpnm->code)
1138 {
1139 case PSN_SETACTIVE:
1140 {
1141 WCHAR CurrentItemText[256];
1142
1144
1145 /* Show the current selected settings */
1146
1147 // FIXME! Localize
1148 if (pSetupData->RepairUpdateFlag)
1149 {
1150 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1151 L"Upgrading/Repairing \"%s\" from \"%s\"",
1153 pSetupData->CurrentInstallation->VendorName);
1154 }
1155 else
1156 {
1157 StringCchCopyW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1158 L"New ReactOS installation");
1159 }
1160 SetDlgItemTextW(hwndDlg, IDC_INSTALLTYPE, CurrentItemText);
1161
1162 SetDlgItemTextW(hwndDlg, IDC_INSTALLSOURCE, L"n/a");
1163 SetDlgItemTextW(hwndDlg, IDC_ARCHITECTURE, L"n/a");
1164
1166 CurrentItemText,
1167 ARRAYSIZE(CurrentItemText));
1168 SetDlgItemTextW(hwndDlg, IDC_COMPUTER, CurrentItemText);
1169
1171 CurrentItemText,
1172 ARRAYSIZE(CurrentItemText));
1173 SetDlgItemTextW(hwndDlg, IDC_DISPLAY, CurrentItemText);
1174
1176 CurrentItemText,
1177 ARRAYSIZE(CurrentItemText));
1178 SetDlgItemTextW(hwndDlg, IDC_KEYBOARD, CurrentItemText);
1179
1180 if (InstallVolume->Info.DriveLetter)
1181 {
1182#if 0
1183 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1184 L"%c: \x2014 %wZ",
1185 InstallVolume->Info.DriveLetter,
1186 &pSetupData->USetupData.DestinationRootPath);
1187#else
1188 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1189 L"%c: \x2014 Harddisk %lu, Partition %lu",
1190 InstallVolume->Info.DriveLetter,
1191 InstallPartition->DiskEntry->DiskNumber,
1193#endif
1194 }
1195 else
1196 {
1197#if 0
1198 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1199 L"%wZ",
1200 &pSetupData->USetupData.DestinationRootPath);
1201#else
1202 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1203 L"Harddisk %lu, Partition %lu",
1204 InstallPartition->DiskEntry->DiskNumber,
1206#endif
1207 }
1208 SetDlgItemTextW(hwndDlg, IDC_DESTDRIVE, CurrentItemText);
1209
1210 SetDlgItemTextW(hwndDlg, IDC_PATH,
1212 /*pSetupData->USetupData.InstallPath.Buffer*/);
1213
1214
1215 /* Change the "Next" button text to "Install" */
1216 // PropSheet_SetNextText(GetParent(hwndDlg), ...);
1218 szOrgWizNextBtnText, ARRAYSIZE(szOrgWizNextBtnText));
1220 pSetupData->hInstance,
1222
1223 /*
1224 * Keep the "Next" button disabled. It will be enabled only
1225 * when the user clicks on the installation approval checkbox.
1226 */
1229 break;
1230 }
1231
1233 {
1234 /* Focus on the confirmation check-box */
1236 return TRUE;
1237 }
1238
1239 case PSN_KILLACTIVE:
1240 {
1241 /* Restore the original "Next" button text */
1242 SetDlgItemTextW(GetParent(hwndDlg), ID_WIZNEXT, szOrgWizNextBtnText);
1243 break;
1244 }
1245
1246 case PSN_QUERYCANCEL:
1247 {
1248 if (DisplayMessage(GetParent(hwndDlg),
1252 {
1253 /* Go to the Abort page */
1255 }
1256
1257 /* Do not close the wizard too soon */
1259 return TRUE;
1260 }
1261
1262 case PSN_WIZBACK:
1263 {
1264 /* When the user performs a regular installation, go back to the previous page */
1265 if (!pSetupData->RepairUpdateFlag)
1266 break;
1267
1268 if (GetNumberOfListEntries(pSetupData->NtOsInstallsList) > 1)
1269 {
1270 /* Return to the Upgrade/Repair selection page, when the user is
1271 * upgrading and there are more than one installation available */
1273 }
1274 else
1275 {
1276 /* Return to the Install type selection page, when the user is
1277 * upgrading and there is at most one installation available */
1279 }
1280 return TRUE;
1281 }
1282
1283 default:
1284 break;
1285 }
1286 break;
1287 }
1288
1289 default:
1290 break;
1291 }
1292
1293 return FALSE;
1294}
#define IDS_INSTALLBTN
Definition: resource.h:115
#define IDC_CONFIRM_INSTALL
Definition: resource.h:67
#define IDC_ARCHITECTURE
Definition: resource.h:61
#define IDC_PATH
Definition: resource.h:81
#define IDC_DESTDRIVE
Definition: resource.h:65
#define IDC_INSTALLTYPE
Definition: resource.h:59
#define IDC_INSTALLSOURCE
Definition: resource.h:60
ULONG NTAPI GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:149
PGENERIC_LIST_ENTRY NTAPI GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:102
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
ULONG OnDiskPartitionNumber
Definition: partlist.h:74
PNTOS_INSTALLATION CurrentInstallation
Definition: reactos.h:139
PGENERIC_LIST NtOsInstallsList
Definition: reactos.h:140
UNICODE_STRING DestinationRootPath
Definition: setuplib.h:124
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:157
#define HIWORD(l)
Definition: typedefs.h:247
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1768
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define BN_CLICKED
Definition: winuser.h:1954
#define BST_CHECKED
Definition: winuser.h:197

Referenced by _tWinMain().

◆ TypeDlgProc()

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

Definition at line 423 of file reactos.c.

428{
429 PSETUPDATA pSetupData;
430
431 /* Retrieve pointer to the global setup data */
432 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
433
434 switch (uMsg)
435 {
436 case WM_INITDIALOG:
437 {
438 /* Save pointer to the global setup data */
439 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
440 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
441
442 /* Set the options in bold */
443 SetDlgItemFont(hwndDlg, IDC_INSTALL, pSetupData->hBoldFont, TRUE);
444 SetDlgItemFont(hwndDlg, IDC_UPDATE, pSetupData->hBoldFont, TRUE);
445
446 /* Check the "Install" radio button */
448
449 /*
450 * Enable the "Update" radio button and text only if we have
451 * available NT installations, otherwise disable them.
452 */
453 if (pSetupData->NtOsInstallsList &&
455 {
458 }
459 else
460 {
463 }
464
465 break;
466 }
467
468 case WM_NOTIFY:
469 {
470 LPNMHDR lpnm = (LPNMHDR)lParam;
471
472 switch (lpnm->code)
473 {
474 case PSN_SETACTIVE:
476 break;
477
479 {
480 /* Focus on "Install ReactOS" */
482 return TRUE;
483 }
484
485 case PSN_QUERYCANCEL:
486 {
487 if (DisplayMessage(GetParent(hwndDlg),
491 {
492 /* Go to the Abort page */
494 }
495
496 /* Do not close the wizard too soon */
498 return TRUE;
499 }
500
501 case PSN_WIZNEXT: /* Set the selected data */
502 {
503 /*
504 * Go update only if we have available NT installations
505 * and we choose to do so.
506 */
507 if (pSetupData->NtOsInstallsList &&
508 GetNumberOfListEntries(pSetupData->NtOsInstallsList) != 0 &&
510 {
511 pSetupData->RepairUpdateFlag = TRUE;
512
513 /*
514 * Display the existing NT installations page only
515 * if we have more than one available NT installations.
516 */
517 if (GetNumberOfListEntries(pSetupData->NtOsInstallsList) > 1)
518 {
519 /* pSetupData->CurrentInstallation will be set from within IDD_UPDATEREPAIRPAGE */
520
521 /* Actually the best would be to dynamically insert the page only when needed */
523 }
524 else
525 {
526 /* Retrieve the current installation */
527 pSetupData->CurrentInstallation =
533
534 /* Jump to the Summary page during repair/upgrade */
536 }
537 }
538 else
539 {
540 pSetupData->CurrentInstallation = NULL;
541 pSetupData->RepairUpdateFlag = FALSE;
543 }
544
545 return TRUE;
546 }
547
548 default:
549 break;
550 }
551 }
552 break;
553
554 default:
555 break;
556 }
557
558 return FALSE;
559}
#define IDC_UPDATE
Definition: resource.h:36
#define IDC_UPDATETEXT
Definition: resource.h:37
#define IDC_INSTALL
Definition: fontview.h:13
PPARTENTRY PartEntry
Definition: partlist.h:57
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by _tWinMain().

◆ UpgradeRepairDlgProc()

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

Definition at line 795 of file reactos.c.

800{
801 PSETUPDATA pSetupData;
802 HWND hList;
803 HIMAGELIST hSmall;
804
805 /* Retrieve pointer to the global setup data */
806 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
807
808 switch (uMsg)
809 {
810 case WM_INITDIALOG:
811 {
812 /* Save pointer to the global setup data */
813 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGE)lParam)->lParam;
814 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
815
816 /*
817 * Keep the "Next" button disabled. It will be enabled only
818 * when the user selects an installation to upgrade.
819 */
821
822 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
823
825
827 hList,
832
833 /* Create the ImageList */
836 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
837 1, 1);
838
839 /* Add event type icons to the ImageList */
842
843 /* Assign the ImageList to the List View */
845
847 break;
848 }
849
850 case WM_DESTROY:
851 {
852 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
855 ImageList_Destroy(hSmall);
856 return TRUE;
857 }
858
859 case WM_COMMAND:
860 switch (LOWORD(wParam))
861 {
862 case IDC_SKIPUPGRADE:
863 {
864 /* Skip the upgrade and do the usual new-installation workflow */
865 pSetupData->CurrentInstallation = NULL;
866 pSetupData->RepairUpdateFlag = FALSE;
868 return TRUE;
869 }
870 }
871 break;
872
873 case WM_NOTIFY:
874 {
875 LPNMHDR lpnm = (LPNMHDR)lParam;
876
877 if (lpnm->idFrom == IDC_NTOSLIST && lpnm->code == LVN_ITEMCHANGED)
878 {
880
881 if (pnmv->uChanged & LVIF_STATE) /* The state has changed */
882 {
883 /* The item has been (de)selected */
884 if (pnmv->uNewState & (LVIS_FOCUSED | LVIS_SELECTED))
885 {
887 }
888 else
889 {
890 /*
891 * Keep the "Next" button disabled. It will be enabled only
892 * when the user selects an installation to upgrade.
893 */
895 }
896 }
897
898 break;
899 }
900
901 switch (lpnm->code)
902 {
903#if 0
904 case PSN_SETACTIVE:
905 {
906 /*
907 * Keep the "Next" button disabled. It will be enabled only
908 * when the user selects an installation to upgrade.
909 */
911 break;
912 }
913#endif
914
916 {
917 /* Give the focus on and select the first item */
918 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
921 return TRUE;
922 }
923
924 case PSN_QUERYCANCEL:
925 {
926 if (DisplayMessage(GetParent(hwndDlg),
930 {
931 /* Go to the Abort page */
933 }
934
935 /* Do not close the wizard too soon */
937 return TRUE;
938 }
939
940 case PSN_WIZNEXT: /* Set the selected data */
941 {
942 /*
943 * Go update only if we have available NT installations
944 * and we choose to do so.
945 */
946 if (!pSetupData->NtOsInstallsList ||
948 {
949 pSetupData->CurrentInstallation = NULL;
950 pSetupData->RepairUpdateFlag = FALSE;
951 break;
952 }
953
954 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
957
958 /* Retrieve the current installation */
959 pSetupData->CurrentInstallation =
965
966 /* We perform an upgrade */
967 pSetupData->RepairUpdateFlag = TRUE;
968 /* Jump to the Summary page during repair/upgrade */
970 return TRUE;
971 }
972
973 default:
974 break;
975 }
976 }
977 break;
978
979 default:
980 break;
981 }
982
983 return FALSE;
984}
PVOID GetSelectedListViewItem(IN HWND hWndList)
Definition: reactos.c:699
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: reactos.c:791
#define MAX_LIST_COLUMNS
Definition: reactos.c:789
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: reactos.c:792
VOID InitGenericListView(IN HWND hWndList, IN PGENERIC_LIST List, IN PADD_ENTRY_ITEM AddEntryItemProc)
Definition: reactos.c:662
BOOL CreateListViewColumns(IN HINSTANCE hInstance, IN HWND hWndListView, IN const UINT *pIDs, IN const INT *pColsWidth, IN const INT *pColsAlign, IN UINT nNumOfColumns)
Definition: reactos.c:564
static VOID NTAPI AddNTOSInstallationItem(IN HWND hWndList, IN LVITEM *plvItem, IN PGENERIC_LIST_ENTRY Entry, IN OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
Definition: reactos.c:730
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: reactos.c:790
#define IDI_WINICON
Definition: resource.h:19
#define IDI_ROSICON
Definition: resource.h:18
#define IDC_SKIPUPGRADE
Definition: resource.h:41
#define IDC_NTOSLIST
Definition: resource.h:40
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
#define LVSIL_SMALL
Definition: commctrl.h:2304
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
Definition: commctrl.h:2731
#define LVIF_STATE
Definition: commctrl.h:2317
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2309
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2301
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define ILC_MASK
Definition: commctrl.h:351
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
UINT_PTR idFrom
Definition: winuser.h:3266
UINT uNewState
Definition: commctrl.h:3041
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
int WINAPI GetSystemMetrics(_In_ int)

Referenced by _tWinMain().

Variable Documentation

◆ __pfnDliFailureHook2

PfnDliHook __pfnDliFailureHook2 = setupDelayHook

Definition at line 3246 of file reactos.c.

◆ __pfnDliNotifyHook2

PfnDliHook __pfnDliNotifyHook2 = setupDelayHook

Custom delay-loading hooks for loading the Setup DLLs from a suitable path.

Definition at line 3245 of file reactos.c.

◆ column_alignment

const INT column_alignment[MAX_LIST_COLUMNS] = {LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT}
static

Definition at line 792 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_ids

Definition at line 790 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_widths

const INT column_widths[MAX_LIST_COLUMNS] = {200, 150, 100}
static

Definition at line 791 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ InstallPartition

◆ IsUnattendedSetup

BOOLEAN IsUnattendedSetup
static

Definition at line 25 of file reactos.c.

Referenced by _tWinMain(), FsVolCallback(), and LoadSetupData().

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers *‍/

Definition at line 23 of file reactos.c.

Referenced by _tWinMain(), ConvertNtPathToWin32Path(), and FreeNtToWin32PathMappingList().

◆ SetupData

◆ SystemPartition

◆ UiContext