ReactOS 0.4.17-dev-540-g8f54750
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 <pshpack1.h>
#include <poppack.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
 
struct  DLGTEMPLATEEX
 

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 PM_INSTALL_START   (WM_APP + 1)
 
#define PM_INSTALL_DONE   (WM_APP + 2)
 
#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
 
typedef struct DLGTEMPLATEEX DLGTEMPLATEEX
 
typedef struct DLGTEMPLATEEXLPDLGTEMPLATEEX
 

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.
 
static LRESULT CALLBACK PrshtWndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK PropSheetCallback (_In_ HWND hDlg, _In_ UINT message, _In_ LPARAM lParam)
 
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
 
HCURSOR hWaitCursor
 
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
 
WNDPROC wpOrgPrshtProc = NULL
 
struct {
   BOOL   IncludeForUnattended
 
   DWORD   dwFlags
 
   PCWSTR   pszTemplate
 
   PCWSTR   pszHeaderTitle
 
   PCWSTR   pszHeaderSubTitle
 
   DLGPROC   pfnDlgProc
 
WizardPages []
 

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 3348 of file reactos.c.

◆ DELAYIMP_INSECURE_WRITABLE_HOOKS

#define DELAYIMP_INSECURE_WRITABLE_HOOKS

Definition at line 3353 of file reactos.c.

◆ IDS_LIST_COLUMN_FIRST

#define IDS_LIST_COLUMN_FIRST   IDS_INSTALLATION_NAME

Definition at line 785 of file reactos.c.

◆ IDS_LIST_COLUMN_LAST

#define IDS_LIST_COLUMN_LAST   IDS_INSTALLATION_VENDOR

Definition at line 786 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 788 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.

◆ PM_INSTALL_DONE

#define PM_INSTALL_DONE   (WM_APP + 2)

Definition at line 1888 of file reactos.c.

◆ PM_INSTALL_START

#define PM_INSTALL_START   (WM_APP + 1)

Definition at line 1887 of file reactos.c.

◆ SystemVolume

#define SystemVolume   (SystemPartition->Volume)

Definition at line 35 of file reactos.c.

Typedef Documentation

◆ CLOSABLE_WND_INFO

◆ COPYCONTEXT

◆ DLGTEMPLATEEX

◆ FSVOL_CONTEXT

◆ LPDLGTEMPLATEEX

◆ 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 652 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 595 of file reactos.c.

Function Documentation

◆ _tWinMain()

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

Definition at line 3609 of file reactos.c.

3613{
3614 ULONG Error;
3615 HANDLE hHotkeyThread;
3617 PROPSHEETHEADERW psh = {0};
3618 PROPSHEETPAGEW psp = {0};
3620 UINT nPages, i;
3621
3623
3628
3629 /* Initialize the NT to Win32 path prefix mapping list */
3631
3632 /* Initialize Setup */
3635 if (Error != ERROR_SUCCESS)
3636 {
3637 //
3638 // TODO: Write an error mapper (much like the MUIDisplayError of USETUP)
3639 //
3641 MessageBoxW(NULL, L"GetSourcePaths failed!", NULL, MB_ICONERROR);
3642 else if (Error == ERROR_LOAD_TXTSETUPSIF)
3644 else // FIXME!!
3645 MessageBoxW(NULL, L"Unknown error!", NULL, MB_ICONERROR);
3646
3647 goto Quit;
3648 }
3649
3650 /* Retrieve any supplemental options from the unattend file */
3652
3653 /* Load extra setup data (HW lists etc...) */
3654 if (!LoadSetupData(&SetupData))
3655 goto Quit;
3656
3657 hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
3658
3659 /* Whenever any of the common controls are used in your app,
3660 * you must call InitCommonControlsEx() to register the classes
3661 * for those controls. */
3662 iccx.dwSize = sizeof(iccx);
3664 InitCommonControlsEx(&iccx);
3665
3666 /* Register the TreeList control */
3667 // RegisterTreeListClass(hInst);
3669
3670 /* Create the title and bold fonts */
3673
3674 /* Create each page */
3675 psp.dwSize = sizeof(psp);
3676 psp.hInstance = hInst;
3677 psp.lParam = (LPARAM)&SetupData;
3678 for (nPages = 0, i = 0; i < _countof(WizardPages); ++i)
3679 {
3680 /* Skip pages that don't apply to unattended mode */
3681 if (SetupData.bUnattend && !WizardPages[i].IncludeForUnattended)
3682 continue;
3683
3684 psp.dwFlags = PSP_DEFAULT | WizardPages[i].dwFlags;
3685 psp.pszTemplate = WizardPages[i].pszTemplate;
3686#if 1
3687 // FIXME: HACK: Wine comctl32 propsheet.c doesn't correctly set the wizard
3688 // dialog title when the pages don't have captions, even if the user sends
3689 // an initial PSM_SETTITLE message via the callback -- see CORE-20687.
3690 // To avert this problem, force-set the same title to each page, before
3691 // creating the wizard.
3692 psp.dwFlags |= PSP_USETITLE;
3694#endif
3695 psp.pfnDlgProc = WizardPages[i].pfnDlgProc;
3696 psp.pszHeaderTitle = WizardPages[i].pszHeaderTitle;
3697 psp.pszHeaderSubTitle = WizardPages[i].pszHeaderSubTitle;
3698 ahpsp[nPages++] = CreatePropertySheetPage(&psp);
3699 }
3700
3701 /* Create the property sheet */
3702 psh.dwSize = sizeof(psh);
3703 psh.dwFlags = PSH_WIZARD97 | PSH_USEICONID | PSH_USECALLBACK | PSH_WATERMARK | PSH_HEADER;
3704 psh.hInstance = hInst;
3705 psh.hwndParent = NULL;
3707 psh.nPages = nPages;
3708 psh.nStartPage = 0;
3709 psh.phpage = ahpsp;
3711 psh.pszbmWatermark = MAKEINTRESOURCEW(IDB_WATERMARK);
3712 psh.pszbmHeader = MAKEINTRESOURCEW(IDB_HEADER);
3713
3714 /* Display the wizard */
3715 PropertySheetW(&psh);
3716
3717 if (SetupData.hBoldFont)
3721
3722 /* Unregister the TreeList control */
3723 // UnregisterTreeListClass(hInst);
3725
3726 if (hHotkeyThread)
3727 {
3728 PostThreadMessageW(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
3729 CloseHandle(hHotkeyThread);
3730 }
3731
3732Quit:
3733 /* Setup has finished */
3735
3736 /* Free the NT to Win32 path prefix mapping list */
3738
3739 /* Force reboot if there are no other user-interactive windows opened */
3741
3742 /* System rebooting will be done by Winlogon if necessary */
3744 {
3745#if 1 // TESTING: Disable for testing the installer locally.
3749#else
3750 DisplayMessage(NULL, MB_ICONWARNING, L"Restarting", L"Setup is now restarting your computer!");
3751#endif
3752 }
3753 return 0;
3754}
#define IDI_MAIN
Definition: resource.h:4
#define IDB_HEADER
Definition: resource.h:30
static HFONT CreateBoldFont(_In_opt_ HFONT hOrigFont, _In_opt_ INT PointSize)
Create a bold font derived from the provided font.
Definition: reactos.c:73
static BOOL AreThereInteractiveWindows(_In_opt_ HWND hWndExclude)
Detects whether there exist interactive closable windows opened.
Definition: reactos.c:2614
HANDLE ProcessHeap
Definition: reactos.c:23
BOOL LoadSetupData(IN OUT PSETUPDATA pSetupData)
Definition: reactos.c:2844
static HFONT CreateTitleFont(_In_opt_ HFONT hOrigFont)
Definition: reactos.c:107
static int CALLBACK PropSheetCallback(_In_ HWND hDlg, _In_ UINT message, _In_ LPARAM lParam)
Definition: reactos.c:3494
INT __cdecl DisplayError(_In_opt_ HWND hWnd, _In_ UINT uIDTitle, _In_ UINT uIDMessage,...)
Definition: reactos.c:264
VOID FreeNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:2947
static const struct @76 WizardPages[]
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:245
VOID InitNtToWin32PathMappingList(IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList)
Definition: reactos.c:2939
static BOOLEAN IsUnattendedSetup
Definition: reactos.c:25
SETUPDATA SetupData
Definition: reactos.c:24
static DWORD CALLBACK HotkeyThread(LPVOID Parameter)
Definition: reactos.c:3257
BOOL EnablePrivilege(IN LPCWSTR lpszPrivilegeName, IN BOOL bEnablePrivilege)
Definition: reactos.c:3227
#define IDS_CAPTION
Definition: resource.h:97
#define IDB_WATERMARK
Definition: resource.h:13
#define IDS_NO_TXTSETUP_SIF
Definition: resource.h:112
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
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2950
#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
#define L(x)
Definition: resources.c:13
HINSTANCE hInst
Definition: dxdiag.c:13
@ ERROR_LOAD_TXTSETUPSIF
Definition: errorcode.h:24
@ ERROR_NO_SOURCE_DRIVE
Definition: errorcode.h:23
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
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 CreatePropertySheetPage
Definition: prsht.h:399
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSH_USEICONID
Definition: prsht.h:42
#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:1022
BOOLEAN NTAPI CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:32
VOID NTAPI FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1106
#define _countof(array)
Definition: sndvol32.h:70
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
UINT nStartPage
Definition: prsht.h:304
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTemplate
Definition: prsht.h:218
LPCWSTR pszTitle
Definition: prsht.h:225
HINSTANCE hInstance
Definition: prsht.h:216
BOOLEAN bStopInstall
Definition: reactos.h:151
USETUP_DATA USetupData
Definition: reactos.h:156
HINSTANCE hInstance
Definition: reactos.h:127
HFONT hBoldFont
Definition: reactos.h:132
HFONT hTitleFont
Definition: reactos.h:131
HANDLE hInstallThread
Definition: reactos.h:134
BOOL bMustReboot
Definition: reactos.h:129
HANDLE hHaltInstallEvent
Definition: reactos.h:135
NT_WIN32_PATH_MAPPING_LIST MappingList
Definition: reactos.h:154
BOOL bUnattend
Definition: reactos.h:128
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 729 of file reactos.c.

735{
737 PVOLINFO VolInfo = (NtOsInstall->Volume ? &NtOsInstall->Volume->Info : NULL);
738
739 if (VolInfo && VolInfo->DriveLetter)
740 {
741 /* We have retrieved a partition that is mounted */
742 StringCchPrintfW(Buffer, cchBufferSize,
743 L"%c:%s",
744 VolInfo->DriveLetter,
745 NtOsInstall->PathComponent);
746 }
747 else
748 {
749 /* We failed somewhere, just show the NT path */
750 StringCchPrintfW(Buffer, cchBufferSize,
751 L"%wZ",
752 &NtOsInstall->SystemNtPath);
753 }
754
755 plvItem->mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
756 plvItem->iItem = 0;
757 plvItem->iSubItem = 0;
758 plvItem->lParam = (LPARAM)Entry;
759 plvItem->pszText = NtOsInstall->InstallationName;
760
761 /* Associate vendor icon */
762 if (FindSubStrI(NtOsInstall->VendorName, VENDOR_REACTOS))
763 {
764 plvItem->mask |= LVIF_IMAGE;
765 plvItem->iImage = 0;
766 }
767 else if (FindSubStrI(NtOsInstall->VendorName, VENDOR_MICROSOFT))
768 {
769 plvItem->mask |= LVIF_IMAGE;
770 plvItem->iImage = 1;
771 }
772
773 plvItem->iItem = SendMessageW(hWndList, LVM_INSERTITEMW, 0, (LPARAM)plvItem);
774
775 plvItem->iSubItem = 1;
776 plvItem->pszText = Buffer; // SystemRootPath;
777 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
778
779 plvItem->iSubItem = 2;
780 plvItem->pszText = NtOsInstall->VendorName;
781 SendMessageW(hWndList, LVM_SETITEMTEXTW, plvItem->iItem, (LPARAM)plvItem);
782}
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 2614 of file reactos.c.

2616{
2617 /* Return success if a shell is active */
2618 if (IsShellActive())
2619 {
2620 return TRUE;
2621 }
2622 /* Otherwise, check for user-interactive closable windows */
2623 else
2624 {
2625 CLOSABLE_WND_INFO Info = {hWndExclude, FALSE};
2627 return Info.Found;
2628 }
2629}
static BOOL IsShellActive(VOID)
Detects whether a Windows shell is active.
Definition: reactos.c:2556
static BOOL CALLBACK FindUserClosableWindowProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: reactos.c:2579
_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 46 of file reactos.c.

47{
49 RECT rcParent;
50 RECT rcWindow;
51
53 if (hWndParent == NULL)
55
56 GetWindowRect(hWndParent, &rcParent);
57 GetWindowRect(hWnd, &rcWindow);
58
61 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
62 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
63 0,
64 0,
66}
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 FinishDlgProc(), CEditCompatModes::OnInitDialog(), CConfirmReplace::OnInitDialog(), CZipPassword::OnInitDialog(), and PrshtWndProc().

◆ ChkdskCallback()

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

Definition at line 1344 of file reactos.c.

1348{
1349 switch (Command)
1350 {
1351 default:
1352 DPRINT("Unknown callback %lu\n", (ULONG)Command);
1353 break;
1354 }
1355
1356 return TRUE;
1357}
#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 2968 of file reactos.c.

2973{
2974 BOOL FoundDrive = FALSE, RetryOnce = FALSE;
2975 PLIST_ENTRY ListEntry;
2977 PCWSTR pwszNtPathToMap = pwszNTPath;
2978 PCWSTR pwszRemaining = NULL;
2979 DWORD cchDrives;
2980 PWCHAR pwszDrive;
2981 WCHAR wszDrives[512];
2982 WCHAR wszNTPath[MAX_PATH];
2983 WCHAR TargetPath[MAX_PATH];
2984
2985 *pwszPath = UNICODE_NULL;
2986
2987 /*
2988 * We find first a mapping inside the MappingList. If one is found, use it
2989 * to build the Win32 path. If there is none, we need to create one by
2990 * checking the Win32 drives (and possibly NT symlinks too).
2991 * In case of success, add the newly found mapping to the list and use it
2992 * to build the Win32 path.
2993 */
2994
2995 for (ListEntry = MappingList->List.Flink;
2996 ListEntry != &MappingList->List;
2997 ListEntry = ListEntry->Flink)
2998 {
2999 Entry = CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
3000
3001 DPRINT("Testing '%S' --> '%S'\n", Entry->Win32Path, Entry->NtPath);
3002
3003 /* Check whether the queried NT path prefixes the user-provided NT path */
3004 FoundDrive = !_wcsnicmp(pwszNtPathToMap, Entry->NtPath, wcslen(Entry->NtPath));
3005 if (FoundDrive)
3006 {
3007 /* Found it! */
3008
3009 /* Set the pointers and go build the Win32 path */
3010 pwszDrive = Entry->Win32Path;
3011 pwszRemaining = pwszNTPath + wcslen(Entry->NtPath);
3012 goto Quit;
3013 }
3014 }
3015
3016 /*
3017 * No mapping exists for this path yet: try to find one now.
3018 */
3019
3020 /* Retrieve the mounted drives (available drive letters) */
3021 cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
3022 if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
3023 {
3024 /* Buffer too small or failure */
3025 DPRINT1("ConvertNtPathToWin32Path: GetLogicalDriveStringsW failed\n");
3026 return FALSE;
3027 }
3028
3029/* We go back there once if RetryOnce == TRUE */
3030Retry:
3031
3032 /* Enumerate the mounted drives */
3033 for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1)
3034 {
3035 /* Retrieve the NT path corresponding to the current Win32 DOS path */
3036 pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash
3037 QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath));
3038 pwszDrive[2] = L'\\'; // Restore the backslash
3039
3040 DPRINT("Testing '%S' --> '%S'\n", pwszDrive, wszNTPath);
3041
3042 /* Check whether the queried NT path prefixes the user-provided NT path */
3043 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
3044 if (!FoundDrive)
3045 {
3046 PWCHAR ptr, ptr2;
3047
3048 /*
3049 * Check whether this was a network share that has a drive letter,
3050 * but the user-provided NT path points to this share without
3051 * mentioning the drive letter.
3052 *
3053 * The format is: \Device<network_redirector>\;X:<data>\share\path
3054 * The corresponding drive letter is 'X'.
3055 * A system-provided network redirector (LanManRedirector or Mup)
3056 * or a 3rd-party one may be used.
3057 *
3058 * We check whether the user-provided NT path has the form:
3059 * \Device<network_redirector><data>\share\path
3060 * as it obviously did not have the full form (the previous check
3061 * would have been OK otherwise).
3062 */
3063 if (!_wcsnicmp(wszNTPath, L"\\Device\\", _countof(L"\\Device\\")-1) &&
3064 (ptr = wcschr(wszNTPath + _countof(L"\\Device\\")-1, L'\\')) &&
3065 wcslen(++ptr) >= 3 && ptr[0] == L';' && ptr[2] == L':')
3066 {
3067 /*
3068 * Normally the specified drive letter should correspond
3069 * to the one used for the mapping. But we will ignore
3070 * if it happens not to be the case.
3071 */
3072 if (pwszDrive[0] != ptr[1])
3073 {
3074 DPRINT1("Peculiar: expected network share drive letter %C different from actual one %C\n",
3075 pwszDrive[0], ptr[1]);
3076 }
3077
3078 /* Remove the drive letter from the NT network share path */
3079 ptr2 = ptr + 3;
3080 /* Swallow as many possible consecutive backslashes as there could be */
3081 while (*ptr2 == L'\\') ++ptr2;
3082
3083 memmove(ptr, ptr2, (wcslen(ptr2) + 1) * sizeof(WCHAR));
3084
3085 /* Now do the check again */
3086 FoundDrive = !_wcsnicmp(pwszNtPathToMap, wszNTPath, wcslen(wszNTPath));
3087 }
3088 }
3089 if (FoundDrive)
3090 {
3091 /* Found it! */
3092
3093 pwszDrive[2] = UNICODE_NULL; // Remove the backslash
3094
3095 if (pwszNtPathToMap == pwszNTPath)
3096 {
3097 ASSERT(!RetryOnce && pwszNTPath != TargetPath);
3098 pwszRemaining = pwszNTPath + wcslen(wszNTPath);
3099 }
3100 break;
3101 }
3102 }
3103
3104 if (FoundDrive)
3105 {
3106 /* A mapping was found, add it to the cache */
3108 if (!Entry)
3109 {
3110 DPRINT1("ConvertNtPathToWin32Path: Cannot allocate memory\n");
3111 return FALSE;
3112 }
3113 StringCchCopyNW(Entry->NtPath, _countof(Entry->NtPath),
3114 pwszNTPath, pwszRemaining - pwszNTPath);
3115 StringCchCopyW(Entry->Win32Path, _countof(Entry->Win32Path), pwszDrive);
3116
3117 /* Insert it as the most recent entry */
3118 InsertHeadList(&MappingList->List, &Entry->ListEntry);
3119 MappingList->MappingsCount++;
3120
3121 /* Set the pointers and go build the Win32 path */
3122 pwszDrive = Entry->Win32Path;
3123 goto Quit;
3124 }
3125
3126 /*
3127 * We failed, perhaps because the beginning of the NT path used a symlink.
3128 * Try to see whether this is the case by attempting to resolve it.
3129 * If the symlink resolution gives nothing, or we already failed once,
3130 * there is no hope in converting the path to Win32.
3131 * Otherwise, symlink resolution succeeds but we need to recheck again
3132 * the drives list.
3133 */
3134
3135 /*
3136 * In theory we would have to parse each element in the NT path and going
3137 * until finding a symlink object (otherwise we would fail straight away).
3138 * However here we can use guessing instead, since we know which kind of
3139 * NT paths we are likely to manipulate: \Device\HarddiskX\PartitionY\ and
3140 * the like (including \Device\HarddiskVolumeX\‍) and the other ones that
3141 * are supported in setuplib\utils\arcname.c .
3142 *
3143 * But actually, all the supported names in arcname.c are real devices,
3144 * and only \Device\HarddiskX\PartitionY\ may refer to a symlink, so we
3145 * just check for it.
3146 */
3147 if (!RetryOnce && !FoundDrive)
3148 {
3149 ULONG DiskNumber, PartitionNumber;
3150 INT Length;
3151
3154 HANDLE LinkHandle;
3155 UNICODE_STRING SymLink, Target;
3156
3157 if (swscanf(pwszNTPath, L"\\Device\\Harddisk%lu\\Partition%lu%n",
3158 &DiskNumber, &PartitionNumber, &Length) != 2)
3159 {
3160 /* Definitively not a recognized path, bail out */
3161 return FALSE;
3162 }
3163
3164 /* Check whether \Device\HarddiskX\PartitionY is a symlink */
3165 RtlInitEmptyUnicodeString(&SymLink, (PWCHAR)pwszNTPath, Length * sizeof(WCHAR));
3166 SymLink.Length = SymLink.MaximumLength;
3167
3169 &SymLink,
3171 NULL,
3172 NULL);
3173 Status = NtOpenSymbolicLinkObject(&LinkHandle,
3176 if (!NT_SUCCESS(Status))
3177 {
3178 /* Not a symlink, or something else happened: bail out */
3179 DPRINT1("ConvertNtPathToWin32Path: NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
3180 &SymLink, Status);
3181 return FALSE;
3182 }
3183
3184 *TargetPath = UNICODE_NULL;
3185 RtlInitEmptyUnicodeString(&Target, TargetPath, sizeof(TargetPath));
3186
3187 /* Resolve the link and close its handle */
3189 NtClose(LinkHandle);
3190
3191 /* Check for success */
3192 if (!NT_SUCCESS(Status))
3193 {
3194 /* Not a symlink, or something else happened: bail out */
3195 DPRINT1("ConvertNtPathToWin32Path: NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n",
3196 &SymLink, Status);
3197 return FALSE;
3198 }
3199
3200 /* Set the pointers */
3201 pwszRemaining = pwszNTPath + Length;
3202 pwszNtPathToMap = TargetPath; // Point to our local buffer
3203
3204 /* Retry once */
3205 RetryOnce = TRUE;
3206 goto Retry;
3207 }
3208
3209 ASSERT(!FoundDrive);
3210
3211Quit:
3212 if (FoundDrive)
3213 {
3214 StringCchPrintfW(pwszPath, cchPathMax,
3215 L"%s%s",
3216 pwszDrive,
3217 pwszRemaining);
3218 DPRINT("ConvertNtPathToWin32Path: %S\n", pwszPath);
3219 return TRUE;
3220 }
3221
3222 return FALSE;
3223}
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
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 73 of file reactos.c.

