[SETUPLIB] Improve the bootloader 'validity' checks -- Addendum to f06734e5 (r74512).
[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 "utils/linklist.h"
29 #include "utils/ntverrsrc.h"
30 // #include "utils/arcname.h"
31 #include "utils/bldrsup.h"
32 #include "bootsup.h"
33 #include "utils/filesup.h"
34 #include "fsutil.h"
35 #include "utils/genlist.h"
36 #include "utils/infsupp.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 "registry.h"
43 #include "mui.h"
44 #include "settings.h"
45
46
47 /* DEFINES ******************************************************************/
48
49 #define KB ((ULONGLONG)1024)
50 #define MB (KB*KB)
51 #define GB (KB*KB*KB)
52 // #define TB (KB*KB*KB*KB)
53 // #define PB (KB*KB*KB*KB*KB)
54
55
56 /* TYPEDEFS *****************************************************************/
57
58 typedef struct _USETUP_DATA
59 {
60 /* SOURCE Paths *****/
61 UNICODE_STRING SourceRootPath;
62 UNICODE_STRING SourceRootDir;
63 UNICODE_STRING SourcePath;
64
65 /* DESTINATION Paths *****/
66 /*
67 * Path to the system partition, where the boot manager resides.
68 * On x86 PCs, this is usually the active partition.
69 * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
70 *
71 * For more information, see:
72 * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
73 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
74 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
75 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
76 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
77 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
78 */
79 UNICODE_STRING SystemRootPath;
80
81 /* Path to the installation directory inside the ReactOS boot partition */
82 UNICODE_STRING DestinationPath; /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/
83 UNICODE_STRING DestinationArcPath; /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
84 UNICODE_STRING DestinationRootPath;
85
86 LONG DestinationDiskNumber;
87 LONG DestinationPartitionNumber;
88 LONG MBRInstallType;
89
90 LONG FormatPartition;
91 LONG AutoPartition;
92
93 WCHAR LocaleID[9];
94 LANGID LanguageId;
95
96 ULONG RequiredPartitionDiskSpace;
97 WCHAR InstallationDirectory[MAX_PATH];
98 } USETUP_DATA, *PUSETUP_DATA;
99
100 // HACK!!
101 extern BOOLEAN IsUnattendedSetup;
102
103
104 /* FUNCTIONS ****************************************************************/
105
106 VOID
107 CheckUnattendedSetup(
108 IN OUT PUSETUP_DATA pSetupData);
109
110 VOID
111 InstallSetupInfFile(
112 IN OUT PUSETUP_DATA pSetupData);
113
114 NTSTATUS
115 GetSourcePaths(
116 OUT PUNICODE_STRING SourcePath,
117 OUT PUNICODE_STRING SourceRootPath,
118 OUT PUNICODE_STRING SourceRootDir);
119
120 ERROR_NUMBER
121 LoadSetupInf(
122 OUT HINF* SetupInf,
123 IN OUT PUSETUP_DATA pSetupData);
124
125
126 /* EOF */