xref: /reactos/base/setup/lib/setuplib.h (revision 177ae91b)
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 // #include "install.h" // See at the end...
48 
49 
50 /* DEFINES ******************************************************************/
51 
52 #define KB ((ULONGLONG)1024)
53 #define MB (KB*KB)
54 #define GB (KB*KB*KB)
55 // #define TB (KB*KB*KB*KB)
56 // #define PB (KB*KB*KB*KB*KB)
57 
58 
59 /* TYPEDEFS *****************************************************************/
60 
61 struct _USETUP_DATA;
62 
63 typedef VOID
64 (__cdecl *PSETUP_ERROR_ROUTINE)(IN struct _USETUP_DATA*, ...);
65 
66 typedef struct _USETUP_DATA
67 {
68 /* Error handling *****/
69     ERROR_NUMBER LastErrorNumber;
70     PSETUP_ERROR_ROUTINE ErrorRoutine;
71 
72 /* Setup INFs *****/
73     HINF SetupInf;
74 
75 /* Installation *****/
76     PVOID SetupFileQueue; // HSPFILEQ
77 
78 /* SOURCE Paths *****/
79     UNICODE_STRING SourceRootPath;
80     UNICODE_STRING SourceRootDir;
81     UNICODE_STRING SourcePath;
82 
83 /* DESTINATION Paths *****/
84     /*
85      * Path to the system partition, where the boot manager resides.
86      * On x86 PCs, this is usually the active partition.
87      * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
88      *
89      * For more information, see:
90      * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
91      * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
92      * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
93      * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
94      * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
95      * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
96      */
97     UNICODE_STRING SystemRootPath;
98 
99     /* Path to the installation directory inside the ReactOS boot partition */
100     UNICODE_STRING DestinationArcPath;  /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
101     UNICODE_STRING DestinationPath;     /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/
102     UNICODE_STRING DestinationRootPath;
103 
104     // FIXME: This is only temporary!! Must be removed later!
105     UNICODE_STRING InstallPath;
106 
107     LONG DestinationDiskNumber;
108     LONG DestinationPartitionNumber;
109 
110     LONG MBRInstallType;
111     LONG FormatPartition;
112     LONG AutoPartition;
113     LONG FsType;
114 
115 /* Settings lists *****/
116     PGENERIC_LIST ComputerList;
117     PGENERIC_LIST DisplayList;
118     PGENERIC_LIST KeyboardList;
119     PGENERIC_LIST LayoutList;
120     PGENERIC_LIST LanguageList;
121 
122 /* Other stuff *****/
123     WCHAR LocaleID[9];
124     LANGID LanguageId;
125 
126     ULONG RequiredPartitionDiskSpace;
127     WCHAR InstallationDirectory[MAX_PATH];
128 } USETUP_DATA, *PUSETUP_DATA;
129 
130 
131 #include "install.h"
132 
133 
134 // HACK!!
135 extern BOOLEAN IsUnattendedSetup;
136 
137 
138 /* FUNCTIONS ****************************************************************/
139 
140 #include "substset.h"
141 
142 VOID
143 CheckUnattendedSetup(
144     IN OUT PUSETUP_DATA pSetupData);
145 
146 VOID
147 InstallSetupInfFile(
148     IN OUT PUSETUP_DATA pSetupData);
149 
150 NTSTATUS
151 GetSourcePaths(
152     OUT PUNICODE_STRING SourcePath,
153     OUT PUNICODE_STRING SourceRootPath,
154     OUT PUNICODE_STRING SourceRootDir);
155 
156 ERROR_NUMBER
157 LoadSetupInf(
158     IN OUT PUSETUP_DATA pSetupData);
159 
160 NTSTATUS
161 InitDestinationPaths(
162     IN OUT PUSETUP_DATA pSetupData,
163     IN PCWSTR InstallationDir,
164     IN PPARTENTRY PartEntry);   // FIXME: HACK!
165 
166 // NTSTATUS
167 ERROR_NUMBER
168 InitializeSetup(
169     IN OUT PUSETUP_DATA pSetupData,
170     IN ULONG InitPhase);
171 
172 VOID
173 FinishSetup(
174     IN OUT PUSETUP_DATA pSetupData);
175 
176 
177 typedef enum _REGISTRY_STATUS
178 {
179     Success = 0,
180     RegHiveUpdate,
181     ImportRegHive,
182     DisplaySettingsUpdate,
183     LocaleSettingsUpdate,
184     KeybLayouts,
185     KeybSettingsUpdate,
186     CodePageInfoUpdate,
187 } REGISTRY_STATUS;
188 
189 typedef VOID
190 (__cdecl *PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS, ...);
191 
192 ERROR_NUMBER
193 UpdateRegistry(
194     IN OUT PUSETUP_DATA pSetupData,
195     /**/IN BOOLEAN RepairUpdateFlag,     /* HACK HACK! */
196     /**/IN PPARTLIST PartitionList,      /* HACK HACK! */
197     /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */
198     /**/IN PCWSTR SelectedLanguageId,    /* HACK HACK! */
199     IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL,
200     IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL);
201 
202 /* EOF */
203