76{
77 LOGFONTW lf = {0};
78
79 if (hOrigFont)
80 {
81 GetObjectW(hOrigFont, sizeof(lf), &lf);
82 }
83 else
84 {
85 NONCLIENTMETRICSW ncm;
86 ncm.cbSize = sizeof(ncm);
87 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
88 lf = ncm.lfMessageFont;
89 }
90
91 /* Make the font bold, keeping the other attributes */
92 lf.lfWeight = FW_BOLD;
93
94 /* Determine the font height (logical units) if necessary */
95 if (PointSize)
96 {
97 HDC hdc = GetDC(NULL);
98 lf.lfHeight = -MulDiv(PointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
99 // lf.lfWidth = 0;
101 }
102
103 return CreateFontIndirect(&lf);
104}
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 563 of file reactos.c.

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

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

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 986 of file reactos.c.

991{
992 PSETUPDATA pSetupData;
993 HWND hList;
994
995 /* Retrieve pointer to the global setup data */
996 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
997
998 switch (uMsg)
999 {
1000 case WM_INITDIALOG:
1001 {
1002 /* Save pointer to the global setup data */
1003 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1004 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1005
1006 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
1008
1009 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
1011
1012 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
1014
1015 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
1016 // InitGenericComboList(hList, pSetupData->USetupData.LayoutList, GetSettingDescription);
1017
1018 return TRUE;
1019 }
1020
1021 case WM_NOTIFY:
1022 {
1023 LPNMHDR lpnm = (LPNMHDR)lParam;
1024
1025 switch (lpnm->code)
1026 {
1027 case PSN_SETACTIVE:
1029 break;
1030
1031 case PSN_QUERYCANCEL:
1032 {
1033 if (DisplayMessage(GetParent(hwndDlg),
1037 {
1038 /* Go to the Abort page */
1040 }
1041
1042 /* Do not close the wizard too soon */
1044 return TRUE;
1045 }
1046
1047 case PSN_WIZNEXT: /* Set the selected data */
1048 {
1049 hList = GetDlgItem(hwndDlg, IDC_COMPUTER);
1052
1053 hList = GetDlgItem(hwndDlg, IDC_DISPLAY);
1056
1057 hList = GetDlgItem(hwndDlg, IDC_KEYBOARD);
1060
1061 // hList = GetDlgItem(hwndDlg, IDC_KEYBOARD_LAYOUT);
1062 // SetCurrentListEntry(pSetupData->USetupData.LayoutList,
1063 // GetSelectedComboListItem(hList));
1064
1065 return TRUE;
1066 }
1067
1068 case PSN_WIZBACK:
1069 {
1070 /* Return to the Install type selection page instead of the Repair/Upgrade page */
1072 return TRUE;
1073 }
1074
1075 default:
1076 break;
1077 }
1078 break;
1079 }
1080
1081 default:
1082 break;
1083 }
1084
1085 return FALSE;
1086}
#define IDC_DISPLAY
Definition: resource.h:19
PVOID GetSelectedComboListItem(IN HWND hWndList)
Definition: reactos.c:640
static VOID NTAPI GetSettingDescription(IN PGENERIC_LIST_ENTRY Entry, OUT PWSTR Buffer, IN SIZE_T cchBufferSize)
Definition: reactos.c:718
VOID InitGenericComboList(IN HWND hWndList, IN PGENERIC_LIST List, IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
Definition: reactos.c:602
struct _SETUPDATA * PSETUPDATA
#define IDC_KEYBOARD
Definition: resource.h:46
#define IDC_COMPUTER
Definition: resource.h:44
#define IDD_ABORTPAGE
Definition: resource.h:78
#define IDS_ABORTSETUP2
Definition: resource.h:111
#define IDD_TYPEPAGE
Definition: resource.h:33
#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
#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 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 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 MB_DEFBUTTON2
Definition: winuser.h:810
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5512

◆ DisplayError()

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

Definition at line 264 of file reactos.c.

269{
270 INT iRes;
272
273 va_start(args, uIDMessage);
275 MAKEINTRESOURCEW(uIDTitle),
276 MAKEINTRESOURCEW(uIDMessage),
277 args);
278 va_end(args);
279
280 return iRes;
281}
INT DisplayMessageV(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage, _In_ va_list args)
Definition: reactos.c:175
#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 175 of file reactos.c.

181{
182 INT iRes;
184 MSGBOXPARAMSW mb = {0};
186 WCHAR StaticBuffer[256];
187 PWSTR Buffer = StaticBuffer; // Use the static buffer by default.
188
189 /* We need to retrieve the current module's instance handle if either
190 * the title or the format message is specified by a resource ID */
191 if ((pszTitle && IS_INTRESOURCE(pszTitle)) || IS_INTRESOURCE(pszFormatMessage))
192 hInstance = GetModuleHandleW(NULL); // SetupData.hInstance;
193
194 /* Retrieve the format message string if this is a resource */
195 if (pszFormatMessage && IS_INTRESOURCE(pszFormatMessage))
196 {
197 Format = NULL;
198 (void)LoadAllocStringW(hInstance, PtrToUlong(pszFormatMessage), &Format, 0);
199 }
200 else
201 {
202 Format = (PWSTR)pszFormatMessage;
203 }
204
205 if (Format)
206 {
207 /* Format the message and retrieve its length. If it is too long,
208 * an auxiliary buffer is allocated; otherwise the static buffer
209 * is used. The string is built to be NUL-terminated. */
211 if (!Buffer)
212 {
213 /* Allocation failed, use the original format string verbatim */
214 Buffer = Format;
215 }
216 }
217 else
218 {
219 Format = (PWSTR)pszFormatMessage;
220 Buffer = Format;
221 }
222
223 /* Display the message */
224 mb.cbSize = sizeof(mb);
225 mb.hwndOwner = hWnd;
226 mb.hInstance = hInstance;
227 mb.lpszText = Buffer;
228 mb.lpszCaption = pszTitle;
229 mb.dwStyle = uType;
231 iRes = MessageBoxIndirectW(&mb);
232
233 /* Free the buffers if needed */
234 if ((Buffer != StaticBuffer) && (Buffer != Format))
236
237 if (Format && (Format != pszFormatMessage))
239
240 return iRes;
241}
size_t LoadAllocStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen)
Definition: reactos.c:115
size_t FormatAllocStringWV(_In_opt_ _Outptr_ PWSTR *pString, _In_opt_ size_t cchBufferLen, _In_ PCWSTR pszFormat, _In_ va_list args)
Definition: reactos.c:150
#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 3227 of file reactos.c.

3230{
3231 BOOL Success;
3232 HANDLE hToken;
3234
3237 &hToken);
3238 if (!Success) return Success;
3239
3241 lpszPrivilegeName,
3242 &tp.Privileges[0].Luid);
3243 if (!Success) goto Quit;
3244
3245 tp.PrivilegeCount = 1;
3246 tp.Privileges[0].Attributes = (bEnablePrivilege ? SE_PRIVILEGE_ENABLED : 0);
3247
3248 Success = AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL);
3249
3250Quit:
3251 CloseHandle(hToken);
3252 return Success;
3253}
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 1707 of file reactos.c.

