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