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