Files
reactos/base/setup/reactos/reactos.h
Hermès Bélusca-Maïto 51c32094af [SETUP:REACTOS] GUI setup: Revamp the Finish/Reboot page; re-enable auto-reboot
Add also an Abort page that is displayed when the user cancels the
1st-stage setup, or when an error occurs and installation is aborted.

- Rewrite the text, change the layout;

- When the installer is started without any Win32 shell, or the
  installation is running in unattended mode, the Finish/Abort
  pages only offer to restart the computer with a 15-second timeout
  countdown.
  If the user has opened programs with interactive windows in the
  meantime, the timeout countdown just pauses whenever the installer
  window is de-activated/unfocused; it restarts when the window is
  re-activated. (This currently doesn't work in ReactOS due to a bug
  in the `WM_ACTIVATE` message delivery.)

  If, on the contrary, the installer is started by the user when a
  Win32 shell is running, the Finish/Abort page offers to either restart
  the computer "now", or postpone the restart to later (when the user
  manually restarts the computer); no reboot countdown is present there.

- Disable/hide the "Back" button for the Install processing page.
2026-05-12 00:27:57 +02:00

286 lines
6.7 KiB
C

/*
* PROJECT: ReactOS GUI first stage setup application
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Precompiled header
* COPYRIGHT: Copyright 2008-2010 Matthias Kupfer <mkupfer@reactos.org>
* Copyright 2008-2009 Dmitry Chapyshev <dmitry@reactos.org>
* Copyright 2018-2024 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
*/
#ifndef _REACTOS_PCH_
#define _REACTOS_PCH_
/* C Headers */
#include <stdlib.h>
#include <stdarg.h>
#include <tchar.h>
/* PSDK/NDK */
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <strsafe.h>
#include <commctrl.h>
#include <windowsx.h>
#define EnableDlgItem(hDlg, nID, bEnable) \
EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
#define ShowDlgItem(hDlg, nID, nCmdShow) \
ShowWindow(GetDlgItem((hDlg), (nID)), (nCmdShow))
#define SetDlgItemFont(hDlg, nID, hFont, bRedraw) \
SetWindowFont(GetDlgItem((hDlg), (nID)), (hFont), (bRedraw))
// Property Sheet string IDs
#define IDS_CLOSE 4160 // 0x1040
/* These are public names and values determined from MFC, and compatible with Windows */
// Property Sheet control IDs (determined with Spy++)
#define IDC_TAB_CONTROL 0x3020
#define ID_APPLY_NOW 0x3021
#define ID_WIZBACK 0x3023
#define ID_WIZNEXT 0x3024
#define ID_WIZFINISH 0x3025
#include "treelist.h"
/**/#include <setupapi.h>/**/
#include <devguid.h>
#define NTOS_MODE_USER
#include <ndk/cmtypes.h> // For CM_DISK stuff
#include <ndk/iofuncs.h> // For NtCreate/OpenFile
#include <ndk/rtlfuncs.h>
/* Setup library headers */
// #include <reactos/rosioctl.h>
#include <../lib/setuplib.h>
/* UI elements */
typedef struct _UI_CONTEXT
{
HWND hPartList; // Disks & partitions list
HWND hwndDlg; // Install progress page
HWND hWndItem; // Progress action
HWND hWndProgress; // Progress gauge
LONG_PTR dwPbStyle; // Progress gauge style
} UI_CONTEXT, *PUI_CONTEXT;
extern UI_CONTEXT UiContext;
/*
* A mapping entry that maps an NT path to a corresponding Win32 path.
*
* Example is:
* NT path: "\Device\Harddisk0\Partition1\some\path1"
* Win32 path: "C:\some\path1"
*
* Here, the NT path prefix to be cached is only
* "\Device\Harddisk0\Partition1\", to be mapped with "C:\".
*
* Then the same entry would be reused if one wants to convert
* the NT path "\Device\Harddisk0\Partition1\another\path2",
* which converts to the Win32 path "C:\another\path2" .
*/
typedef struct _NT_WIN32_PATH_MAPPING
{
LIST_ENTRY ListEntry;
WCHAR NtPath[MAX_PATH]; // MAX_PATH for both entries should be more than enough.
WCHAR Win32Path[MAX_PATH];
} NT_WIN32_PATH_MAPPING, *PNT_WIN32_PATH_MAPPING;
/* The list of NT to Win32 path prefix mappings */
typedef struct _NT_WIN32_PATH_MAPPING_LIST
{
LIST_ENTRY List;
ULONG MappingsCount;
} NT_WIN32_PATH_MAPPING_LIST, *PNT_WIN32_PATH_MAPPING_LIST;
#if 0
typedef struct _KBLAYOUT
{
TCHAR LayoutId[9];
TCHAR LayoutName[128];
TCHAR DllName[128];
} KBLAYOUT, *PKBLAYOUT;
#endif
typedef struct _SETUPDATA
{
/* General */
HINSTANCE hInstance;
BOOL bUnattend;
BOOL bMustReboot;
HFONT hTitleFont;
HFONT hBoldFont;
HANDLE hInstallThread;
HANDLE hHaltInstallEvent;
BOOL bStopInstall;
NT_WIN32_PATH_MAPPING_LIST MappingList;
USETUP_DATA USetupData;
BOOLEAN RepairUpdateFlag; // flag for update/repair an installed reactos
PPARTLIST PartitionList;
PNTOS_INSTALLATION CurrentInstallation;
PGENERIC_LIST NtOsInstallsList;
/* Settings */
LONG DestPartSize; // if partition doesn't exist, size of partition
/* txtsetup.sif data */
// LONG DefaultLang; // default language (table index)
// LONG DefaultKBLayout; // default keyboard layout (table index)
PCWSTR SelectedLanguageId;
WCHAR DefaultLanguage[20]; // Copy of string inside LanguageList
WCHAR DefaultKBLayout[20]; // Copy of string inside KeyboardList
} SETUPDATA, *PSETUPDATA;
extern HANDLE ProcessHeap;
extern SETUPDATA SetupData;
extern PPARTENTRY InstallPartition;
extern PPARTENTRY SystemPartition;
/**
* @brief Data structure stored when a partition/volume needs to be formatted.
**/
typedef struct _VOL_CREATE_INFO
{
PVOLENTRY Volume;
/* Volume-related parameters:
* Cached input information that will be set to
* the FORMAT_VOLUME_INFO structure given to the
* 'FSVOLNOTIFY_STARTFORMAT' step */
// PCWSTR FileSystemName;
WCHAR FileSystemName[MAX_PATH+1];
FMIFS_MEDIA_FLAG MediaFlag;
PCWSTR Label;
BOOLEAN QuickFormat;
ULONG ClusterSize;
} VOL_CREATE_INFO, *PVOL_CREATE_INFO;
/* See drivepage.c */
PVOL_CREATE_INFO
FindVolCreateInTreeByVolume(
_In_ HWND hTreeList,
_In_ PVOLENTRY Volume);
/*
* Attempts to convert a pure NT file path into a corresponding Win32 path.
* Adapted from GetInstallSourceWin32() in dll/win32/syssetup/wizard.c
*/
BOOL
ConvertNtPathToWin32Path(
IN OUT PNT_WIN32_PATH_MAPPING_LIST MappingList,
OUT PWSTR pwszPath,
IN DWORD cchPathMax,
IN PCWSTR pwszNTPath);
/* drivepage.c */
INT_PTR
CALLBACK
DriveDlgProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam);
/* reactos.c */
BOOL
CreateListViewColumns(
IN HINSTANCE hInstance,
IN HWND hWndListView,
IN const UINT* pIDs,
IN const INT* pColsWidth,
IN const INT* pColsAlign,
IN UINT nNumOfColumns);
size_t
LoadAllocStringW(
_In_opt_ HINSTANCE hInstance,
_In_ UINT uID,
_In_opt_ _Outptr_ PWSTR* pString,
_In_opt_ size_t cchBufferLen /*,
_In_opt_ PCWSTR pDefaultString*/);
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 /*,
_In_opt_ PCWSTR pDefaultString*/);
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,
...);
#endif /* _REACTOS_PCH_ */
/* EOF */