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 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #ifndef _SETUPLIB_ 15 #define SPLIBAPI DECLSPEC_IMPORT 16 #else 17 #define SPLIBAPI 18 #endif 19 20 /* INCLUDES *****************************************************************/ 21 22 /* Needed PSDK headers when using this library */ 23 #if 0 24 25 #define WIN32_NO_STATUS 26 #define _INC_WINDOWS 27 #define COM_NO_WINDOWS_H 28 29 #include <winxxx.h> 30 31 #endif 32 33 extern SPLIBAPI BOOLEAN IsUnattendedSetup; // HACK 34 35 /* NOTE: Please keep the header inclusion order! */ 36 37 #include "errorcode.h" 38 #include "spapisup/fileqsup.h" 39 #include "spapisup/infsupp.h" 40 #include "utils/linklist.h" 41 #include "utils/ntverrsrc.h" 42 // #include "utils/arcname.h" 43 #include "utils/bldrsup.h" 44 #include "utils/filesup.h" 45 #include "utils/fsrec.h" 46 #include "utils/genlist.h" 47 #include "utils/inicache.h" 48 #include "utils/partinfo.h" 49 #include "utils/partlist.h" 50 #include "utils/arcname.h" 51 #include "utils/osdetect.h" 52 #include "utils/regutil.h" 53 54 typedef enum _ARCHITECTURE_TYPE 55 { 56 ARCH_PcAT, //< Standard BIOS-based PC-AT 57 ARCH_NEC98x86, //< NEC PC-98 58 ARCH_Xbox, //< Original Xbox 59 ARCH_Arc, //< ARC-based (MIPS, SGI) 60 ARCH_Efi, //< EFI and UEFI 61 // Place other architectures supported by the Setup below. 62 } ARCHITECTURE_TYPE; 63 64 #include "bootcode.h" 65 #include "fsutil.h" 66 #include "bootsup.h" 67 #include "registry.h" 68 #include "mui.h" 69 #include "settings.h" 70 71 // #include "install.h" // See at the end... 72 73 74 /* DEFINES ******************************************************************/ 75 76 #define KB ((ULONGLONG)1024) 77 #define MB (KB*KB) 78 #define GB (KB*KB*KB) 79 // #define TB (KB*KB*KB*KB) 80 // #define PB (KB*KB*KB*KB*KB) 81 82 83 /* TYPEDEFS *****************************************************************/ 84 85 struct _USETUP_DATA; 86 87 typedef VOID 88 (__cdecl *PSETUP_ERROR_ROUTINE)(IN struct _USETUP_DATA*, ...); 89 90 typedef struct _USETUP_DATA 91 { 92 /* Error handling *****/ 93 ERROR_NUMBER LastErrorNumber; 94 PSETUP_ERROR_ROUTINE ErrorRoutine; 95 96 /* Setup INFs *****/ 97 HINF SetupInf; 98 99 /* Installation *****/ 100 PVOID SetupFileQueue; // HSPFILEQ 101 102 /* SOURCE Paths *****/ 103 UNICODE_STRING SourceRootPath; 104 UNICODE_STRING SourceRootDir; 105 UNICODE_STRING SourcePath; 106 107 /* DESTINATION Paths *****/ 108 /* 109 * Path to the system partition, where the boot manager resides. 110 * On x86 PCs, this is usually the active partition. 111 * On ARC, (u)EFI, ... platforms, this is a dedicated partition. 112 * 113 * For more information, see: 114 * https://en.wikipedia.org/wiki/System_partition_and_boot_partition 115 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html 116 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html 117 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html 118 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html 119 * http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html 120 */ 121 UNICODE_STRING SystemRootPath; 122 123 /* Path to the installation directory inside the ReactOS boot partition */ 124 UNICODE_STRING DestinationArcPath; /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/ 125 UNICODE_STRING DestinationPath; /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/ 126 UNICODE_STRING DestinationRootPath; 127 128 // FIXME: This is only temporary!! Must be removed later! 129 UNICODE_STRING InstallPath; 130 131 LONG DestinationDiskNumber; 132 LONG DestinationPartitionNumber; 133 134 LONG BootLoaderLocation; 135 LONG FormatPartition; 136 LONG AutoPartition; 137 LONG FsType; 138 139 /* Settings lists *****/ 140 PGENERIC_LIST ComputerList; 141 PGENERIC_LIST DisplayList; 142 PGENERIC_LIST KeyboardList; 143 PGENERIC_LIST LayoutList; 144 PGENERIC_LIST LanguageList; 145 146 /* Settings *****/ 147 ARCHITECTURE_TYPE ArchType; //< Target architecture (MachineType) 148 PCWSTR ComputerType; 149 PCWSTR DisplayType; 150 // PCWSTR KeyboardDriver; 151 // PCWSTR MouseDriver; 152 PCWSTR LayoutId; // DefaultKBLayout 153 154 /* Other stuff *****/ 155 WCHAR LocaleID[9]; 156 LANGID LanguageId; 157 158 ULONG RequiredPartitionDiskSpace; 159 WCHAR InstallationDirectory[MAX_PATH]; 160 } USETUP_DATA, *PUSETUP_DATA; 161 162 163 #include "install.h" 164 165 166 /* FUNCTIONS ****************************************************************/ 167 168 #include "substset.h" 169 170 VOID 171 NTAPI 172 CheckUnattendedSetup( 173 IN OUT PUSETUP_DATA pSetupData); 174 175 VOID 176 NTAPI 177 InstallSetupInfFile( 178 IN OUT PUSETUP_DATA pSetupData); 179 180 NTSTATUS 181 GetSourcePaths( 182 _Out_ PUNICODE_STRING SourcePath, 183 _Out_ PUNICODE_STRING SourceRootPath, 184 _Out_ PUNICODE_STRING SourceRootDir); 185 186 ERROR_NUMBER 187 LoadSetupInf( 188 IN OUT PUSETUP_DATA pSetupData); 189 190 #define ERROR_SYSTEM_PARTITION_NOT_FOUND (ERROR_LAST_ERROR_CODE + 1) 191 192 BOOLEAN 193 NTAPI 194 InitSystemPartition( 195 /**/_In_ PPARTLIST PartitionList, /* HACK HACK! */ 196 /**/_In_ PPARTENTRY InstallPartition, /* HACK HACK! */ 197 /**/_Out_ PPARTENTRY* pSystemPartition, /* HACK HACK! */ 198 _In_opt_ PFSVOL_CALLBACK FsVolCallback, 199 _In_opt_ PVOID Context); 200 201 /** 202 * @brief 203 * Defines the class of characters valid for the installation directory. 204 * 205 * The valid characters are: ASCII alphanumericals (a-z, A-Z, 0-9), 206 * and: '.', '\\', '-', '_' . Spaces are not allowed. 207 **/ 208 #define IS_VALID_INSTALL_PATH_CHAR(c) \ 209 (isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_') 210 211 BOOLEAN 212 NTAPI 213 IsValidInstallDirectory( 214 _In_ PCWSTR InstallDir); 215 216 NTSTATUS 217 NTAPI 218 InitDestinationPaths( 219 _Inout_ PUSETUP_DATA pSetupData, 220 _In_ PCWSTR InstallationDir, 221 _In_ PVOLENTRY Volume); 222 223 // NTSTATUS 224 ERROR_NUMBER 225 NTAPI 226 InitializeSetup( 227 _Inout_ PUSETUP_DATA pSetupData, 228 _In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine, 229 _In_ PSPFILE_EXPORTS pSpFileExports, 230 _In_ PSPINF_EXPORTS pSpInfExports); 231 232 VOID 233 NTAPI 234 FinishSetup( 235 IN OUT PUSETUP_DATA pSetupData); 236 237 238 typedef enum _REGISTRY_STATUS 239 { 240 Success = 0, 241 RegHiveUpdate, 242 ImportRegHive, 243 DisplaySettingsUpdate, 244 LocaleSettingsUpdate, 245 KeybLayouts, 246 KeybSettingsUpdate, 247 CodePageInfoUpdate, 248 } REGISTRY_STATUS; 249 250 typedef VOID 251 (__cdecl *PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS, ...); 252 253 ERROR_NUMBER 254 NTAPI 255 UpdateRegistry( 256 IN OUT PUSETUP_DATA pSetupData, 257 /**/IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */ 258 /**/IN PPARTLIST PartitionList, /* HACK HACK! */ 259 /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */ 260 /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */ 261 IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, 262 IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL); 263 264 #ifdef __cplusplus 265 } 266 #endif 267 268 /* EOF */ 269