1711{
1713 PFILEPATHS_W FilePathInfo;
1714 PCWSTR SrcFileName, DstFileName;
1715
1716 WaitForSingleObject(CopyContext->pSetupData->hHaltInstallEvent, INFINITE);
1717 if (CopyContext->pSetupData->bAbortInstall)
1718 return FILEOP_ABORT; // Stop committing files
1719
1720 switch (Notification)
1721 {
1723 {
1724 CopyContext->TotalOperations = (ULONG)Param2;
1725 CopyContext->CompletedOperations = 0;
1726
1727 /* Set up the progress bar */
1729 PBM_SETRANGE, 0,
1730 MAKELPARAM(0, CopyContext->TotalOperations));
1732 PBM_SETSTEP, 1, 0);
1734 PBM_SETPOS, 0, 0);
1735 break;
1736 }
1737
1741 {
1742 FilePathInfo = (PFILEPATHS_W)Param1;
1743
1745 {
1746 /* Display delete message */
1747 ASSERT(Param2 == FILEOP_DELETE);
1748
1749 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1750 if (DstFileName) ++DstFileName;
1751 else DstFileName = FilePathInfo->Target;
1752
1755 IDS_DELETING, // STRING_DELETING
1756 DstFileName);
1757 }
1759 {
1760 UINT uMsgID;
1761
1762 /* Display move/rename message */
1763 ASSERT(Param2 == FILEOP_RENAME);
1764
1765 SrcFileName = wcsrchr(FilePathInfo->Source, L'\\');
1766 if (SrcFileName) ++SrcFileName;
1767 else SrcFileName = FilePathInfo->Source;
1768
1769 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1770 if (DstFileName) ++DstFileName;
1771 else DstFileName = FilePathInfo->Target;
1772
1773 if (!_wcsicmp(SrcFileName, DstFileName))
1774 uMsgID = IDS_MOVING; // STRING_MOVING
1775 else
1776 uMsgID = IDS_RENAMING; // STRING_RENAMING
1779 uMsgID,
1780 SrcFileName, DstFileName);
1781 }
1783 {
1784 /* Display copy message */
1785 ASSERT(Param2 == FILEOP_COPY);
1786
1787 DstFileName = wcsrchr(FilePathInfo->Target, L'\\');
1788 if (DstFileName) ++DstFileName;
1789 else DstFileName = FilePathInfo->Target;
1790
1791 /* Whereas the repair/upgrade procedure may move, rename, or
1792 * delete files, the regular installation only copies files.
1793 * Therefore, display only the file name instead of the full
1794 * "Copying..." message in this case. */
1796 {
1799 IDS_COPYING, // STRING_COPYING
1800 DstFileName);
1801 }
1802 else
1803 {
1804 SetWindowTextW(UiContext.hWndItem, DstFileName);
1805 }
1806 }
1807 break;
1808 }
1809
1811 {
1812 FilePathInfo = (PFILEPATHS_W)Param1;
1813
1814 DPRINT1("An error happened while trying to copy file '%S' (error 0x%08lx), skipping it...\n",
1815 FilePathInfo->Target, FilePathInfo->Win32Error);
1816 return FILEOP_SKIP;
1817 }
1818
1822 {
1823 CopyContext->CompletedOperations++;
1824
1825 /* SYSREG checkpoint */
1826 if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
1827 DPRINT1("CHECKPOINT:HALF_COPIED\n");
1828
1830 break;
1831 }
1832 }
1833
1834 return FILEOP_DOIT;
1835}
VOID __cdecl SetWindowResPrintfW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID,...)
Definition: reactos.c:341
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 INFINITE
Definition: serial.h:102
#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
BOOLEAN RepairUpdateFlag
Definition: reactos.h:158
HWND hWndItem
Definition: reactos.h:72
HWND hWndProgress
Definition: reactos.h:73
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
Definition: wdfcontrol.h:115
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by PrepareAndDoCopyThread().

◆ FindUserClosableWindowProc()

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

Definition at line 2579 of file reactos.c.

2582{
2584 HMENU hSysMenu;
2585 MENUITEMINFOW mii;
2586
2587 /* Skip the window to exclude */
2588 if (hWnd == pInfo->hWndExclude)
2589 return TRUE;
2590
2591 /* Skip non-interactive windows */
2593 return TRUE;
2594
2595 hSysMenu = GetSystemMenu(hWnd, FALSE);
2596 if (!hSysMenu)
2597 return TRUE; /* No menu: skip the window */
2598
2599 mii.cbSize = sizeof(mii);
2600 mii.fMask = MIIM_STATE;
2601 if (!GetMenuItemInfoW(hSysMenu, SC_CLOSE, FALSE, &mii))
2602 return TRUE; /* No close item: skip the window */
2603
2604 pInfo->Found |= !(mii.fState & MFS_DISABLED);
2605
2606 /* Continue enumeration (return TRUE) if no close item is enabled;
2607 * otherwise stop the enumeration (return FALSE) */
2608 return !pInfo->Found;
2609}
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:2575
HWND hWndExclude
Window to exclude from search.
Definition: reactos.c:2574
#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 2632 of file reactos.c.

2637{
2638 PSETUPDATA pSetupData;
2639
2640 /* Retrieve pointer to the global setup data */
2641 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
2642
2643 switch (uMsg)
2644 {
2645 case WM_INITDIALOG:
2646 {
2647 HWND hWndParent = GetParent(hwndDlg);
2649
2650 /* Save pointer to the global setup data */
2651 pSetupData = (PSETUPDATA)ppsp->lParam;
2652 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
2653
2654 /* Set the stop-install flag if the user is aborting
2655 * the installation: TRUE if Abort, FALSE if Finish. */
2656 pSetupData->bStopInstall = (ppsp->pszTemplate == MAKEINTRESOURCEW(IDD_ABORTPAGE));
2657
2658 /* Set title font */
2659 SetDlgItemFont(hwndDlg, IDC_FINISHTITLE, pSetupData->hTitleFont, TRUE);
2660
2661 /* We need to reboot at the end of the installation if this is an
2662 * unattended setup, or if there is no shell active. If there are
2663 * other user-interactive windows opened, we pause in WM_ACTIVATE
2664 * the inevitable reboot countdown when the wizard is deactivated,
2665 * and restart it when the wizard is reactivated. */
2666 pSetupData->bMustReboot = SetupData.bUnattend;
2667 pSetupData->bMustReboot |= !IsShellActive();
2668
2669 /* If we must reboot, display the countdown gauge. In any
2670 * case, let the user restart now or postpone it to later. */
2671 if (pSetupData->bMustReboot)
2672 {
2673 /* "Setup will now restart your computer..." is shown */
2676 }
2677 else
2678 {
2679 /* We should not reboot automatically, change the finish
2680 * text to "Setup needs to restart your computer..." */
2681 UINT uMsgID = (!pSetupData->bStopInstall ? IDS_FINISH_NO_REBOOT
2684 pSetupData->hInstance,
2685 uMsgID);
2686
2687 /* Hide and disable the countdown gauge */
2690 }
2691
2692 /* Ensure that the wizard window is centered, made visible, and focused */
2696 return TRUE;
2697 }
2698
2699 case WM_ACTIVATE:
2700 {
2701 /* Only care about (de)activation only if we must reboot */
2702 if (!pSetupData->bMustReboot)
2703 break;
2704
2705 if (LOWORD(wParam) == WA_INACTIVE)
2706 {
2707 /* Wizard window is deactivated, check whether there are
2708 * interactive windows. If so, pause the countdown. */
2710 KillTimer(hwndDlg, 1);
2711 }
2712 else
2713 {
2714 /* Wizard window is reactivated, re-enable the countdown */
2715 SetTimer(hwndDlg, 1, 50, NULL);
2716 }
2717 break;
2718 }
2719
2720 case WM_TIMER:
2721 {
2722 HWND hWndProgress;
2723 INT Position;
2724
2725 hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS);
2726 Position = SendMessageW(hWndProgress, PBM_GETPOS, 0, 0);
2727 if (Position == 300)
2728 {
2729 KillTimer(hwndDlg, 1);
2731 }
2732 else
2733 {
2734 SendMessageW(hWndProgress, PBM_SETPOS, Position + 1, 0);
2735 }
2736 return TRUE;
2737 }
2738
2739 case WM_NOTIFY:
2740 {
2741 LPNMHDR lpnm = (LPNMHDR)lParam;
2742
2743 switch (lpnm->code)
2744 {
2745 case PSN_SETACTIVE:
2746 {
2747 HWND hWndParent = GetParent(hwndDlg);
2748
2749 /*
2750 * Only "Finish" for closing the wizard, and hide "Back" and "Next".
2751 * Don't use the PropSheet_SetWizButtons() macro, because its
2752 * posted message would be handled after hiding the buttons.
2753 * The message would then interfere with the hidden buttons
2754 * (when both "Back" and "Next" are hidden, "Next" gets forcefully shown).
2755 */
2757 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_CANCEL);
2760
2761 /* Change the "Finish" button text to "Restart" */
2763 pSetupData->hInstance,
2765
2766 /* Re-enable the Close/Cancel buttons if we won't reboot */
2767 if (!pSetupData->bMustReboot)
2769
2770 if (pSetupData->bMustReboot)
2771 {
2772 RECT rcBtn1, rcBtn2;
2773
2774 /* Move the "Finish"/"Restart" button to where the "Cancel" button is */
2776 MapWindowPoints(HWND_DESKTOP /*NULL*/, hWndParent, (LPPOINT)&rcBtn1, sizeof(RECT)/sizeof(POINT));
2778 MapWindowPoints(HWND_DESKTOP /*NULL*/, hWndParent, (LPPOINT)&rcBtn2, sizeof(RECT)/sizeof(POINT));
2780 HWND_TOP,
2781 rcBtn1.left + (rcBtn2.right - rcBtn1.right),
2782 rcBtn1.top,
2783 0, 0,
2785
2786 /* Hide and disable also the "Cancel" buttons since we can only finish now */
2789
2790 /* Set up the reboot progress bar and countdown timer.
2791 * 300 steps at 50 ms each: 15 seconds */
2794 SetTimer(hwndDlg, 1, 50, NULL);
2795 }
2796 else if (!pSetupData->bStopInstall)
2797 {
2798 /* Keep the "Cancel" button shown and change its text to "Postpone" */
2800 pSetupData->hInstance,
2802 }
2803 else // (!bMustReboot && bStopInstall)
2804 {
2805 /* The installation is aborted, change the "Cancel" button text to "Close" */
2807 GetModuleHandleW(L"comctl32.dll"),
2808 IDS_CLOSE);
2809 }
2810 break;
2811 }
2812
2813 case PSN_KILLACTIVE:
2814 KillTimer(hwndDlg, 1);
2815 break;
2816
2817 case PSN_WIZBACK:
2818 /* Always disable going back */
2819 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2820 return TRUE;
2821
2822 case PSN_WIZNEXT:
2823 case PSN_WIZFINISH:
2824 {
2825 /* Press on "Finish"/"Restart" button */
2826 pSetupData->bMustReboot = TRUE;
2828 }
2829 case PSN_QUERYCANCEL:
2830 /* Press on "Cancel"/"Postpone" button */
2831 default:
2832 break;
2833 }
2834 break;
2835 }
2836
2837 default:
2838 break;
2839 }
2840
2841 return FALSE;
2842}
static VOID CenterWindow(HWND hWnd)
Definition: reactos.c:46
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:1877
VOID SetWindowResTextW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID)
Definition: reactos.c:284
#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 PSM_SETWIZBUTTONS
Definition: prsht.h:157
#define PSWIZB_FINISH
Definition: prsht.h:155
#define PSN_KILLACTIVE
Definition: prsht.h:116
#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
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 SWP_NOZORDER
Definition: winuser.h:1258
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SendDlgItemMessage
Definition: winuser.h:6008

