ReactOS  0.4.15-dev-4570-g4f8bbd1
winldr.h
Go to the documentation of this file.
1 /*
2  * PROJECT: FreeLoader
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Windows-compatible NT OS Loader.
5  * COPYRIGHT: Copyright 2006-2019 Aleksey Bragin <aleksey@reactos.org>
6  */
7 
8 #pragma once
9 
10 #include <arc/setupblk.h>
11 
12 /* Entry-point to kernel */
14 
15 /* Descriptors */
16 #define NUM_GDT 128 // Must be 128
17 #define NUM_IDT 0x100 // Only 16 are used though. Must be 0x100
18 
19 #if 0
20 
21 #include <pshpack1.h>
22 typedef struct /* Root System Descriptor Pointer */
23 {
24  CHAR signature [8]; /* contains "RSD PTR " */
25  UCHAR checksum; /* to make sum of struct == 0 */
26  CHAR oem_id [6]; /* OEM identification */
27  UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
28  ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
29  ULONG length; /* XSDT Length in bytes including hdr */
30  ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
31  UCHAR extended_checksum; /* Checksum of entire table */
32  CHAR reserved [3]; /* reserved field must be 0 */
34 #include <poppack.h>
35 
36 typedef struct _ARC_DISK_SIGNATURE_EX
37 {
41 
42 #endif
43 
44 #define MAX_OPTIONS_LENGTH 255
45 
46 typedef struct _LOADER_SYSTEM_BLOCK
47 {
51 #ifdef _M_IX86
52  HEADLESS_LOADER_BLOCK HeadlessLoaderBlock;
53 #endif
57  // CHAR ArcHalDeviceName[MAX_PATH];
62 
64 extern PCWSTR BootFileSystem;
65 
66 
67 // conversion.c
68 #if 0
69 PVOID VaToPa(PVOID Va);
70 PVOID PaToVa(PVOID Pa);
71 VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry);
72 #endif
74 
75 // winldr.c
76 extern BOOLEAN SosEnabled;
77 #ifdef _M_IX86
78 extern BOOLEAN PaeModeOn;
79 #endif
80 
82 VOID
84 {
85 #ifdef _M_ARM
86  /* Re-initialize the UI */
88 #else
89  /* Reset the UI and switch to MiniTui */
93 #endif
94  /* Disable the progress bar */
96 }
97 
98 VOID
102 
104  TYPE_OF_MEMORY MemoryType);
105 
106 // wlmemory.c
107 BOOLEAN
109 
110 // wlregistry.c
111 BOOLEAN
113  IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
115  IN BOOLEAN Setup);
116 
119 
120 BOOLEAN
122  _Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock,
123  _In_ PCSTR DirectoryPath,
124  _In_ PCUNICODE_STRING AnsiFileName,
125  _In_ PCUNICODE_STRING OemFileName,
126  _In_ PCUNICODE_STRING LangFileName, // CaseTable
127  _In_ PCUNICODE_STRING OemHalFileName);
128 
129 BOOLEAN
131  _Inout_ PLIST_ENTRY DriverListHead,
132  _In_ BOOLEAN InsertAtHead,
133  _In_ PCWSTR DriverName,
134  _In_opt_ PCWSTR ImagePath,
135  _In_opt_ PCWSTR GroupName,
136  _In_ ULONG ErrorControl,
137  _In_ ULONG Tag);
138 
139 // winldr.c
140 VOID
142  PCSTR Options,
143  PCSTR SystemPath,
144  PCSTR BootPath,
145  USHORT VersionToBoot);
146 
147 VOID
149 
150 VOID
152 
153 VOID
155 
158  IN USHORT OperatingSystemVersion,
159  IN PLOADER_PARAMETER_BLOCK LoaderBlock,
161  IN PCSTR BootPath);
162 
163 VOID
165 
166 VOID
168 
169 // arch/xxx/winldr.c
170 BOOLEAN
172  IN PFN_NUMBER NumberOfPages,
173  IN BOOLEAN KernelMapping);
174 
175 VOID
177 
178 VOID
179 MempDump(VOID);
struct _ARC_DISK_SIGNATURE_EX ARC_DISK_SIGNATURE_EX
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
VOID(NTAPI * KERNEL_ENTRY_POINT)(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.h:13
ARC_DISK_INFORMATION ArcDiskInformation
Definition: winldr.h:60
#define _In_opt_
Definition: ms_sal.h:309
VOID MempUnmapPage(PFN_NUMBER Page)
Definition: winldr.c:204
#define _Inout_
Definition: ms_sal.h:378
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:828
VOID WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:379
const UIVTBL MiniTuiVtbl
Definition: minitui.c:249
#define TRUE
Definition: types.h:120
VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry)
PVOID PaToVa(PVOID Pa)
Definition: conversion.h:22
BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR SystemRoot)
Definition: wlregistry.c:161
char CHAR
Definition: xmlstorage.h:175
VOID WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock, PCSTR Options, PCSTR SystemPath, PCSTR BootPath, USHORT VersionToBoot)
Definition: winldr.c:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG ARC_STATUS
Definition: arc.h:4
ARC_STATUS LoadAndBootWindowsCommon(IN USHORT OperatingSystemVersion, IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath)
Definition: winldr.c:1150
BOOLEAN SosEnabled
Definition: winldr.c:33
PCWSTR BootFileSystem
Definition: winldr.c:30
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
struct RSDP_DESCRIPTOR * PRSDP_DESCRIPTOR
static const WCHAR Description[]
Definition: oid.c:1266
PVOID VaToPa(PVOID Va)
Definition: conversion.h:15
BOOLEAN WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: wlmemory.c:181
CHAR ArcBootDeviceName[MAX_PATH+1]
Definition: winldr.h:56
struct _ARC_DISK_SIGNATURE_EX * PARC_DISK_SIGNATURE_EX
enum _TYPE_OF_MEMORY TYPE_OF_MEMORY
int WINAPI StartPage(_In_ HDC)
struct _LOADER_SYSTEM_BLOCK * PLOADER_SYSTEM_BLOCK
#define MAX_OPTIONS_LENGTH
Definition: winldr.h:44
UIVTBL UiVtbl
Definition: ui.c:70
ULONG PFN_NUMBER
Definition: ke.h:9
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
struct _LOADER_SYSTEM_BLOCK LOADER_SYSTEM_BLOCK
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
r reserved
Definition: btrfs.c:2975
unsigned char BOOLEAN
VOID WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1266
#define _In_
Definition: ms_sal.h:308
BOOLEAN WinLdrAddDriverToList(_Inout_ PLIST_ENTRY DriverListHead, _In_ BOOLEAN InsertAtHead, _In_ PCWSTR DriverName, _In_opt_ PCWSTR ImagePath, _In_opt_ PCWSTR GroupName, _In_ ULONG ErrorControl, _In_ ULONG Tag)
Inserts the specified driver entry into the driver list, or updates an existing entry with new ImageP...
Definition: wlregistry.c:575
BOOLEAN WinLdrLoadNLSData(_Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ PCSTR DirectoryPath, _In_ PCUNICODE_STRING AnsiFileName, _In_ PCUNICODE_STRING OemFileName, _In_ PCUNICODE_STRING LangFileName, _In_ PCUNICODE_STRING OemHalFileName)
Definition: wlregistry.c:336
PFN_NUMBER Page
Definition: section.c:4924
LOADER_PARAMETER_BLOCK LoaderBlock
Definition: winldr.h:48
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3531
BOOLEAN(* Initialize)(VOID)
Definition: ui.h:247
static const WCHAR SystemRoot[]
Definition: reg.c:38
CHAR ArcName[MAX_PATH]
Definition: winldr.h:37
uint64_t ULONGLONG
Definition: typedefs.h:67
NLS_DATA_BLOCK NlsDataBlock
Definition: winldr.h:54
#define MAX_PATH
Definition: compat.h:34
BOOLEAN Show
Definition: ui.h:129
ARC_DISK_SIGNATURE DiskSignature
Definition: winldr.h:36
Definition: partlist.h:33
CHAR LoadOptions[MAX_OPTIONS_LENGTH+1]
Definition: winldr.h:55
VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
Definition: conversion.c:51
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID MempDump(VOID)
Definition: winldr.c:429
VOID NtLdrOutputLoadMsg(_In_ PCSTR FileName, _In_opt_ PCSTR Description)
Definition: winldr.c:54
#define VOID
Definition: acefi.h:82
CHAR NtHalPathName[MAX_PATH+1]
Definition: winldr.h:59
Definition: typedefs.h:119
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
Definition: fdi.c:353
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock
Definition: winldr.c:29
LOADER_PARAMETER_EXTENSION Extension
Definition: winldr.h:49
SETUP_LOADER_BLOCK SetupBlock
Definition: winldr.h:50
unsigned short USHORT
Definition: pedump.c:61
VOID WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1304
VOID WinLdrSetProcessorContext(VOID)
Definition: winldr.c:348
BOOLEAN MempSetupPaging(IN PFN_NUMBER StartPage, IN PFN_NUMBER NumberOfPages, IN BOOLEAN KernelMapping)
Definition: winldr.c:170
#define FORCEINLINE
Definition: wdftypes.h:67
unsigned int * PULONG
Definition: retypes.h:1
FORCEINLINE VOID UiResetForSOS(VOID)
Definition: winldr.h:83
BOOLEAN UiInitialize(BOOLEAN ShowUi)
Definition: ui.c:98
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
PVOID WinLdrLoadModule(PCSTR ModuleName, PULONG Size, TYPE_OF_MEMORY MemoryType)
Definition: winldr.c:425
const char * PCSTR
Definition: typedefs.h:52
VOID WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1285
CHAR NtBootPathName[MAX_PATH+1]
Definition: winldr.h:58
BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR SystemRoot, IN BOOLEAN Setup)
Definition: wlregistry.c:110
VOID(* UnInitialize)(VOID)
Definition: ui.h:248
UI_PROGRESS_BAR UiProgressBar
Definition: ui.c:66