585808f6fae120e6929d8623fcbdecdde195b250
[reactos.git] / base / setup / lib / setuplib.h
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 /* INCLUDES *****************************************************************/
11
12 /* Needed PSDK headers when using this library */
13 #if 0
14
15 #define WIN32_NO_STATUS
16 #define _INC_WINDOWS
17 #define COM_NO_WINDOWS_H
18
19 #include <winxxx.h>
20
21 #endif
22
23 /* NOTE: Please keep the header inclusion order! */
24
25 extern HANDLE ProcessHeap;
26
27 #include "errorcode.h"
28 #include "spapisup/fileqsup.h"
29 #include "spapisup/infsupp.h"
30 #include "utils/linklist.h"
31 #include "utils/ntverrsrc.h"
32 // #include "utils/arcname.h"
33 #include "utils/bldrsup.h"
34 #include "bootsup.h"
35 #include "utils/filesup.h"
36 #include "fsutil.h"
37 #include "utils/genlist.h"
38 #include "utils/inicache.h"
39 #include "utils/partlist.h"
40 #include "utils/arcname.h"
41 #include "utils/osdetect.h"
42 #include "utils/regutil.h"
43 #include "registry.h"
44 #include "mui.h"
45 #include "settings.h"
46
47
48 /* DEFINES ******************************************************************/
49
50 #define KB ((ULONGLONG)1024)
51 #define MB (KB*KB)
52 #define GB (KB*KB*KB)
53 // #define TB (KB*KB*KB*KB)
54 // #define PB (KB*KB*KB*KB*KB)
55
56
57 /* TYPEDEFS *****************************************************************/
58
59 struct _USETUP_DATA;
60
61 typedef struct _USETUP_DATA
62 {
63 /* Setup INFs *****/
64 HINF SetupInf;
65
66 /* Installation *****/
67 PVOID SetupFileQueue; // HSPFILEQ
68
69 /* SOURCE Paths *****/
70 UNICODE_STRING SourceRootPath;
71 UNICODE_STRING SourceRootDir;
72 UNICODE_STRING SourcePath;
73
74 /* DESTINATION Paths *****/
75 /*
76 * Path to the system partition, where the boot manager resides.
77 * On x86 PCs, this is usually the active partition.
78 * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
79 *
80 * For more information, see:
81 * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
82 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
83 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
84 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
85 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
86 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
87 */
88 UNICODE_STRING SystemRootPath;
89
90 /* Path to the installation directory inside the ReactOS boot partition */
91 UNICODE_STRING DestinationArcPath; /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
92 UNICODE_STRING DestinationPath; /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/
93 UNICODE_STRING DestinationRootPath;
94
95 // FIXME: This is only temporary!! Must be removed later!
96 UNICODE_STRING InstallPath;
97
98 LONG DestinationDiskNumber;
99 LONG DestinationPartitionNumber;
100
101 LONG MBRInstallType;
102 LONG FormatPartition;
103 LONG AutoPartition;
104
105 /* Settings lists *****/
106 PGENERIC_LIST ComputerList;
107 PGENERIC_LIST DisplayList;
108 PGENERIC_LIST KeyboardList;
109 PGENERIC_LIST LayoutList;
110 PGENERIC_LIST LanguageList;
111
112 /* Other stuff *****/
113 WCHAR LocaleID[9];
114 LANGID LanguageId;
115
116 ULONG RequiredPartitionDiskSpace;
117 WCHAR InstallationDirectory[MAX_PATH];
118 } USETUP_DATA, *PUSETUP_DATA;
119
120 // HACK!!
121 extern BOOLEAN IsUnattendedSetup;
122
123
124 /* FUNCTIONS ****************************************************************/
125
126 VOID
127 CheckUnattendedSetup(
128 IN OUT PUSETUP_DATA pSetupData);
129
130 VOID
131 InstallSetupInfFile(
132 IN OUT PUSETUP_DATA pSetupData);
133
134 NTSTATUS
135 GetSourcePaths(
136 OUT PUNICODE_STRING SourcePath,
137 OUT PUNICODE_STRING SourceRootPath,
138 OUT PUNICODE_STRING SourceRootDir);
139
140 ERROR_NUMBER
141 LoadSetupInf(
142 IN OUT PUSETUP_DATA pSetupData);
143
144 NTSTATUS
145 InitDestinationPaths(
146 IN OUT PUSETUP_DATA pSetupData,
147 IN PCWSTR InstallationDir,
148 IN PDISKENTRY DiskEntry, // FIXME: HACK!
149 IN PPARTENTRY PartEntry); // FIXME: HACK!
150
151 // NTSTATUS
152 ERROR_NUMBER
153 InitializeSetup(
154 IN OUT PUSETUP_DATA pSetupData,
155 IN ULONG InitPhase);
156
157 VOID
158 FinishSetup(
159 IN OUT PUSETUP_DATA pSetupData);
160
161
162 typedef enum _REGISTRY_STATUS
163 {
164 Success = 0,
165 RegHiveUpdate,
166 ImportRegHive,
167 DisplaySettingsUpdate,
168 LocaleSettingsUpdate,
169 KeybLayouts,
170 KeybSettingsUpdate,
171 CodePageInfoUpdate,
172 } REGISTRY_STATUS;
173
174 typedef VOID
175 (__cdecl *PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS, ...);
176
177 ERROR_NUMBER
178 UpdateRegistry(
179 IN OUT PUSETUP_DATA pSetupData,
180 /**/IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */
181 /**/IN PPARTLIST PartitionList, /* HACK HACK! */
182 /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */
183 /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */
184 IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL);
185
186 /* EOF */