◆ FormatAllocStringWV()

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

Definition at line 150 of file reactos.c.

155{
156 size_t Length;
157
158 /* Retrieve the message length. If it is too long, allocate
159 * an auxiliary buffer; otherwise use the caller's buffer. */
160 Length = _vscwprintf(pszFormat, args); // Doesn't count the NUL-terminator.
161 if (!*pString || (Length >= cchBufferLen))
162 {
163 /* Allocate a new buffer, adding a NUL-terminator */
165 if (!*pString)
166 return 0;
167 }
168
169 /* Do the printf */
170 StringCchVPrintfW(*pString, Length + 1, pszFormat, args);
171 return Length;
172}
_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 1296 of file reactos.c.

1300{
1301 switch (Command)
1302 {
1303 case PROGRESS:
1304 {
1305 PULONG Percent = (PULONG)Argument;
1306 DPRINT("%lu percent completed\n", *Percent);
1308 break;
1309 }
1310
1311#if 0
1312 case OUTPUT:
1313 {
1314 PTEXTOUTPUT output = (PTEXTOUTPUT)Argument;
1315 DPRINT("%s\n", output->Output);
1316 break;
1317 }
1318#endif
1319
1320 case DONE:
1321 {
1322#if 0
1323 PBOOLEAN Success = (PBOOLEAN)Argument;
1324 if (*Success == FALSE)
1325 {
1326 DPRINT("FormatEx was unable to complete successfully.\n\n");
1327 }
1328#endif
1329 DPRINT("Done\n");
1330 break;
1331 }
1332
1333 default:
1334 DPRINT("Unknown callback %lu\n", (ULONG)Command);
1335 break;
1336 }
1337
1338 return TRUE;
1339}
#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 2947 of file reactos.c.

2949{
2950 PLIST_ENTRY ListEntry;
2951 PVOID Entry;
2952
2953 while (!IsListEmpty(&MappingList->List))
2954 {
2955 ListEntry = RemoveHeadList(&MappingList->List);
2956 Entry = (PVOID)CONTAINING_RECORD(ListEntry, NT_WIN32_PATH_MAPPING, ListEntry);
2958 }
2959
2960 MappingList->MappingsCount = 0;
2961}
#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 1362 of file reactos.c.

1367{
1368 PFSVOL_CONTEXT FsVolContext = (PFSVOL_CONTEXT)Context;
1369
1370 switch (FormatStatus)
1371 {
1372 // FIXME: Deprecate!
1374 {
1375 // PPARTENTRY SystemPartition = (PPARTENTRY)Param1;
1376
1377 // FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
1378 // if (ChangeSystemPartitionPage(Ir, SystemPartition))
1379 // return FSVOL_DOIT;
1380 return FSVOL_ABORT;
1381 }
1382
1384 {
1385 switch (Param1)
1386 {
1388 {
1389 // ERROR_WRITE_PTABLE
1391 0, // Default to "Error"
1393 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1394 // TODO: Go back to the partitioning page?
1395 break;
1396 }
1397
1399 {
1400 /* FIXME: improve the error dialog */
1401 //
1402 // Error dialog should say that we cannot find a suitable
1403 // system partition and create one on the system. At this point,
1404 // it may be nice to ask the user whether he wants to continue,
1405 // or use an external drive as the system drive/partition
1406 // (e.g. floppy, USB drive, etc...)
1407 //
1409 0, // Default to "Error"
1411 // FsVolContext->NextPageOnAbort = SELECT_PARTITION_PAGE;
1412 // TODO: Go back to the partitioning page
1413 break;
1414 }
1415
1416 default:
1417 break;
1418 }
1419 return FSVOL_ABORT;
1420 }
1421
1424 // NOTE: If needed, clear progress gauges.
1425 return FSVOL_DOIT;
1426
1428 {
1429 if ((FSVOL_OP)Param1 == FSVOL_FORMAT)
1430 {
1431 /*
1432 * In case we just repair an existing installation, or make
1433 * an unattended setup without formatting, just go to the
1434 * filesystem check step.
1435 */
1436 if (FsVolContext->pSetupData->RepairUpdateFlag)
1437 return FSVOL_SKIP;
1440 return FSVOL_SKIP;
1442 /* Set status text */
1444 }
1445 else
1446 if ((FSVOL_OP)Param1 == FSVOL_CHECK)
1447 {
1448 /* Set status text */
1450
1451 /* Filechecking step: set progress marquee style and start it up */
1455 }
1456
1457 return FSVOL_DOIT;
1458 }
1459
1461 {
1462 if ((FSVOL_OP)Param1 == FSVOL_CHECK)
1463 {
1464 /* File-checking finished: stop the progress bar and restore its style */
1467 }
1468 return 0;
1469 }
1470
1472 {
1473 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1474
1475 // FIXME: See also FSVOLNOTIFY_PARTITIONERROR
1476 if (FmtInfo->ErrorStatus == STATUS_PARTITION_FAILURE)
1477 {
1478 // ERROR_WRITE_PTABLE
1480 0, // Default to "Error"
1482 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1483 // TODO: Go back to the partitioning page?
1484 return FSVOL_ABORT;
1485 }
1486 else
1488 {
1489 /* FIXME: show an error dialog */
1490 // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY, PathBuffer);
1492 0, // Default to "Error"
1494 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1495 return FSVOL_ABORT;
1496 }
1497 else
1498 if (FmtInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
1499 {
1500 INT nRet;
1501
1503 NULL, // Default to "Error"
1505 FmtInfo->FileSystemName);
1506 if (nRet == IDCANCEL)
1507 {
1508 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1509 return FSVOL_ABORT;
1510 }
1511 else if (nRet == IDOK)
1512 {
1513 return FSVOL_RETRY;
1514 }
1515 }
1516 else if (!NT_SUCCESS(FmtInfo->ErrorStatus))
1517 {
1518 ASSERT(*FmtInfo->Volume->Info.DeviceName);
1519
1520 DPRINT1("FormatPartition() failed with status 0x%08lx\n", FmtInfo->ErrorStatus);
1521
1522 // ERROR_FORMATTING_PARTITION
1524 0, // Default to "Error"
1526 FmtInfo->Volume->Info.DeviceName);
1527 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1528 return FSVOL_ABORT;
1529 }
1530
1531 return FSVOL_RETRY;
1532 }
1533
1535 {
1536 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1537
1538 if (ChkInfo->ErrorStatus == STATUS_NOT_SUPPORTED)
1539 {
1540 INT nRet;
1541
1543 NULL, // Default to "Error"
1545 ChkInfo->Volume->Info.FileSystem);
1546 if (nRet == IDCANCEL)
1547 {
1548 // FsVolContext->NextPageOnAbort = QUIT_PAGE;
1549 return FSVOL_ABORT;
1550 }
1551 else if (nRet == IDOK)
1552 {
1553 return FSVOL_SKIP;
1554 }
1555 }
1556 else if (!NT_SUCCESS(ChkInfo->ErrorStatus))
1557 {
1558 DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", ChkInfo->ErrorStatus);
1559
1561 0, // Default to "Error"
1563 ChkInfo->ErrorStatus);
1564 return FSVOL_SKIP;
1565 }
1566
1567 return FSVOL_SKIP;
1568 }
1569
1571 {
1572 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1573 PVOL_CREATE_INFO VolCreate;
1574
1575 ASSERT((FSVOL_OP)Param2 == FSVOL_FORMAT);
1576
1577 /* Find the volume info in the partition TreeList UI.
1578 * If none, don't format it. */
1580 FmtInfo->Volume);
1581 if (!VolCreate)
1582 return FSVOL_SKIP;
1583 ASSERT(VolCreate->Volume == FmtInfo->Volume);
1584
1585 /* If there is no formatting information, skip it */
1586 if (!*VolCreate->FileSystemName)
1587 return FSVOL_SKIP;
1588
1589 ASSERT(*FmtInfo->Volume->Info.DeviceName);
1590
1591 /* Set status text */
1592 if (FmtInfo->Volume->Info.DriveLetter)
1593 {
1596 IDS_FORMATTING_PROGRESS1, // L"Formatting volume %c: (%s) in %s..."
1597 FmtInfo->Volume->Info.DriveLetter,
1598 FmtInfo->Volume->Info.DeviceName,
1599 VolCreate->FileSystemName);
1600 }
1601 else
1602 {
1605 IDS_FORMATTING_PROGRESS2, // L"Formatting volume %s in %s..."
1606 FmtInfo->Volume->Info.DeviceName,
1607 VolCreate->FileSystemName);
1608 }
1609
1610 // StartFormat(FmtInfo, FileSystemList->Selected);
1611 FmtInfo->FileSystemName = VolCreate->FileSystemName;
1612 FmtInfo->MediaFlag = VolCreate->MediaFlag;
1613 FmtInfo->Label = VolCreate->Label;
1614 FmtInfo->QuickFormat = VolCreate->QuickFormat;
1615 FmtInfo->ClusterSize = VolCreate->ClusterSize;
1616 FmtInfo->Callback = FormatCallback;
1617
1618 /* Set up the progress bar */
1620 PBM_SETRANGE, 0, MAKELPARAM(0, 100));
1622 PBM_SETPOS, 0, 0);
1623
1624 return FSVOL_DOIT;
1625 }
1626
1628 {
1629 PFORMAT_VOLUME_INFO FmtInfo = (PFORMAT_VOLUME_INFO)Param1;
1630
1631 // EndFormat(FmtInfo->ErrorStatus);
1632 if (FmtInfo->FileSystemName)
1633 *(PWSTR)FmtInfo->FileSystemName = UNICODE_NULL; // FIXME: HACK!
1634
1635 // /* Reset the file system list */
1636 // ResetFileSystemList();
1637 return 0;
1638 }
1639
1641 {
1642 PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1643 PVOL_CREATE_INFO VolCreate;
1644
1645 ASSERT((FSVOL_OP)Param2 == FSVOL_CHECK);
1646
1647 /* Find the volume info in the partition TreeList UI.
1648 * If none, don't check it. */
1650 ChkInfo->Volume);
1651 if (!VolCreate)
1652 return FSVOL_SKIP;
1653 ASSERT(VolCreate->Volume == ChkInfo->Volume);
1654
1655 ASSERT(*ChkInfo->Volume->Info.DeviceName);
1656
1657 /* Set status text */
1658 if (ChkInfo->Volume->Info.DriveLetter)
1659 {
1662 IDS_CHECKING_PROGRESS1, // L"Checking volume %c: (%s)..."
1663 ChkInfo->Volume->Info.DriveLetter,
1664 ChkInfo->Volume->Info.DeviceName);
1665 }
1666 else
1667 {
1670 IDS_CHECKING_PROGRESS2, // L"Checking volume %s..."
1671 ChkInfo->Volume->Info.DeviceName);
1672 }
1673
1674 // StartCheck(ChkInfo);
1675 // TODO: Think about which values could be defaulted...
1676 ChkInfo->FixErrors = TRUE;
1677 ChkInfo->Verbose = FALSE;
1678 ChkInfo->CheckOnlyIfDirty = TRUE;
1679 ChkInfo->ScanDrive = FALSE;
1680 ChkInfo->Callback = ChkdskCallback;
1681
1682 return FSVOL_DOIT;
1683 }
1684
1686 {
1687 // PCHECK_VOLUME_INFO ChkInfo = (PCHECK_VOLUME_INFO)Param1;
1688 // EndCheck(ChkInfo->ErrorStatus);
1689 return 0;
1690 }
1691 }
1692
1693 return 0;
1694}
static BOOLEAN NTAPI FormatCallback(_In_ CALLBACKCOMMAND Command, _In_ ULONG Modifier, _In_ PVOID Argument)
Definition: reactos.c:1296
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:1289
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:187
ULONG ClusterSize
Definition: reactos.h:199
BOOLEAN QuickFormat
Definition: reactos.h:198
PVOLENTRY Volume
Definition: reactos.h:188
WCHAR FileSystemName[MAX_PATH+1]
Definition: reactos.h:195
FMIFS_MEDIA_FLAG MediaFlag
Definition: reactos.h:196
PCWSTR Label
Definition: reactos.h:197
#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 3306 of file reactos.c.

