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