1 /* 2 * FreeLoader 3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com> 4 * Copyright (C) 2006 Aleksey Bragin <aleksey@reactos.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 #pragma once 22 23 #include <arc/setupblk.h> 24 25 #if 0 26 // See freeldr/include/winldr.h 27 #define TAG_WLDR_DTE 'eDlW' 28 #define TAG_WLDR_BDE 'dBlW' 29 #define TAG_WLDR_NAME 'mNlW' 30 31 #endif 32 33 /* Entry-point to kernel */ 34 typedef VOID (NTAPI *KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock); 35 36 37 // Some definitions 38 39 #if 0 40 41 // Descriptors 42 #define NUM_GDT 128 // Must be 128 43 #define NUM_IDT 0x100 // Only 16 are used though. Must be 0x100 44 45 #include <pshpack1.h> 46 typedef struct /* Root System Descriptor Pointer */ 47 { 48 CHAR signature [8]; /* contains "RSD PTR " */ 49 UCHAR checksum; /* to make sum of struct == 0 */ 50 CHAR oem_id [6]; /* OEM identification */ 51 UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */ 52 ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */ 53 ULONG length; /* XSDT Length in bytes including hdr */ 54 ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */ 55 UCHAR extended_checksum; /* Checksum of entire table */ 56 CHAR reserved [3]; /* reserved field must be 0 */ 57 } RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR; 58 #include <poppack.h> 59 60 typedef struct _ARC_DISK_SIGNATURE_EX 61 { 62 ARC_DISK_SIGNATURE DiskSignature; 63 CHAR ArcName[MAX_PATH]; 64 } ARC_DISK_SIGNATURE_EX, *PARC_DISK_SIGNATURE_EX; 65 66 #endif 67 68 #define MAX_OPTIONS_LENGTH 255 69 70 typedef struct _LOADER_SYSTEM_BLOCK 71 { 72 LOADER_PARAMETER_BLOCK LoaderBlock; 73 LOADER_PARAMETER_EXTENSION Extension; 74 SETUP_LOADER_BLOCK SetupBlock; 75 #ifdef _M_IX86 76 HEADLESS_LOADER_BLOCK HeadlessLoaderBlock; 77 #endif 78 NLS_DATA_BLOCK NlsDataBlock; 79 CHAR LoadOptions[MAX_OPTIONS_LENGTH+1]; 80 CHAR ArcBootDeviceName[MAX_PATH+1]; 81 // CHAR ArcHalDeviceName[MAX_PATH]; 82 CHAR NtBootPathName[MAX_PATH+1]; 83 CHAR NtHalPathName[MAX_PATH+1]; 84 ARC_DISK_INFORMATION ArcDiskInformation; 85 } LOADER_SYSTEM_BLOCK, *PLOADER_SYSTEM_BLOCK; 86 87 extern PLOADER_SYSTEM_BLOCK WinLdrSystemBlock; 88 89 90 // conversion.c 91 #if 0 92 PVOID VaToPa(PVOID Va); 93 PVOID PaToVa(PVOID Pa); 94 VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry); 95 #endif 96 VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start); 97 98 99 // winldr.c 100 PVOID WinLdrLoadModule(PCSTR ModuleName, ULONG *Size, 101 TYPE_OF_MEMORY MemoryType); 102 103 // wlmemory.c 104 BOOLEAN 105 WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock); 106 107 // wlregistry.c 108 BOOLEAN 109 WinLdrInitSystemHive( 110 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, 111 IN PCSTR SystemRoot, 112 IN BOOLEAN Setup); 113 114 BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, 115 IN LPCSTR DirectoryPath); 116 117 // winldr.c 118 VOID 119 WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock, 120 LPCSTR Options, 121 LPCSTR SystemPath, 122 LPCSTR BootPath, 123 USHORT VersionToBoot); 124 BOOLEAN 125 WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, 126 IN LPCSTR DirectoryPath, 127 IN LPCSTR AnsiFileName, 128 IN LPCSTR OemFileName, 129 IN LPCSTR LanguageFileName); 130 BOOLEAN 131 WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead, 132 LPWSTR RegistryPath, 133 LPWSTR ImagePath, 134 LPWSTR ServiceName); 135 136 VOID 137 WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock); 138 139 VOID 140 WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock); 141 142 VOID 143 WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock); 144 145 VOID 146 LoadAndBootWindowsCommon( 147 USHORT OperatingSystemVersion, 148 PLOADER_PARAMETER_BLOCK LoaderBlock, 149 LPCSTR BootOptions, 150 LPCSTR BootPath, 151 BOOLEAN Setup); 152