3307{
3308 static WCHAR SetupDllPath[MAX_PATH] = L"";
3309 static BOOL Init = FALSE;
3310 BOOL Success;
3311 DWORD PathSize;
3312
3313 /* Don't rebuild the path if we did it already */
3314 if (Init)
3315 return SetupDllPath;
3316 Init = TRUE;
3317
3318 /*
3319 * Retrieve the full path of the current running Setup instance.
3320 * From this we build the suitable path to the Setup DLL.
3321 */
3322 PathSize = GetModuleFileNameW(NULL, SetupDllPath, _countof(SetupDllPath));
3323 SetupDllPath[_countof(SetupDllPath) - 1] = UNICODE_NULL; // Ensure NUL-termination (see WinXP bug)
3324
3325 Success = ((PathSize != 0) && (PathSize < _countof(SetupDllPath)) &&
3327 if (Success)
3328 {
3329 /* Find the last path separator, remove it as well as the file name */
3330 PWCHAR pch = wcsrchr(SetupDllPath, L'\\');
3331 if (!pch)
3332 pch = SetupDllPath;
3333
3334 /* The Setup DLL is inside the System32 sub-directory */
3335 PathSize = _countof(SetupDllPath) - (pch - SetupDllPath);
3336 Success = SUCCEEDED(StringCchCopyW(pch, PathSize, L"\\system32"));
3337 }
3338 if (!Success)
3339 {
3340 /* Failure: invalidate the path; the DLL won't be found and delay-loaded */
3341 *SetupDllPath = UNICODE_NULL;
3342 }
3343
3344 return SetupDllPath;
3345}
#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 640 of file reactos.c.

642{
643 INT Index;
644
646 if (Index == CB_ERR)
647 return NULL;
648
650}
_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 698 of file reactos.c.

700{
701 INT Index;
702 LVITEM item;
703
705 if (Index == LB_ERR)
706 return NULL;
707
708 item.mask = LVIF_PARAM;
709 item.iItem = Index;
711
712 return (PVOID)item.lParam;
713}
#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 718 of file reactos.c.

722{
723 StringCchCopyW(Buffer, cchBufferSize,
725}
_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 3257 of file reactos.c.

3258{
3259 ATOM hotkey;
3260 MSG msg;
3261
3262 DPRINT("HotkeyThread start\n");
3263
3264 hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
3265 if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
3266 DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
3267
3268 while (GetMessageW(&msg, NULL, 0, 0))
3269 {
3270 if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
3271 {
3272 WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer.
3273 STARTUPINFOW si = { sizeof(si) };
3275
3276 if (CreateProcessW(NULL,
3277 CmdLine,
3278 NULL,
3279 NULL,
3280 FALSE,
3282 NULL,
3283 NULL,
3284 &si,
3285 &pi))
3286 {
3289 }
3290 else
3291 {
3292 DPRINT1("Failed to launch command prompt: %lu\n", GetLastError());
3293 }
3294 }
3295 }
3296
3297 UnregisterHotKey(NULL, hotkey);
3298 GlobalDeleteAtom(hotkey);
3299
3300 DPRINT("HotkeyThread terminate\n");
3301 return 0;
3302}
#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 602 of file reactos.c.

606{
607 INT Index, CurrentEntryIndex = 0;
608 PGENERIC_LIST_ENTRY ListEntry;
610 WCHAR CurrentItemText[256];
611
612 for (Entry = List->ListHead.Flink;
613 Entry != &List->ListHead;
614 Entry = Entry->Flink)
615 {
617
618 if (GetEntryDescriptionProc)
619 {
620 GetEntryDescriptionProc(ListEntry,
621 CurrentItemText,
622 ARRAYSIZE(CurrentItemText));
623 Index = SendMessageW(hWndList, CB_ADDSTRING, 0, (LPARAM)CurrentItemText);
624 }
625 else
626 {
628 }
629
630 if (ListEntry == List->CurrentEntry)
631 CurrentEntryIndex = Index;
632
634 }
635
636 SendMessageW(hWndList, CB_SETCURSEL, CurrentEntryIndex, 0);
637}
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 661 of file reactos.c.

665{
666 INT CurrentEntryIndex = 0;
667 LVITEM lvItem;
668 PGENERIC_LIST_ENTRY ListEntry;
670 WCHAR CurrentItemText[256];
671
672 for (Entry = List->ListHead.Flink;
673 Entry != &List->ListHead;
674 Entry = Entry->Flink)
675 {
677
678 if (!AddEntryItemProc)
679 continue;
680
681 AddEntryItemProc(hWndList,
682 &lvItem,
683 ListEntry,
684 CurrentItemText,
685 ARRAYSIZE(CurrentItemText));
686
687 if (ListEntry == List->CurrentEntry)
688 CurrentEntryIndex = lvItem.iItem;
689 }
690
691 ListView_EnsureVisible(hWndList, CurrentEntryIndex, FALSE);
692 ListView_SetItemState(hWndList, CurrentEntryIndex,
695}
#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 2939 of file reactos.c.

2941{
2942 InitializeListHead(&MappingList->List);
2943 MappingList->MappingsCount = 0;
2944}
#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 2556 of file reactos.c.

2557{
2558/* See reactos/undocuser.h */
2560
2561 /* Return success if a shell window is present, valid, and interactive */
2562 HWND hWndProgman = GetProgmanWindow();
2563 if (!(hWndProgman && IsWindow(hWndProgman) &&
2564 IsWindowEnabled(hWndProgman) && IsWindowVisible(hWndProgman)))
2565 {
2566 hWndProgman = GetShellWindow();
2567 }
2568 return (hWndProgman && IsWindow(hWndProgman) &&
2569 IsWindowEnabled(hWndProgman) && IsWindowVisible(hWndProgman));
2570}
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 115 of file reactos.c.

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

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

◆ LoadSetupData()

BOOL LoadSetupData ( IN OUT PSETUPDATA  pSetupData)

Definition at line 2844 of file reactos.c.

2846{
2847 pSetupData->PartitionList = CreatePartitionList();
2848 if (!pSetupData->PartitionList)
2849 {
2850 DPRINT1("Could not enumerate available disks; failing installation\n");
2851 return FALSE;
2852 }
2853
2854 pSetupData->NtOsInstallsList = CreateNTOSInstallationsList(pSetupData->PartitionList);
2855 if (!pSetupData->NtOsInstallsList)
2856 DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
2857
2858 /* Load the hardware, language and keyboard layout lists */
2859
2860 pSetupData->USetupData.ComputerList = CreateComputerTypeList(pSetupData->USetupData.SetupInf);
2861 pSetupData->USetupData.DisplayList = CreateDisplayDriverList(pSetupData->USetupData.SetupInf);
2862 pSetupData->USetupData.KeyboardList = CreateKeyboardDriverList(pSetupData->USetupData.SetupInf);
2863
2864 pSetupData->USetupData.LanguageList = CreateLanguageList(pSetupData->USetupData.SetupInf, pSetupData->DefaultLanguage);
2865
2866 /* If not unattended, overwrite language and locale with
2867 * the current ones of the running ReactOS instance */
2868 if (!IsUnattendedSetup)
2869 {
2870 LCID LocaleID = GetUserDefaultLCID();
2871
2872 StringCchPrintfW(pSetupData->DefaultLanguage,
2873 _countof(pSetupData->DefaultLanguage),
2874 L"%08lx", LocaleID);
2875
2876 StringCchPrintfW(pSetupData->USetupData.LocaleID,
2877 _countof(pSetupData->USetupData.LocaleID),
2878 L"%08lx", LocaleID);
2879 }
2880
2881 /* new part */
2882 pSetupData->SelectedLanguageId = pSetupData->DefaultLanguage;
2883 wcscpy(pSetupData->DefaultLanguage, pSetupData->USetupData.LocaleID); // FIXME: In principle, only when unattended.
2884 pSetupData->USetupData.LanguageId = (LANGID)(wcstol(pSetupData->SelectedLanguageId, NULL, 16) & 0xFFFF);
2885
2886 pSetupData->USetupData.LayoutList = CreateKeyboardLayoutList(pSetupData->USetupData.SetupInf,
2887 pSetupData->SelectedLanguageId,
2888 pSetupData->DefaultKBLayout);
2889
2890 /* If not unattended, overwrite keyboard layout with
2891 * the current one of the running ReactOS instance */
2892 if (!IsUnattendedSetup)
2893 {
2894 C_ASSERT(_countof(pSetupData->DefaultKBLayout) >= KL_NAMELENGTH);
2895 /* If the call fails, keep the default already stored in the buffer */
2896 GetKeyboardLayoutNameW(pSetupData->DefaultKBLayout);
2897 }
2898
2899 /* Change the default entries in the language and keyboard layout lists */
2900 {
2901 PGENERIC_LIST LanguageList = pSetupData->USetupData.LanguageList;
2902 PGENERIC_LIST LayoutList = pSetupData->USetupData.LayoutList;
2903 PGENERIC_LIST_ENTRY ListEntry;
2904
2905 /* Search for default language */
2906 for (ListEntry = GetFirstListEntry(LanguageList); ListEntry;
2907 ListEntry = GetNextListEntry(ListEntry))
2908 {
2909 PCWSTR LocaleId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
2910 if (!_wcsicmp(pSetupData->DefaultLanguage, LocaleId))
2911 {
2912 DPRINT("found %S in LanguageList\n", LocaleId);
2913 SetCurrentListEntry(LanguageList, ListEntry);
2914 break;
2915 }
2916 }
2917
2918 /* Search for default layout */
2919 for (ListEntry = GetFirstListEntry(LayoutList); ListEntry;
2920 ListEntry = GetNextListEntry(ListEntry))
2921 {
2922 PCWSTR pszLayoutId = ((PGENENTRY)GetListEntryData(ListEntry))->Id;
2923 // FIXME: Temporary "fix" to set the best keyboard entry depending on the
2924 // selected language in unattended setup; see also usetup!SetupStartPage().
2925 if (( pSetupData->bUnattend && !_wcsicmp(pSetupData->DefaultLanguage, pszLayoutId)) ||
2926 (!pSetupData->bUnattend && !_wcsicmp(pSetupData->DefaultKBLayout, pszLayoutId)))
2927 {
2928 DPRINT("Found %S in LayoutList\n", pszLayoutId);
2929 SetCurrentListEntry(LayoutList, ListEntry);
2930 break;
2931 }
2932 }
2933 }
2934
2935 return TRUE;
2936}
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 1892 of file reactos.c.

1894{
1895 PSETUPDATA pSetupData;
1896 HWND hwndDlg = (HWND)Param;
1897 HWND hWndParent = GetParent(hwndDlg);
1898 HWND hWndProgress;
1899 LONG_PTR dwStyle;
1900 ERROR_NUMBER ErrorNumber;
1903 FSVOL_CONTEXT FsVolContext;
1906
1907 /* Retrieve pointer to the global setup data */
1908 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1909
1910 /* Get the progress handle */
1911 hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS);
1912
1913 /* Setup global UI context */
1914 UiContext.hwndDlg = hwndDlg;
1916 UiContext.hWndProgress = hWndProgress;
1917 UiContext.dwPbStyle = 0;
1918
1919
1920 /* Disable the Close/Cancel buttons during all partition operations */
1921 // TODO: Consider, alternatively, to just show an info-box saying
1922 // that the installation process cannot be canceled at this stage?
1924
1925
1926 /*
1927 * Find/Set the system partition, and apply all pending partition operations.
1928 */
1929
1930 /* Create context for the volume/partition operations */
1931 FsVolContext.pSetupData = pSetupData;
1932
1933 /* Set status text */
1935 pSetupData->hInstance,
1937 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1938
1939 /* Find or set the active system partition before starting formatting */
1944 &FsVolContext);
1945 // if (!Success)
1946 // return FsVolContext.NextPageOnAbort;
1947 //
1948 // FIXME?? If cannot use any system partition, install FreeLdr on floppy / removable media??
1949 //
1950 if (!Success)
1951 {
1952 /* Display an error if an unexpected failure happened */
1953 MessageBoxW(hWndParent, L"Failed to find or set the system partition!", NULL, MB_ICONERROR);
1954
1955 /* Re-enable the Close/Cancel buttons */
1957 goto Quit;
1958 }
1959
1960
1961 /* Set status text */
1963 pSetupData->hInstance,
1965 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
1966
1967 /* Apply all pending operations on partitions: formatting and checking */
1972 &FsVolContext);
1973 if (!Success)
1974 {
1975 /* Display an error if an unexpected failure happened */
1976 MessageBoxW(hWndParent, L"Failed to prepare the partitions!", NULL, MB_ICONERROR);
1977
1978 /* Re-enable the Close/Cancel buttons */
1980 goto Quit;
1981 }
1982
1983
1984 /* Re-enable the Close/Cancel buttons */
1986
1987
1988 /* Re-calculate the final destination paths */
1990 Status = InitDestinationPaths(&pSetupData->USetupData,
1991 NULL, // pSetupData->USetupData.InstallationDirectory,
1994 if (!Success)
1995 {
1996 DisplayMessage(hWndParent, MB_ICONERROR, NULL, L"InitDestinationPaths() failed with status 0x%08lx\n", Status);
1997 goto Quit;
1998 }
1999
2000
2001 /*
2002 * Preparation of the list of files to be copied
2003 */
2004
2005 /* Set status text */
2007 pSetupData->hInstance,
2009 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2010
2011 /* Set progress marquee style and start it up */
2012 dwStyle = GetWindowLongPtrW(hWndProgress, GWL_STYLE);
2013 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle | PBS_MARQUEE);
2014 SendMessageW(hWndProgress, PBM_SETMARQUEE, TRUE, 0);
2015
2016 /* Prepare the list of files */
2017 /* ErrorNumber = */ Success = PrepareFileCopy(&pSetupData->USetupData, NULL);
2018
2019 /* Stop progress and restore its style */
2020 SendMessageW(hWndProgress, PBM_SETMARQUEE, FALSE, 0);
2021 SetWindowLongPtrW(hWndProgress, GWL_STYLE, dwStyle);
2022
2023 if (/*ErrorNumber != ERROR_SUCCESS*/ !Success)
2024 {
2025 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
2026 if (!pSetupData->bAbortInstall)
2027 MessageBoxW(hWndParent, L"Failed to prepare the list of files!", NULL, MB_ICONERROR);
2028 goto Quit;
2029 }
2030
2031
2032 /*
2033 * Perform the file copy
2034 */
2035
2036 /* Set status text */
2038 pSetupData->hInstance,
2040 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2041
2042 /* Create context for the copy process */
2043 CopyContext.pSetupData = pSetupData;
2044 CopyContext.TotalOperations = 0;
2045 CopyContext.CompletedOperations = 0;
2046
2047 /* Do the file copying - The callback handles whether or not we should stop file copying */
2049 if (!Success)
2050 {
2051 /* Display an error only if an unexpected failure happened, and not because the user cancelled the installation */
2052 if (!pSetupData->bAbortInstall)
2053 MessageBoxW(hWndParent, L"Failed to copy the files!", NULL, MB_ICONERROR);
2054 goto Quit;
2055 }
2056
2057 // /* Set status text */
2058 // SetWindowResTextW(GetDlgItem(hwndDlg, IDC_ACTIVITY),
2059 // pSetupData->hInstance,
2060 // IDS_INSTALL_FINALIZE);
2061 // SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2062
2063 /* Create the $winnt$.inf file */
2064 InstallSetupInfFile(&pSetupData->USetupData);
2065
2066
2067 /* Disable the Close/Cancel buttons for the remaining non-cancellable operations */
2068 // TODO: Consider, alternatively, to just show an info-box saying
2069 // that the installation process cannot be canceled at this stage?
2071
2072 /*
2073 * Create or update the registry hives
2074 */
2075
2076 /* Set status text */
2078 pSetupData->hInstance,
2081 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2082
2083 /* Set up the progress bar */
2084 SendMessageW(hWndProgress,
2085 PBM_SETRANGE, 0,
2086 MAKELPARAM(0, 8)); // FIXME: hardcoded number of steps, see StringIDs[] array in RegistryStatus()
2087 SendMessageW(hWndProgress,
2088 PBM_SETSTEP, 1, 0);
2089 SendMessageW(hWndProgress,
2090 PBM_SETPOS, 0, 0);
2091
2092 ErrorNumber = UpdateRegistry(&pSetupData->USetupData,
2093 pSetupData->RepairUpdateFlag,
2094 pSetupData->PartitionList,
2095 InstallVolume->Info.DriveLetter,
2096 pSetupData->SelectedLanguageId,
2098 NULL /* SubstSettings */);
2099 DBG_UNREFERENCED_PARAMETER(ErrorNumber);
2101
2102 /*
2103 * And finally, install the bootloader
2104 */
2105
2106 /* Set status text */
2108 pSetupData->hInstance,
2110 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2111
2113 StringCchPrintfW(PathBuffer, _countof(PathBuffer),
2114 L"%s\\", SystemPartition->DeviceName);
2115 RtlCreateUnicodeString(&pSetupData->USetupData.SystemRootPath, PathBuffer);
2116 DPRINT1("SystemRootPath: %wZ\n", &pSetupData->USetupData.SystemRootPath);
2117
2118 switch (pSetupData->USetupData.BootLoaderLocation)
2119 {
2120 /* Install on removable disk */
2121 case 1:
2122 {
2123 // TODO: So far SETUP only supports the 1st floppy.
2124 // Use a simple UI like comdlg32's DlgDirList* to show
2125 // a list of drives that the user could select.
2126 static const UNICODE_STRING FloppyDrive = RTL_CONSTANT_STRING(L"\\Device\\Floppy0\\");
2127 static const WCHAR DriveLetter = L'A';
2128
2129 INT nRet;
2130 RetryCancel:
2133 L"Bootloader installation",
2134 L"Please insert a blank floppy disk in drive %c: .\n"
2135 L"All data in the floppy disk will be erased!\n"
2136 L"\nClick on OK to continue."
2137 L"\nClick on CANCEL to skip bootloader installation.",
2138 DriveLetter);
2139 if (nRet != IDOK)
2140 break; /* Skip installation */
2141
2142 Retry:
2144 &FloppyDrive,
2145 &pSetupData->USetupData.SourceRootPath,
2146 &pSetupData->USetupData.DestinationArcPath);
2147 if (Status == STATUS_SUCCESS)
2148 break; /* Successful installation */
2149
2151 {
2152 // ERROR_NO_FLOPPY
2155 NULL, // Default to "Error"
2156 L"No disk detected in drive %c: .",
2157 DriveLetter);
2158 if (nRet == IDRETRY)
2159 goto Retry;
2160 }
2161 else if ((Status == ERROR_WRITE_BOOT) ||
2163 {
2164 /* Error when writing the boot code */
2166 0, // Default to "Error"
2168 }
2169 else if (!NT_SUCCESS(Status))
2170 {
2171 /* Any other NTSTATUS failure code */
2172 DPRINT1("InstallBootcodeToRemovable() failed: Status 0x%lx\n", Status);
2174 0, // Default to "Error"
2176 Status);
2177 }
2178 goto RetryCancel;
2179 }
2180
2181 /* Install on hard-disk */
2182 case 2: // System partition / MBR and VBR (on BIOS-based PC)
2183 case 3: // VBR only (on BIOS-based PC)
2184 {
2185 /* Copy FreeLoader to the disk and save the boot entries */
2187 pSetupData->USetupData.ArchType,
2188 &pSetupData->USetupData.SystemRootPath,
2189 &pSetupData->USetupData.SourceRootPath,
2190 &pSetupData->USetupData.DestinationArcPath,
2191 (pSetupData->USetupData.BootLoaderLocation == 2)
2192 ? 1 /* Install MBR and VBR */
2193 : 0 /* Install VBR only */);
2194 if (Status == STATUS_SUCCESS)
2195 break; /* Successful installation */
2196
2197 if (Status == ERROR_WRITE_BOOT)
2198 {
2199 /* Error when writing the VBR */
2201 0, // Default to "Error"
2203 SystemVolume->Info.FileSystem);
2204 }
2205 else if (Status == ERROR_INSTALL_BOOTCODE)
2206 {
2207 /* Error when writing the MBR */
2209 0, // Default to "Error"
2211 L"MBR");
2212 }
2213 else if (Status == STATUS_NOT_SUPPORTED)
2214 {
2216 0, // Default to "Error"
2218 }
2219 else if (!NT_SUCCESS(Status))
2220 {
2221 /* Any other NTSTATUS failure code */
2222 DPRINT1("InstallBootManagerAndBootEntries() failed: Status 0x%lx\n", Status);
2224 0, // Default to "Error"
2226 Status);
2227 }
2228 Success = FALSE;
2229 goto Quit;
2230 }
2231
2232 /* Skip installation */
2233 case 0:
2234 default:
2235 break;
2236 }
2237
2238Quit:
2239 /* Signal the wizard page that we have succeeded or failed */
2240 PostMessage(hwndDlg, PM_INSTALL_DONE, Success, 0); // Status
2241 return Success;
2242}
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:1839
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1362
#define SystemVolume
Definition: reactos.c:35
#define InstallVolume
Definition: reactos.c:30
#define PM_INSTALL_DONE
Definition: reactos.c:1888
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:1707
#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
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
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:866
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:681
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:1157
#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
UCHAR bAbortInstall
Definition: reactos.h:141
PCWSTR SelectedLanguageId
Definition: reactos.h:171
PPARTLIST PartitionList
Definition: reactos.h:160
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 PostMessage
Definition: winuser.h:5998
#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 2248 of file reactos.c.

