ReactOS 0.4.16-dev-752-g47bae01
setuplib.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Setup Library
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Public header
5 * COPYRIGHT: Copyright 2017-2018 Hermes Belusca-Maito
6 */
7
8#pragma once
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#ifndef _SETUPLIB_
15#define SPLIBAPI DECLSPEC_IMPORT
16#else
17#define SPLIBAPI
18#endif
19
20/* INCLUDES *****************************************************************/
21
22/* Needed PSDK headers when using this library */
23#if 0
24
25#define WIN32_NO_STATUS
26#define _INC_WINDOWS
27#define COM_NO_WINDOWS_H
28
29#include <winxxx.h>
30
31#endif
32
34
35/* NOTE: Please keep the header inclusion order! */
36
37#include "errorcode.h"
38#include "spapisup/fileqsup.h"
39#include "spapisup/infsupp.h"
40#include "utils/linklist.h"
41#include "utils/ntverrsrc.h"
42// #include "utils/arcname.h"
43#include "utils/bldrsup.h"
44#include "utils/filesup.h"
45#include "utils/fsrec.h"
46#include "utils/genlist.h"
47#include "utils/inicache.h"
48#include "utils/partinfo.h"
49#include "utils/partlist.h"
50#include "utils/arcname.h"
51#include "utils/osdetect.h"
52#include "utils/regutil.h"
53
55{
56 ARCH_PcAT, //< Standard BIOS-based PC-AT
57 ARCH_NEC98x86, //< NEC PC-98
58 ARCH_Xbox, //< Original Xbox
59 ARCH_Arc, //< ARC-based (MIPS, SGI)
60 ARCH_Efi, //< EFI and UEFI
61// Place other architectures supported by the Setup below.
63
64#include "bootcode.h"
65#include "fsutil.h"
66#include "bootsup.h"
67#include "registry.h"
68#include "mui.h"
69#include "settings.h"
70
71// #include "install.h" // See at the end...
72
73
74/* DEFINES ******************************************************************/
75
76#define KB ((ULONGLONG)1024)
77#define MB (KB*KB)
78#define GB (KB*KB*KB)
79// #define TB (KB*KB*KB*KB)
80// #define PB (KB*KB*KB*KB*KB)
81
82
83/* TYPEDEFS *****************************************************************/
84
85struct _USETUP_DATA;
86
87typedef VOID
89
90typedef struct _USETUP_DATA
91{
92/* Error handling *****/
95
96/* Setup INFs *****/
98
99/* Installation *****/
101
102/* SOURCE Paths *****/
106
107/* DESTINATION Paths *****/
108 /*
109 * Path to the system partition, where the boot manager resides.
110 * On x86 PCs, this is usually the active partition.
111 * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
112 *
113 * For more information, see:
114 * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
115 * https://web.archive.org/web/20160604095323/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
116 * https://web.archive.org/web/20160604095238/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
117 * https://web.archive.org/web/20160508052211/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
118 * https://web.archive.org/web/20160604093304/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
119 * https://web.archive.org/web/20160604095540/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
120 */
122
123 /* Path to the installation directory inside the ReactOS boot partition */
127
128 // FIXME: This is only temporary!! Must be removed later!
130
133
138
139/* Settings lists *****/
145
146/* Settings *****/
147 ARCHITECTURE_TYPE ArchType; //< Target architecture (MachineType)
150 // PCWSTR KeyboardDriver;
151 // PCWSTR MouseDriver;
152 PCWSTR LayoutId; // DefaultKBLayout
153
154/* Other stuff *****/
157
161
162
163#include "install.h"
164
165
166/* FUNCTIONS ****************************************************************/
167
168#include "substset.h"
169
170VOID
171NTAPI
173 IN OUT PUSETUP_DATA pSetupData);
174
175VOID
176NTAPI
178 IN OUT PUSETUP_DATA pSetupData);
179
182 _Out_ PUNICODE_STRING SourcePath,
183 _Out_ PUNICODE_STRING SourceRootPath,
184 _Out_ PUNICODE_STRING SourceRootDir);
185
188 IN OUT PUSETUP_DATA pSetupData);
189
190#define ERROR_SYSTEM_PARTITION_NOT_FOUND (ERROR_LAST_ERROR_CODE + 1)
191
193NTAPI
195 _In_ PPARTLIST PartitionList, /* HACK HACK! */
196 _In_ PPARTENTRY InstallPartition, /* HACK HACK! */
197 _Out_ PPARTENTRY* pSystemPartition, /* HACK HACK! */
200
208#define IS_VALID_INSTALL_PATH_CHAR(c) \
209 (isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_')
210
212NTAPI
214 _In_ PCWSTR InstallDir);
215
217NTAPI
219 _Inout_ PUSETUP_DATA pSetupData,
220 _In_ PCWSTR InstallationDir,
222
223// NTSTATUS
225NTAPI
227 _Inout_ PUSETUP_DATA pSetupData,
228 _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine,
229 _In_ PSPFILE_EXPORTS pSpFileExports,
230 _In_ PSPINF_EXPORTS pSpInfExports);
231
232VOID
233NTAPI
235 IN OUT PUSETUP_DATA pSetupData);
236
237
239{
249
250typedef VOID
252
254NTAPI
256 IN OUT PUSETUP_DATA pSetupData,
257 IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */
258 IN PPARTLIST PartitionList, /* HACK HACK! */
259 IN WCHAR DestinationDriveLetter, /* HACK HACK! */
260 IN PCWSTR SelectedLanguageId, /* HACK HACK! */
262 IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL);
263
264#ifdef __cplusplus
265}
266#endif
267
268/* EOF */
unsigned char BOOLEAN
#define __cdecl
Definition: accygwin.h:79
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
static FSVOL_OP CALLBACK FsVolCallback(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: reactos.c:1291
PPARTENTRY InstallPartition
Definition: reactos.c:44
#define MAX_PATH
Definition: compat.h:34
enum _ERROR_NUMBER ERROR_NUMBER
USHORT LANGID
Definition: mui.h:9
UNICODE_STRING Volume
Definition: fltkernel.h:1172
static const char const char const char PIMAGEHLP_STATUS_ROUTINE StatusRoutine
Definition: image.c:35
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
long LONG
Definition: pedump.c:60
FSVOL_OP(CALLBACK * PFSVOL_CALLBACK)(_In_opt_ PVOID Context, _In_ FSVOLNOTIFY FormatStatus, _In_ ULONG_PTR Param1, _In_ ULONG_PTR Param2)
Definition: fsutil.h:203
_ARCHITECTURE_TYPE
Definition: setuplib.h:55
@ ARCH_Arc
Definition: setuplib.h:59
@ ARCH_NEC98x86
Definition: setuplib.h:57
@ ARCH_PcAT
Definition: setuplib.h:56
@ ARCH_Xbox
Definition: setuplib.h:58
@ ARCH_Efi
Definition: setuplib.h:60
ERROR_NUMBER LoadSetupInf(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:562
VOID NTAPI InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:207
#define SPLIBAPI
Definition: setuplib.h:15
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:1019
NTSTATUS NTAPI InitDestinationPaths(_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
Definition: setuplib.c:863
VOID NTAPI CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:32
_REGISTRY_STATUS
Definition: setuplib.h:239
@ KeybLayouts
Definition: setuplib.h:245
@ DisplaySettingsUpdate
Definition: setuplib.h:243
@ CodePageInfoUpdate
Definition: setuplib.h:247
@ LocaleSettingsUpdate
Definition: setuplib.h:244
@ RegHiveUpdate
Definition: setuplib.h:241
@ ImportRegHive
Definition: setuplib.h:242
@ KeybSettingsUpdate
Definition: setuplib.h:246
@ Success
Definition: setuplib.h:240
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:678
enum _ARCHITECTURE_TYPE ARCHITECTURE_TYPE
VOID(__cdecl * PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS,...)
Definition: setuplib.h:251
enum _REGISTRY_STATUS REGISTRY_STATUS
VOID NTAPI FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1103
struct _USETUP_DATA * PUSETUP_DATA
NTSTATUS GetSourcePaths(_Out_ PUNICODE_STRING SourcePath, _Out_ PUNICODE_STRING SourceRootPath, _Out_ PUNICODE_STRING SourceRootDir)
Determine the installation source path and isolate its useful path components (root path and source s...
Definition: setuplib.c:407
BOOLEAN NTAPI IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:778
SPLIBAPI BOOLEAN IsUnattendedSetup
Definition: setuplib.c:26
struct _USETUP_DATA USETUP_DATA
VOID(__cdecl * PSETUP_ERROR_ROUTINE)(IN struct _USETUP_DATA *,...)
Definition: setuplib.h:88
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:1154
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PGENERIC_LIST DisplayList
Definition: setuplib.h:141
LONG DestinationPartitionNumber
Definition: setuplib.h:132
UNICODE_STRING DestinationRootPath
Definition: setuplib.h:126
PGENERIC_LIST LanguageList
Definition: setuplib.h:144
UNICODE_STRING SourcePath
Definition: setuplib.h:105
PGENERIC_LIST LayoutList
Definition: setuplib.h:143
PVOID SetupFileQueue
Definition: setuplib.h:100
PGENERIC_LIST ComputerList
Definition: setuplib.h:140
UNICODE_STRING SourceRootDir
Definition: setuplib.h:104
PSETUP_ERROR_ROUTINE ErrorRoutine
Definition: setuplib.h:94
HINF SetupInf
Definition: setuplib.h:97
UNICODE_STRING SystemRootPath
Definition: setuplib.h:121
LONG FsType
Definition: setuplib.h:137
LONG AutoPartition
Definition: setuplib.h:136
UNICODE_STRING SourceRootPath
Definition: setuplib.h:103
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:159
UNICODE_STRING InstallPath
Definition: setuplib.h:129
LONG BootLoaderLocation
Definition: setuplib.h:134
UNICODE_STRING DestinationPath
Definition: setuplib.h:125
ARCHITECTURE_TYPE ArchType
Definition: setuplib.h:147
PCWSTR DisplayType
Definition: setuplib.h:149
PGENERIC_LIST KeyboardList
Definition: setuplib.h:142
LANGID LanguageId
Definition: setuplib.h:156
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:124
PCWSTR ComputerType
Definition: setuplib.h:148
WCHAR LocaleID[9]
Definition: setuplib.h:155
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:158
ERROR_NUMBER LastErrorNumber
Definition: setuplib.h:93
PCWSTR LayoutId
Definition: setuplib.h:152
LONG DestinationDiskNumber
Definition: setuplib.h:131
LONG FormatPartition
Definition: setuplib.h:135
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
static PPARTLIST PartitionList
Definition: usetup.c:74
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:71
PCWSTR SelectedLanguageId
Definition: usetup.c:67
__wchar_t WCHAR
Definition: xmlstorage.h:180