ReactOS 0.4.16-dev-981-g80eb313
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
33/* NOTE: Please keep the header inclusion order! */
34
35#include "errorcode.h"
36#include "spapisup/fileqsup.h"
37#include "spapisup/infsupp.h"
38#include "utils/linklist.h"
39#include "utils/ntverrsrc.h"
40// #include "utils/arcname.h"
41#include "utils/bldrsup.h"
42#include "utils/filesup.h"
43#include "utils/fsrec.h"
44#include "utils/genlist.h"
45#include "utils/inicache.h"
46#include "utils/partinfo.h"
47#include "utils/partlist.h"
48#include "utils/arcname.h"
49#include "utils/osdetect.h"
50#include "utils/regutil.h"
51
53{
54 ARCH_PcAT, //< Standard BIOS-based PC-AT
55 ARCH_NEC98x86, //< NEC PC-98
56 ARCH_Xbox, //< Original Xbox
57 ARCH_Arc, //< ARC-based (MIPS, SGI)
58 ARCH_Efi, //< EFI and UEFI
59// Place other architectures supported by the Setup below.
61
62#include "bootcode.h"
63#include "fsutil.h"
64#include "bootsup.h"
65#include "registry.h"
66#include "mui.h"
67#include "settings.h"
68
69// #include "install.h" // See at the end...
70
71
72/* DEFINES ******************************************************************/
73
74#define KB ((ULONGLONG)1024)
75#define MB (KB*KB)
76#define GB (KB*KB*KB)
77// #define TB (KB*KB*KB*KB)
78// #define PB (KB*KB*KB*KB*KB)
79
80
81/* TYPEDEFS *****************************************************************/
82
83struct _USETUP_DATA;
84
85typedef VOID
87
88typedef struct _USETUP_DATA
89{
90/* Error handling *****/
93
94/* Setup INFs *****/
96
97/* Installation *****/
98 PVOID SetupFileQueue; // HSPFILEQ
99
100/* SOURCE Paths *****/
104
105/* DESTINATION Paths *****/
106 /*
107 * Path to the system partition, where the boot manager resides.
108 * On x86 PCs, this is usually the active partition.
109 * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
110 *
111 * For more information, see:
112 * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
113 * https://web.archive.org/web/20160604095323/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
114 * https://web.archive.org/web/20160604095238/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
115 * https://web.archive.org/web/20160508052211/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
116 * https://web.archive.org/web/20160604093304/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
117 * https://web.archive.org/web/20160604095540/http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
118 */
120
121 /* Path to the installation directory inside the ReactOS boot partition */
125
126 // FIXME: This is only temporary!! Must be removed later!
128
131
136
137/* Settings lists *****/
143
144/* Settings *****/
145 ARCHITECTURE_TYPE ArchType; //< Target architecture (MachineType)
148 // PCWSTR KeyboardDriver;
149 // PCWSTR MouseDriver;
150 PCWSTR LayoutId; // DefaultKBLayout
151
152/* Other stuff *****/
155
159
160
161#include "install.h"
162
163
164/* FUNCTIONS ****************************************************************/
165
166#include "substset.h"
167
169NTAPI
171 IN OUT PUSETUP_DATA pSetupData);
172
173VOID
174NTAPI
176 IN OUT PUSETUP_DATA pSetupData);
177
180 _Out_ PUNICODE_STRING SourcePath,
181 _Out_ PUNICODE_STRING SourceRootPath,
182 _Out_ PUNICODE_STRING SourceRootDir);
183
186 IN OUT PUSETUP_DATA pSetupData);
187
188#define ERROR_SYSTEM_PARTITION_NOT_FOUND (ERROR_LAST_ERROR_CODE + 1)
189
191NTAPI
193 _In_ PPARTLIST PartitionList, /* HACK HACK! */
194 _In_ PPARTENTRY InstallPartition, /* HACK HACK! */
195 _Out_ PPARTENTRY* pSystemPartition, /* HACK HACK! */
198
206#define IS_VALID_INSTALL_PATH_CHAR(c) \
207 (isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_')
208
210NTAPI
212 _In_ PCWSTR InstallDir);
213
215NTAPI
217 _Inout_ PUSETUP_DATA pSetupData,
218 _In_ PCWSTR InstallationDir,
220
221// NTSTATUS
223NTAPI
225 _Inout_ PUSETUP_DATA pSetupData,
226 _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine,
227 _In_ PSPFILE_EXPORTS pSpFileExports,
228 _In_ PSPINF_EXPORTS pSpInfExports);
229
230VOID
231NTAPI
233 IN OUT PUSETUP_DATA pSetupData);
234
235
237{
247
248typedef VOID
250
252NTAPI
254 IN OUT PUSETUP_DATA pSetupData,
255 IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */
256 IN PPARTLIST PartitionList, /* HACK HACK! */
257 IN WCHAR DestinationDriveLetter, /* HACK HACK! */
258 IN PCWSTR SelectedLanguageId, /* HACK HACK! */
260 IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL);
261
262#ifdef __cplusplus
263}
264#endif
265
266/* 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:1292
PPARTENTRY InstallPartition
Definition: reactos.c:45
#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:53
@ ARCH_Arc
Definition: setuplib.h:57
@ ARCH_NEC98x86
Definition: setuplib.h:55
@ ARCH_PcAT
Definition: setuplib.h:54
@ ARCH_Xbox
Definition: setuplib.h:56
@ ARCH_Efi
Definition: setuplib.h:58
ERROR_NUMBER LoadSetupInf(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:563
VOID NTAPI InstallSetupInfFile(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:208
ERROR_NUMBER NTAPI InitializeSetup(_Inout_ PUSETUP_DATA pSetupData, _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine, _In_ PSPFILE_EXPORTS pSpFileExports, _In_ PSPINF_EXPORTS pSpInfExports)
Definition: setuplib.c:1020
NTSTATUS NTAPI InitDestinationPaths(_Inout_ PUSETUP_DATA pSetupData, _In_ PCWSTR InstallationDir, _In_ PVOLENTRY Volume)
Definition: setuplib.c:864
_REGISTRY_STATUS
Definition: setuplib.h:237
@ KeybLayouts
Definition: setuplib.h:243
@ DisplaySettingsUpdate
Definition: setuplib.h:241
@ CodePageInfoUpdate
Definition: setuplib.h:245
@ LocaleSettingsUpdate
Definition: setuplib.h:242
@ RegHiveUpdate
Definition: setuplib.h:239
@ ImportRegHive
Definition: setuplib.h:240
@ KeybSettingsUpdate
Definition: setuplib.h:244
@ Success
Definition: setuplib.h:238
BOOLEAN NTAPI InitSystemPartition(_In_ PPARTLIST PartitionList, _In_ PPARTENTRY InstallPartition, _Out_ PPARTENTRY *pSystemPartition, _In_opt_ PFSVOL_CALLBACK FsVolCallback, _In_opt_ PVOID Context)
Find or set the active system partition.
Definition: setuplib.c:679
enum _ARCHITECTURE_TYPE ARCHITECTURE_TYPE
VOID(__cdecl * PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS,...)
Definition: setuplib.h:249
BOOLEAN NTAPI CheckUnattendedSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:32
enum _REGISTRY_STATUS REGISTRY_STATUS
VOID NTAPI FinishSetup(IN OUT PUSETUP_DATA pSetupData)
Definition: setuplib.c:1104
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:408
BOOLEAN NTAPI IsValidInstallDirectory(_In_ PCWSTR InstallDir)
Verify whether the given directory is suitable for ReactOS installation. Each path component must be ...
Definition: setuplib.c:779
struct _USETUP_DATA USETUP_DATA
VOID(__cdecl * PSETUP_ERROR_ROUTINE)(IN struct _USETUP_DATA *,...)
Definition: setuplib.h:86
ERROR_NUMBER NTAPI UpdateRegistry(IN OUT PUSETUP_DATA pSetupData, IN BOOLEAN RepairUpdateFlag, IN PPARTLIST PartitionList, IN WCHAR DestinationDriveLetter, IN PCWSTR SelectedLanguageId, IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL)
Definition: setuplib.c:1155
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PGENERIC_LIST DisplayList
Definition: setuplib.h:139
LONG DestinationPartitionNumber
Definition: setuplib.h:130
UNICODE_STRING DestinationRootPath
Definition: setuplib.h:124
PGENERIC_LIST LanguageList
Definition: setuplib.h:142
UNICODE_STRING SourcePath
Definition: setuplib.h:103
PGENERIC_LIST LayoutList
Definition: setuplib.h:141
PVOID SetupFileQueue
Definition: setuplib.h:98
PGENERIC_LIST ComputerList
Definition: setuplib.h:138
UNICODE_STRING SourceRootDir
Definition: setuplib.h:102
PSETUP_ERROR_ROUTINE ErrorRoutine
Definition: setuplib.h:92
HINF SetupInf
Definition: setuplib.h:95
UNICODE_STRING SystemRootPath
Definition: setuplib.h:119
LONG FsType
Definition: setuplib.h:135
LONG AutoPartition
Definition: setuplib.h:134
UNICODE_STRING SourceRootPath
Definition: setuplib.h:101
WCHAR InstallationDirectory[MAX_PATH]
Definition: setuplib.h:157
UNICODE_STRING InstallPath
Definition: setuplib.h:127
LONG BootLoaderLocation
Definition: setuplib.h:132
UNICODE_STRING DestinationPath
Definition: setuplib.h:123
ARCHITECTURE_TYPE ArchType
Definition: setuplib.h:145
PCWSTR DisplayType
Definition: setuplib.h:147
PGENERIC_LIST KeyboardList
Definition: setuplib.h:140
LANGID LanguageId
Definition: setuplib.h:154
UNICODE_STRING DestinationArcPath
Definition: setuplib.h:122
PCWSTR ComputerType
Definition: setuplib.h:146
WCHAR LocaleID[9]
Definition: setuplib.h:153
ULONG RequiredPartitionDiskSpace
Definition: setuplib.h:156
ERROR_NUMBER LastErrorNumber
Definition: setuplib.h:91
PCWSTR LayoutId
Definition: setuplib.h:150
LONG DestinationDiskNumber
Definition: setuplib.h:129
LONG FormatPartition
Definition: setuplib.h:133
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:75
static BOOLEAN RepairUpdateFlag
Definition: usetup.c:72
PCWSTR SelectedLanguageId
Definition: usetup.c:68
__wchar_t WCHAR
Definition: xmlstorage.h:180