2253{
2254 PSETUPDATA pSetupData;
2255
2256 /* Retrieve pointer to the global setup data */
2257 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
2258
2259 switch (uMsg)
2260 {
2261 case WM_INITDIALOG:
2262 {
2263 /* Save pointer to the global setup data */
2264 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
2265 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
2266
2267 /* Reset the status text and set the main label in bold */
2268 SetDlgItemTextW(hwndDlg, IDC_ACTIVITY, L"");
2269 SetDlgItemTextW(hwndDlg, IDC_ITEM, L"");
2270 SetDlgItemFont(hwndDlg, IDC_ACTIVITY, pSetupData->hBoldFont, TRUE);
2271 break;
2272 }
2273
2274 case WM_SETCURSOR:
2275 {
2276 /* Set a page-wide cursor */
2277 if (!hWaitCursor)
2278 break;
2281 return TRUE;
2282 }
2283
2284 case WM_NOTIFY:
2285 {
2286 LPNMHDR lpnm = (LPNMHDR)lParam;
2287
2288 switch (lpnm->code)
2289 {
2290 case PSN_SETACTIVE:
2291 {
2292 HWND hWndParent = GetParent(hwndDlg);
2293
2294 /*
2295 * Disable all buttons during installation, and hide "Back" and "Next".
2296 * Don't use the PropSheet_SetWizButtons() macro, because its
2297 * posted message would be handled after hiding the buttons.
2298 * The message would then interfere with the hidden buttons
2299 * (when both "Back" and "Next" are hidden, "Next" gets forcefully shown).
2300 */
2302 // PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT);
2305
2306 /* Start the installation procedure once the page is fully displayed */
2307 PostMessageW(hwndDlg, PM_INSTALL_START, 0, 0);
2308 break;
2309 }
2310
2311 case PSN_KILLACTIVE:
2312 {
2313 /* Avoid reentrant calls caused by the message dispatching
2314 * done below: allow only the first page change, and ignore
2315 * all the others. */
2318 {
2320 return TRUE;
2321 }
2322
2323 /* If no installation is running, just change the page */
2324 if (!pSetupData->hInstallThread)
2325 break;
2326
2327 /* Wait for the installation thread to terminate.
2328 * Since we dispatch messages in the meantime, we must
2329 * guard the property sheet notification handlers from
2330 * being invoked multiple times. */
2332 if (dwStatus == WAIT_TIMEOUT)
2333 {
2334 /* Show the hourglass cursor */
2335 HCURSOR hOldCursor;
2337 hOldCursor = SetCursor(hWaitCursor);
2339
2340 for (;;)
2341 {
2342 MSG msg;
2344 FALSE, INFINITE,
2346 if (dwStatus != (WAIT_OBJECT_0 + 1))
2347 break; // Stop if anything else (thread terminated, timeout or failure).
2348
2349 /* We still need to process main window messages to avoid freeze */
2350 while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
2351 {
2354 }
2355 }
2356
2357 /* Restore the old cursor */
2359 SetCursor(hOldCursor);
2360 hWaitCursor = NULL;
2361 }
2362#if 0 && DBG
2363 if (dwStatus == WAIT_OBJECT_0)
2364 {
2365 DWORD dwExitCode = NO_ERROR;
2366 GetExitCodeThread(pSetupData->hInstallThread, &dwExitCode);
2367 DBG_UNREFERENCED_PARAMETER(dwExitCode);
2368 }
2369#endif
2370 /* Cleanup; we can now change the page */
2371 CloseHandle(pSetupData->hInstallThread);
2372 pSetupData->hInstallThread = NULL;
2373 CloseHandle(pSetupData->hHaltInstallEvent);
2374 pSetupData->hHaltInstallEvent = NULL;
2375 break;
2376 }
2377
2378 case PSN_QUERYCANCEL:
2379 {
2380 INT nRet;
2381
2382 if (pSetupData->bStopInstall)
2383 {
2384 /* The installation is terminating (either successfully,
2385 * or cancelled by the user or due to an error), ignore all
2386 * new requests since this is now too late to change bets. */
2387 nRet = IDYES;
2388 }
2389 else
2390 {
2391 /* Halt the on-going file copy */
2392 ResetEvent(pSetupData->hHaltInstallEvent);
2393
2394 nRet = DisplayMessage(GetParent(hwndDlg),
2398 if (nRet == IDYES)
2399 {
2400 /* Signal the file copy thread to stop */
2402 }
2403 /* else, we don't stop installation, resume file copy */
2404 SetEvent(pSetupData->hHaltInstallEvent);
2405 }
2406
2407 /* If we are not already in the process of cancelling
2408 * the installation or switching to a page, do it now. */
2409 if ((nRet == IDYES) && !pSetupData->bPageSwitching &&
2412 {
2413 /* Go to the Abort page */
2414#ifdef TERMINATE_USE_PRESSBUTTON
2417#else
2418 PostMessageW(hwndDlg, PM_INSTALL_DONE, FALSE, 0);
2419#endif
2420 }
2421
2422 /* Do not close the wizard too soon */
2424 return TRUE;
2425 }
2426
2427 case PSN_WIZBACK:
2428 /* Always disable going back */
2429 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2430 return TRUE;
2431
2432 case PSN_WIZNEXT:
2433 {
2434#ifdef TERMINATE_USE_PRESSBUTTON
2435 LONG_PTR nNextPage = (!pSetupData->bAbortInstall ? IDD_FINISHPAGE : IDD_ABORTPAGE);
2436 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, nNextPage);
2437#else
2438 /* Always disable going next */
2439 SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
2440#endif
2441 return TRUE;
2442 }
2443
2444 default:
2445 break;
2446 }
2447 break;
2448 }
2449
2450 case PM_INSTALL_START:
2451 {
2452 HWND hWndParent = GetParent(hwndDlg);
2453
2454 ASSERT(pSetupData->hInstallThread == NULL);
2455
2456 /* Force repainting first to make sure the wizard is visible */
2459
2460 /* Create the file-copy halt (manual-reset) event */
2461 pSetupData->hHaltInstallEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
2462 if (!pSetupData->hHaltInstallEvent)
2463 {
2465 L"Cannot create the install event, error %lu\n", GetLastError());
2466 goto Fail;
2467 }
2468 /* Start the installation thread */
2469 pSetupData->bStopInstall = FALSE;
2470 pSetupData->hInstallThread = CreateThread(NULL, 0,
2472 (PVOID)hwndDlg,
2473 0, NULL);
2474 if (!pSetupData->hInstallThread)
2475 {
2477 L"Cannot create the installation thread, error %lu\n", GetLastError());
2478 CloseHandle(pSetupData->hHaltInstallEvent);
2479 pSetupData->hHaltInstallEvent = NULL;
2480 Fail:
2481 /* Cancel the installation */
2483#ifdef TERMINATE_USE_PRESSBUTTON
2486#else
2487 SendMessageW(hwndDlg, PM_INSTALL_DONE, FALSE, 0);
2488#endif
2489 }
2490 break;
2491 }
2492
2493 case PM_INSTALL_DONE:
2494 {
2495 HWND hWndParent = GetParent(hwndDlg);
2496 BOOL Success = !!wParam;
2497 BOOL AutoSwitchPage = TRUE;
2498
2499 /* If an unexpected error happened, stay on the copy page to allow
2500 * the user to view the current state, and keep the Close/Cancel
2501 * buttons to allow going to the Abort page.
2502 * Otherwise, we have been manually cancelled by the user and we
2503 * will directly switch to the Abort page. */
2504 if (!Success && !pSetupData->bStopInstall)
2505 {
2507 AutoSwitchPage = FALSE;
2508 }
2509 else
2510 {
2511 /* Disable the Close/Cancel buttons, since the installation has
2512 * either successfully terminated, or was already cancelled by
2513 * the user. */
2515 }
2516
2517 if (!Success)
2518 {
2519 /* The installation was aborted */
2521 }
2522 else if (pSetupData->bAbortInstall)
2523 {
2524 /* Override success in case the thread just terminated with some status
2525 * while at the same time, the user chose to cancel the installation */
2526 Success = FALSE;
2527 }
2528
2529 /* We are done! Switch to the Finish or the Abort page */
2530 if (!AutoSwitchPage)
2531 break;
2532 // TODO: if (!Success): Unwind installation.
2533#ifdef TERMINATE_USE_PRESSBUTTON
2534 // NOTE: In this case, PSN_QUERYCANCEL **CANNOT** call PM_INSTALL_DONE
2536#else
2537 if (!Success)
2540#endif
2541 break;
2542 }
2543
2544 default:
2545 break;
2546 }
2547
2548 return FALSE;
2549}
HCURSOR hWaitCursor
Definition: reactos.c:39
#define PM_INSTALL_START
Definition: reactos.c:1887
static DWORD WINAPI PrepareAndDoCopyThread(IN LPVOID Param)
Definition: reactos.c:1892
#define SETUP_ABORT_INSTALL
Definition: reactos.h:140
#define SETUP_PAGE_SWITCHING
Definition: reactos.h:146
#define SETUP_IS_CANCELLING
Definition: reactos.h:143
#define InterlockedFlagsTestAndSet8(Target, Flags)
Definition: reactos.h:118
#define IDD_FINISHPAGE
Definition: resource.h:74
#define NO_ERROR
Definition: dderror.h:5
#define WAIT_TIMEOUT
Definition: dderror.h:14
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
int Fail
Definition: ehthrow.cxx:24
#define InterlockedOr8
Definition: interlocked.h:244
#define PSBTN_CANCEL
Definition: prsht.h:151
#define PSBTN_NEXT
Definition: prsht.h:147
DWORD dwStatus
Definition: mediaobj.idl:95
UCHAR bPageSwitching
Definition: reactos.h:147
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
char * PCHAR
Definition: typedefs.h:51
#define WAIT_OBJECT_0
Definition: winbase.h:383
HICON HCURSOR
Definition: windef.h:99
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI ShowCursor(_In_ BOOL)
Definition: cursoricon.c:3071
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:893
#define QS_ALLINPUT
Definition: winuser.h:914
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5978
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define WM_SETCURSOR
Definition: winuser.h:1664
#define IDC_WAIT
Definition: winuser.h:697
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

◆ 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 1877 of file reactos.c.

1880{
1881 EnableDlgItem(hWndWiz, IDCANCEL, Enable);
1883 SC_CLOSE,
1885}
_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(), PrepareAndDoCopyThread(), and ProcessDlgProc().

◆ PropSheetCallback()

static int CALLBACK PropSheetCallback ( _In_ HWND  hDlg,
_In_ UINT  message,
_In_ LPARAM  lParam 
)
static

Definition at line 3494 of file reactos.c.

3498{
3499 switch (message)
3500 {
3501 case PSCB_PRECREATE:
3502 {
3503 LPDLGTEMPLATE dlgTemplate = (LPDLGTEMPLATE)lParam;
3504 LPDLGTEMPLATEEX dlgTemplateEx = (LPDLGTEMPLATEEX)lParam;
3505 DWORD dwStyle = 0, dwStyleMask = 0;
3506
3507 // FIXME: HACK: See hack in PropSheetCallback()::PSCB_INITIALIZED
3508 // Hide the dialog by default; DM_REPOSITION will center it on screen then show it.
3509 dwStyleMask |= WS_VISIBLE;
3510
3511 dwStyle |= DS_CENTER; // Center the dialog -- But propsheet code repositions it afterwards...
3512 //dwStyleMask |= DS_CONTEXTHELP; // TODO: Enable if you want context help.
3513 dwStyle |= DS_SETFOREGROUND; // Ensure we are initially set to the foreground.
3514 dwStyleMask |= dwStyle;
3515
3516 /* Set the property sheet dialog styles */
3517 if (dlgTemplateEx->signature == 0xFFFF)
3518 dlgTemplateEx->style = (dlgTemplateEx->style & ~dwStyleMask) | (dwStyle & dwStyleMask);
3519 else
3520 dlgTemplate->style = (dlgTemplate->style & ~dwStyleMask) | (dwStyle & dwStyleMask);
3521 break;
3522 }
3523
3524 // NOTE: This callback is needed to set large icon correctly.
3525 case PSCB_INITIALIZED:
3526 {
3528 SendMessageW(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
3529
3530 /* Sub-class the property sheet window procedure */
3532
3533 // FIXME: HACK: Wine comctl32 propsheet.c doesn't send DM_REPOSITION
3534 // after creating, initializing and resizing the property sheet dialog,
3535 // so we simulate its call there...
3536 PostMessageW(hDlg, DM_REPOSITION, 0, 0);
3537 break;
3538 }
3539
3540 default:
3541 break;
3542 }
3543
3544 return FALSE;
3545}
struct DLGTEMPLATEEX * LPDLGTEMPLATEEX
WNDPROC wpOrgPrshtProc
Definition: reactos.c:3446
static LRESULT CALLBACK PrshtWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
Definition: reactos.c:3451
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define WS_VISIBLE
Definition: pedump.c:620
#define PSCB_PRECREATE
Definition: prsht.h:76
#define PSCB_INITIALIZED
Definition: prsht.h:75
WORD signature
Definition: msconfig.c:127
DWORD style
Definition: msconfig.c:130
DWORD style
Definition: winuser.h:3167
Definition: tftpd.h:60
#define ICON_BIG
Definition: tnclass.cpp:51
#define DWLP_DLGPROC
Definition: winuser.h:882
struct DLGTEMPLATE * LPDLGTEMPLATE
#define DS_CENTER
Definition: winuser.h:369
#define DS_SETFOREGROUND
Definition: winuser.h:379
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define DM_REPOSITION
Definition: winuser.h:2136
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444

Referenced by _tWinMain().

◆ PrshtWndProc()

static LRESULT CALLBACK PrshtWndProc ( HWND  hWnd,
UINT  uMessage,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 3451 of file reactos.c.

3452{
3453 switch (uMessage)
3454 {
3455 case DM_REPOSITION:
3456 {
3457 /* Center the wizard window */
3459 // FIXME: HACK: See hack in PropSheetCallback()::PSCB_INITIALIZED
3461 break;
3462 }
3463
3464 case WM_SETCURSOR:
3465 {
3466 /* Set a wizard-wide cursor */
3467 // NOTE: There is a problem, where when hovering over the wizard
3468 // navigation buttons, the cursor would blink with the arrow.
3469 // To mitigate this problem, only show the custom cursor when
3470 // we are on the main wizard window.
3471 if (!(hWaitCursor && (wParam == (WPARAM)hWnd)))
3472 break;
3474 return TRUE;
3475 }
3476
3477 case WM_DESTROY:
3478 {
3479 /* Restore the original dialog procedure */
3482 }
3483
3484 default:
3485 break;
3486 }
3487
3488 /* Invoke the original dialog procedure */
3489 return CallWindowProc(wpOrgPrshtProc, hWnd, uMessage, wParam, lParam);
3490}
UINT_PTR WPARAM
Definition: minwindef.h:174
#define SW_SHOWNORMAL
Definition: winuser.h:781
#define CallWindowProc
Definition: winuser.h:5901
#define WM_DESTROY
Definition: winuser.h:1637

Referenced by PropSheetCallback().

◆ RegistryStatus()

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

Definition at line 1839 of file reactos.c.

1840{
1841 /* WARNING: Please keep this lookup table in sync with the resources! */
1842 static const UINT StringIDs[] =
1843 {
1844 IDS_REG_DONE, /* Success */
1845 IDS_REG_REGHIVEUPDATE, /* RegHiveUpdate */
1846 IDS_REG_IMPORTFILE, /* ImportRegHive */
1847 IDS_REG_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */
1848 IDS_REG_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */
1849 IDS_REG_ADDKBLAYOUTS, /* KeybLayouts */
1850 IDS_REG_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */
1851 IDS_REG_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */
1852 };
1853
1854 if (RegStatus < _countof(StringIDs))
1855 {
1856 va_list args;
1857 va_start(args, RegStatus);
1859 va_end(args);
1860 }
1861 else
1862 {
1864 }
1865
1867}
VOID SetWindowResPrintfVW(_In_ HWND hWnd, _In_opt_ HINSTANCE hInstance, _In_ UINT uID, _In_ va_list args)
Definition: reactos.c:303
#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 3365 of file reactos.c.

3366{
3367 static CHAR dllPath[MAX_PATH];
3368 static PCWSTR setupDllPath = NULL;
3369
3370 switch (dliNotify)
3371 {
3373 {
3374 // NOTE: Add any other needed setup-specific DLLs there.
3375 if (_stricmp(pdli->szDll, "setuplib.dll") == 0)
3376 {
3377 if (!setupDllPath)
3378 setupDllPath = GetLocalSetupDllPath();
3379 if (setupDllPath && *setupDllPath &&
3380 SUCCEEDED(StringCchPrintfA(dllPath, _countof(dllPath), "%S\\%s",
3381 setupDllPath, pdli->szDll)))
3382 {
3383 pdli->szDll = dllPath; /* Set szDll to the new path */
3384 }
3385 }
3386 break; /* Load the DLL using the modified path */
3387 }
3388
3389 case dliFailLoadLib:
3390 {
3391 /*
3392 * Library loading failed.
3393 * Raise a hard error instead of the default
3394 * exception, and "cleanly" kill the process.
3395 */
3396 ANSI_STRING DllPathA;
3398 ULONG_PTR Parameters[] = {(ULONG_PTR)&DllPathU};
3400
3401 RtlInitAnsiString(&DllPathA, pdli->szDll);
3402 RtlAnsiStringToUnicodeString(&DllPathU, &DllPathA, FALSE);
3405 0x1,
3406 Parameters,
3407 OptionOk,
3408 &Response);
3409 ExitProcess(-1);
3410 break;
3411 }
3412
3413 default:
3414 break;
3415 }
3416
3417 return NULL;
3418}
#define DECLARE_UNICODE_STRING_SIZE(_var, _size)
Definition: reactos.c:3348
static PCWSTR GetLocalSetupDllPath(VOID)
Definition: reactos.c:3306
#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 303 of file reactos.c.

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

Referenced by RegistryStatus(), and SetWindowResPrintfW().

◆ SetWindowResPrintfW()

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

Definition at line 341 of file reactos.c.

346{
348
349 va_start(args, uID);
351 va_end(args);
352}

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

◆ SetWindowResTextW()

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

Definition at line 284 of file reactos.c.

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

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
  • Center the wizard window *‍/

Definition at line 355 of file reactos.c.

360{
361 PSETUPDATA pSetupData;
362
363 /* Retrieve pointer to the global setup data */
364 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
365
366 switch (uMsg)
367 {
368 case WM_INITDIALOG:
369 {
370 /* Save pointer to the global setup data */
371 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
372 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
373
374 /* Set title font */
375 SetDlgItemFont(hwndDlg, IDC_STARTTITLE, pSetupData->hTitleFont, TRUE);
376
377 // TEMPTEMP: Set the ReactOS-Alpha information in bold.
378 // TODO: Remove once we reach 0.5/Beta :)
379 SetDlgItemFont(hwndDlg, IDC_WARNTEXT1, pSetupData->hBoldFont, TRUE);
380 SetDlgItemFont(hwndDlg, IDC_WARNTEXT2, pSetupData->hBoldFont, TRUE);
381 SetDlgItemFont(hwndDlg, IDC_WARNTEXT3, pSetupData->hBoldFont, TRUE);
382
384 //CenterWindow(GetParent(hwndDlg));
385 return TRUE;
386 }
387
388 case WM_NOTIFY:
389 {
390 LPNMHDR lpnm = (LPNMHDR)lParam;
391
392 switch (lpnm->code)
393 {
394 case PSN_SETACTIVE:
395 {
396 /* Only "Next" and "Cancel" for the first page and hide "Back".
397 * Don't use the PropSheet_SetWizButtons() macro, because its
398 * posted message could interfere with the hidden button. */
400 // PropSheet_ShowWizButtons(GetParent(hwndDlg), 0, PSWIZB_BACK);
402 break;
403 }
404
405 case PSN_KILLACTIVE:
406 {
407 /* Show "Back" button */
408 // PropSheet_ShowWizButtons(GetParent(hwndDlg), PSWIZB_BACK, PSWIZB_BACK);
410 break;
411 }
412
413 default:
414 break;
415 }
416 break;
417 }
418
419 default:
420 break;
421 }
422
423 return FALSE;
424}
#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

◆ SummaryDlgProc()

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

Definition at line 1089 of file reactos.c.

1094{
1095 static WCHAR szOrgWizNextBtnText[260]; // TODO: Make it dynamic
1096
1097 PSETUPDATA pSetupData;
1098
1099 /* Retrieve pointer to the global setup data */
1100 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1101
1102 switch (uMsg)
1103 {
1104 case WM_INITDIALOG:
1105 {
1106 /* Save pointer to the global setup data */
1107 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
1108 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
1109 break;
1110 }
1111
1112 case WM_COMMAND:
1113 {
1115 {
1116 // Ideally we could add the PSWIZBF_ELEVATIONREQUIRED style.
1119 else
1121 }
1122 break;
1123 }
1124
1125 case WM_NOTIFY:
1126 {
1127 LPNMHDR lpnm = (LPNMHDR)lParam;
1128
1129 switch (lpnm->code)
1130 {
1131 case PSN_SETACTIVE:
1132 {
1133 WCHAR CurrentItemText[256];
1134
1136
1137 /* Show the current selected settings */
1138
1139 // FIXME! Localize
1140 if (pSetupData->RepairUpdateFlag)
1141 {
1142 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1143 L"Upgrading/Repairing \"%s\" from \"%s\"",
1145 pSetupData->CurrentInstallation->VendorName);
1146 }
1147 else
1148 {
1149 StringCchCopyW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1150 L"New ReactOS installation");
1151 }
1152 SetDlgItemTextW(hwndDlg, IDC_INSTALLTYPE, CurrentItemText);
1153
1154 SetDlgItemTextW(hwndDlg, IDC_INSTALLSOURCE, L"n/a");
1155 SetDlgItemTextW(hwndDlg, IDC_ARCHITECTURE, L"n/a");
1156
1158 CurrentItemText,
1159 ARRAYSIZE(CurrentItemText));
1160 SetDlgItemTextW(hwndDlg, IDC_COMPUTER, CurrentItemText);
1161
1163 CurrentItemText,
1164 ARRAYSIZE(CurrentItemText));
1165 SetDlgItemTextW(hwndDlg, IDC_DISPLAY, CurrentItemText);
1166
1168 CurrentItemText,
1169 ARRAYSIZE(CurrentItemText));
1170 SetDlgItemTextW(hwndDlg, IDC_KEYBOARD, CurrentItemText);
1171
1172 if (InstallVolume->Info.DriveLetter)
1173 {
1174#if 0
1175 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1176 L"%c: \x2014 %wZ",
1177 InstallVolume->Info.DriveLetter,
1178 &pSetupData->USetupData.DestinationRootPath);
1179#else
1180 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1181 L"%c: \x2014 Harddisk %lu, Partition %lu",
1182 InstallVolume->Info.DriveLetter,
1183 InstallPartition->DiskEntry->DiskNumber,
1185#endif
1186 }
1187 else
1188 {
1189#if 0
1190 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1191 L"%wZ",
1192 &pSetupData->USetupData.DestinationRootPath);
1193#else
1194 StringCchPrintfW(CurrentItemText, ARRAYSIZE(CurrentItemText),
1195 L"Harddisk %lu, Partition %lu",
1196 InstallPartition->DiskEntry->DiskNumber,
1198#endif
1199 }
1200 SetDlgItemTextW(hwndDlg, IDC_DESTDRIVE, CurrentItemText);
1201
1202 SetDlgItemTextW(hwndDlg, IDC_PATH,
1204 /*pSetupData->USetupData.InstallPath.Buffer*/);
1205
1206
1207 /* Change the "Next" button text to "Install" */
1208 // PropSheet_SetNextText(GetParent(hwndDlg), ...);
1210 szOrgWizNextBtnText, ARRAYSIZE(szOrgWizNextBtnText));
1212 pSetupData->hInstance,
1214
1215 /* Keep the "Next" button disabled. It will be enabled only
1216 * when the user clicks on the installation approval checkbox. */
1219 break;
1220 }
1221
1223 {
1224 /* Focus on the confirmation check-box */
1226 return TRUE;
1227 }
1228
1229 case PSN_KILLACTIVE:
1230 {
1231 /* Restore the original "Next" button text */
1232 SetDlgItemTextW(GetParent(hwndDlg), ID_WIZNEXT, szOrgWizNextBtnText);
1233 break;
1234 }
1235
1236 case PSN_QUERYCANCEL:
1237 {
1238 if (DisplayMessage(GetParent(hwndDlg),
1242 {
1243 /* Go to the Abort page */
1245 }
1246
1247 /* Do not close the wizard too soon */
1249 return TRUE;
1250 }
1251
1252 case PSN_WIZBACK:
1253 {
1254 /* When the user performs a regular installation, go back to the previous page */
1255 if (!pSetupData->RepairUpdateFlag)
1256 break;
1257
1258 if (GetNumberOfListEntries(pSetupData->NtOsInstallsList) > 1)
1259 {
1260 /* Return to the Upgrade/Repair selection page, when the user is
1261 * upgrading and there are more than one installation available */
1263 }
1264 else
1265 {
1266 /* Return to the Install type selection page, when the user is
1267 * upgrading and there is at most one installation available */
1269 }
1270 return TRUE;
1271 }
1272
1273 default:
1274 break;
1275 }
1276 break;
1277 }
1278
1279 default:
1280 break;
1281 }
1282
1283 return FALSE;
1284}
#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 IDD_UPDATEREPAIRPAGE
Definition: resource.h:39
#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
#define PSN_QUERYINITIALFOCUS
Definition: prsht.h:126
struct _DISKENTRY * DiskEntry
Definition: partlist.h:66
ULONG OnDiskPartitionNumber
Definition: partlist.h:74
PNTOS_INSTALLATION CurrentInstallation
Definition: reactos.h:161
PGENERIC_LIST NtOsInstallsList
Definition: reactos.h:162
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

◆ TypeDlgProc()

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

Definition at line 427 of file reactos.c.

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

◆ UpgradeRepairDlgProc()

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

Definition at line 794 of file reactos.c.

799{
800 PSETUPDATA pSetupData;
801 HWND hList;
802 HIMAGELIST hSmall;
803
804 /* Retrieve pointer to the global setup data */
805 pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
806
807 switch (uMsg)
808 {
809 case WM_INITDIALOG:
810 {
811 /* Save pointer to the global setup data */
812 pSetupData = (PSETUPDATA)((LPPROPSHEETPAGEW)lParam)->lParam;
813 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pSetupData);
814
815 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
816
818
820 hList,
825
826 /* Create the ImageList */
829 ILC_COLOR32 | ILC_MASK, // ILC_COLOR24
830 1, 1);
831
832 /* Add event type icons to the ImageList */
835
836 /* Assign the ImageList to the List View */
838
840 break;
841 }
842
843 case WM_DESTROY:
844 {
845 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
848 ImageList_Destroy(hSmall);
849 return TRUE;
850 }
851
852 case WM_COMMAND:
853 switch (LOWORD(wParam))
854 {
855 case IDC_SKIPUPGRADE:
856 {
857 /* Skip the upgrade and do the usual new-installation workflow */
858 pSetupData->CurrentInstallation = NULL;
859 pSetupData->RepairUpdateFlag = FALSE;
861 return TRUE;
862 }
863 }
864 break;
865
866 case WM_NOTIFY:
867 {
868 LPNMHDR lpnm = (LPNMHDR)lParam;
869
870 if (lpnm->idFrom == IDC_NTOSLIST && lpnm->code == LVN_ITEMCHANGED)
871 {
873
874 /* Check whether the item has been (de)selected */
875 if (!(pnmv->uChanged & LVIF_STATE) ||
876 !((pnmv->uOldState ^ pnmv->uNewState) & LVIS_SELECTED))
877 {
878 break;
879 }
880
881 /* Enable or disable the "Next" button when the user
882 * selects or deselects an installation to upgrade */
883 if (pnmv->uNewState & LVIS_SELECTED)
885 else
887 break;
888 }
889
890 switch (lpnm->code)
891 {
892 case PSN_SETACTIVE:
893 {
894 /* Keep the "Next" button disabled. It will be enabled only
895 * when the user selects an installation to upgrade. */
897 break;
898 }
899
901 {
902 /* Reselect the currently selected item, so as to refresh the UI buttons */
903 INT Index;
904 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
906 if (Index != LB_ERR)
907 {
908 /* Deselect first the item before reselecting it, so as to
909 * invalidate its cached state and have the LVN_ITEMCHANGED
910 * notification sent. */
911 //ListView_EnsureVisible(hList, Index, FALSE);
916 }
917
918 /* Focus on the installations list */
920 return TRUE;
921 }
922
923 case PSN_QUERYCANCEL:
924 {
925 if (DisplayMessage(GetParent(hwndDlg),
929 {
930 /* Go to the Abort page */
932 }
933
934 /* Do not close the wizard too soon */
936 return TRUE;
937 }
938
939 case PSN_WIZNEXT: /* Set the selected data */
940 {
941 /*
942 * Go update only if we have available NT installations
943 * and we choose to do so.
944 */
945 if (!pSetupData->NtOsInstallsList ||
947 {
948 pSetupData->CurrentInstallation = NULL;
949 pSetupData->RepairUpdateFlag = FALSE;
950 break;
951 }
952
953 hList = GetDlgItem(hwndDlg, IDC_NTOSLIST);
956
957 /* Retrieve the current installation */
958 pSetupData->CurrentInstallation =
964
965 /* We perform an upgrade */
966 pSetupData->RepairUpdateFlag = TRUE;
967 /* Jump to the Summary page during repair/upgrade */
969 return TRUE;
970 }
971
972 default:
973 break;
974 }
975 break;
976 }
977
978 default:
979 break;
980 }
981
982 return FALSE;
983}
PVOID GetSelectedListViewItem(IN HWND hWndList)
Definition: reactos.c:698
static const INT column_widths[MAX_LIST_COLUMNS]
Definition: reactos.c:790
#define MAX_LIST_COLUMNS
Definition: reactos.c:788
static const INT column_alignment[MAX_LIST_COLUMNS]
Definition: reactos.c:791
VOID InitGenericListView(IN HWND hWndList, IN PGENERIC_LIST List, IN PADD_ENTRY_ITEM AddEntryItemProc)
Definition: reactos.c:661
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:563
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:729
static const UINT column_ids[MAX_LIST_COLUMNS]
Definition: reactos.c:789
#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
UINT uOldState
Definition: commctrl.h:3042
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
int WINAPI GetSystemMetrics(_In_ int)

Variable Documentation

◆ __pfnDliFailureHook2

PfnDliHook __pfnDliFailureHook2 = setupDelayHook

Definition at line 3427 of file reactos.c.

◆ __pfnDliNotifyHook2

PfnDliHook __pfnDliNotifyHook2 = setupDelayHook

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

Definition at line 3426 of file reactos.c.

◆ column_alignment

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

Definition at line 791 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_ids

Definition at line 789 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ column_widths

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

Definition at line 790 of file reactos.c.

Referenced by UpgradeRepairDlgProc().

◆ dwFlags

Definition at line 3550 of file reactos.c.

◆ hWaitCursor

HCURSOR hWaitCursor

Definition at line 39 of file reactos.c.

Referenced by ProcessDlgProc(), and PrshtWndProc().

◆ IncludeForUnattended

BOOL IncludeForUnattended

Definition at line 3549 of file reactos.c.

◆ InstallPartition

◆ IsUnattendedSetup

BOOLEAN IsUnattendedSetup
static

Definition at line 25 of file reactos.c.

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

◆ pfnDlgProc

DLGPROC pfnDlgProc

Definition at line 3554 of file reactos.c.

Referenced by SH_CreatePropertySheetPage(), and SH_CreatePropertySheetPageEx().

◆ ProcessHeap

HANDLE ProcessHeap
  • Internal Headers *‍/

Definition at line 23 of file reactos.c.

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

◆ pszHeaderSubTitle

PCWSTR pszHeaderSubTitle

Definition at line 3553 of file reactos.c.

Referenced by free_prop_sheet_pages(), and prop_sheet_pages_AtoW().

◆ pszHeaderTitle

PCWSTR pszHeaderTitle

Definition at line 3552 of file reactos.c.

Referenced by free_prop_sheet_pages(), and prop_sheet_pages_AtoW().

◆ pszTemplate

PCWSTR pszTemplate

Definition at line 3551 of file reactos.c.

Referenced by free_prop_sheet_pages(), and prop_sheet_pages_AtoW().

◆ SetupData

◆ SystemPartition

◆ UiContext

◆ 

const struct { ... } WizardPages[]

Referenced by _tWinMain().

◆ wpOrgPrshtProc

WNDPROC wpOrgPrshtProc = NULL

Definition at line 3446 of file reactos.c.

Referenced by PropSheetCallback(), and PrshtWndProc().