ReactOS 0.4.15-dev-7842-g558ab78
winldr.c File Reference
#include <freeldr.h>
#include <ndk/ldrtypes.h>
#include "winldr.h"
#include "ntldropts.h"
#include "registry.h"
#include <internal/cmboot.h>
#include <debug.h>
Include dependency graph for winldr.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (WINDOWS)
 
VOID WinLdrSetupEms (IN PCSTR BootOptions)
 
VOID DumpMemoryAllocMap (VOID)
 
static VOID NTAPI NtLdrImportDllLoadCallback (_In_ PCSTR FileName)
 
VOID NtLdrOutputLoadMsg (_In_ PCSTR FileName, _In_opt_ PCSTR Description)
 
VOID AllocateAndInitLPB (IN USHORT VersionToBoot, OUT PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
 
VOID WinLdrInitializePhase1 (PLOADER_PARAMETER_BLOCK LoaderBlock, PCSTR Options, PCSTR SystemRoot, PCSTR BootPath, USHORT VersionToBoot)
 
static BOOLEAN WinLdrLoadDeviceDriver (PLIST_ENTRY LoadOrderListHead, PCSTR BootPath, PUNICODE_STRING FilePath, ULONG Flags, PLDR_DATA_TABLE_ENTRY *DriverDTE)
 
BOOLEAN WinLdrLoadBootDrivers (PLOADER_PARAMETER_BLOCK LoaderBlock, PCSTR BootPath)
 
PVOID WinLdrLoadModule (PCSTR ModuleName, PULONG Size, TYPE_OF_MEMORY MemoryType)
 
USHORT WinLdrDetectVersion (VOID)
 
static PVOID LoadModule (IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCCH Path, IN PCCH File, IN PCCH ImportName, IN TYPE_OF_MEMORY MemoryType, OUT PLDR_DATA_TABLE_ENTRY *Dte, IN ULONG Percentage)
 
static BOOLEAN LoadWindowsCore (IN USHORT OperatingSystemVersion, IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath, IN OUT PLDR_DATA_TABLE_ENTRY *KernelDTE)
 
static BOOLEAN WinLdrInitErrataInf (IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN USHORT OperatingSystemVersion, IN PCSTR SystemRoot)
 
ARC_STATUS LoadAndBootWindows (IN ULONG Argc, IN PCHAR Argv[], IN PCHAR Envp[])
 
ARC_STATUS LoadAndBootWindowsCommon (IN USHORT OperatingSystemVersion, IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath)
 
VOID WinLdrpDumpMemoryDescriptors (PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID WinLdrpDumpBootDriver (PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID WinLdrpDumpArcDisks (PLOADER_PARAMETER_BLOCK LoaderBlock)
 

Variables

ULONG reactos_disk_count
 
ARC_DISK_SIGNATURE_EX reactos_arc_disk_info []
 
ULONG LoaderPagesSpanned
 
BOOLEAN AcpiPresent
 
HEADLESS_LOADER_BLOCK LoaderRedirectionInformation
 
BOOLEAN WinLdrTerminalConnected
 
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock
 
PCWSTR BootFileSystem = NULL
 
BOOLEAN VirtualBias = FALSE
 
BOOLEAN SosEnabled = FALSE
 
BOOLEAN SafeBoot = FALSE
 
BOOLEAN BootLogo = FALSE
 
BOOLEAN NoExecuteEnabled = FALSE
 

Function Documentation

◆ AllocateAndInitLPB()

VOID AllocateAndInitLPB ( IN USHORT  VersionToBoot,
OUT PLOADER_PARAMETER_BLOCK OutLoaderBlock 
)

Definition at line 79 of file winldr.c.

82{
83 PLOADER_PARAMETER_BLOCK LoaderBlock;
85
86 /* Allocate and zero-init the Loader Parameter Block */
90 {
91 UiMessageBox("Failed to allocate memory for system block!");
92 return;
93 }
94
96
97 LoaderBlock = &WinLdrSystemBlock->LoaderBlock;
98 LoaderBlock->NlsData = &WinLdrSystemBlock->NlsDataBlock;
99
100 /* Initialize the Loader Block Extension */
102 LoaderBlock->Extension = Extension;
104 Extension->MajorVersion = (VersionToBoot & 0xFF00) >> 8;
105 Extension->MinorVersion = (VersionToBoot & 0xFF);
106
107 /* Init three critical lists, used right away */
111
112 *OutLoaderBlock = LoaderBlock;
113}
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define NULL
Definition: types.h:112
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
@ LoaderSystemBlock
Definition: arc.h:175
struct _LOADER_PARAMETER_EXTENSION LOADER_PARAMETER_EXTENSION
LIST_ENTRY BootDriverListHead
Definition: arc.h:542
LIST_ENTRY LoadOrderListHead
Definition: arc.h:540
PNLS_DATA_BLOCK NlsData
Definition: arc.h:555
PLOADER_PARAMETER_EXTENSION Extension
Definition: arc.h:559
LIST_ENTRY MemoryDescriptorListHead
Definition: arc.h:541
NLS_DATA_BLOCK NlsDataBlock
Definition: winldr.h:54
LOADER_PARAMETER_EXTENSION Extension
Definition: winldr.h:49
LOADER_PARAMETER_BLOCK LoaderBlock
Definition: winldr.h:48
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock
Definition: winldr.c:29

Referenced by LoadAndBootWindows(), and LoadReactOSSetup().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( WINDOWS  )

◆ DumpMemoryAllocMap()

VOID DumpMemoryAllocMap ( VOID  )

◆ LoadAndBootWindows()

ARC_STATUS LoadAndBootWindows ( IN ULONG  Argc,
IN PCHAR  Argv[],
IN PCHAR  Envp[] 
)

Definition at line 967 of file winldr.c.

971{
973 PCSTR ArgValue;
978 USHORT OperatingSystemVersion;
979 PLOADER_PARAMETER_BLOCK LoaderBlock;
980 CHAR BootPath[MAX_PATH];
982 CHAR BootOptions[256];
983
984 /* Retrieve the (mandatory) boot type */
985 ArgValue = GetArgumentValue(Argc, Argv, "BootType");
986 if (!ArgValue || !*ArgValue)
987 {
988 ERR("No 'BootType' value, aborting!\n");
989 return EINVAL;
990 }
991
992 /* Convert it to an OS version */
993 if (_stricmp(ArgValue, "Windows") == 0 ||
994 _stricmp(ArgValue, "Windows2003") == 0)
995 {
996 OperatingSystemVersion = _WIN32_WINNT_WS03;
997 }
998 else if (_stricmp(ArgValue, "WindowsNT40") == 0)
999 {
1000 OperatingSystemVersion = _WIN32_WINNT_NT4;
1001 }
1002 else
1003 {
1004 ERR("Unknown 'BootType' value '%s', aborting!\n", ArgValue);
1005 return EINVAL;
1006 }
1007
1008 /* Retrieve the (mandatory) system partition */
1009 SystemPartition = GetArgumentValue(Argc, Argv, "SystemPartition");
1011 {
1012 ERR("No 'SystemPartition' specified, aborting!\n");
1013 return EINVAL;
1014 }
1015
1016 /* Let the user know we started loading */
1018 UiDrawStatusText("Loading...");
1019 UiDrawProgressBarCenter("Loading NT...");
1020
1021 /* Retrieve the system path */
1022 *BootPath = ANSI_NULL;
1023 ArgValue = GetArgumentValue(Argc, Argv, "SystemPath");
1024 if (ArgValue)
1025 RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
1026
1027 /*
1028 * Check whether BootPath is a full path
1029 * and if not, create a full boot path.
1030 *
1031 * See FsOpenFile for the technique used.
1032 */
1033 if (strrchr(BootPath, ')') == NULL)
1034 {
1035 /* Temporarily save the boot path */
1036 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
1037
1038 /* This is not a full path: prepend the SystemPartition */
1039 RtlStringCbCopyA(BootPath, sizeof(BootPath), SystemPartition);
1040
1041 /* Append a path separator if needed */
1042 if (*FilePath != '\\' && *FilePath != '/')
1043 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1044
1045 /* Append the remaining path */
1046 RtlStringCbCatA(BootPath, sizeof(BootPath), FilePath);
1047 }
1048
1049 /* Append a path separator if needed */
1050 if (!*BootPath || BootPath[strlen(BootPath) - 1] != '\\')
1051 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1052
1053 TRACE("BootPath: '%s'\n", BootPath);
1054
1055 /* Retrieve the boot options */
1057 ArgValue = GetArgumentValue(Argc, Argv, "Options");
1058 if (ArgValue && *ArgValue)
1059 RtlStringCbCopyA(BootOptions, sizeof(BootOptions), ArgValue);
1060
1061 /* Append boot-time options */
1063
1064 /*
1065 * Set the "/HAL=" and "/KERNEL=" options if needed.
1066 * If already present on the standard "Options=" option line, they take
1067 * precedence over those passed via the separate "Hal=" and "Kernel="
1068 * options.
1069 */
1070 if (!NtLdrGetOption(BootOptions, "HAL="))
1071 {
1072 /*
1073 * Not found in the options, try to retrieve the
1074 * separate value and append it to the options.
1075 */
1076 ArgValue = GetArgumentValue(Argc, Argv, "Hal");
1077 if (ArgValue && *ArgValue)
1078 {
1079 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /HAL=");
1080 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1081 }
1082 }
1083 if (!NtLdrGetOption(BootOptions, "KERNEL="))
1084 {
1085 /*
1086 * Not found in the options, try to retrieve the
1087 * separate value and append it to the options.
1088 */
1089 ArgValue = GetArgumentValue(Argc, Argv, "Kernel");
1090 if (ArgValue && *ArgValue)
1091 {
1092 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /KERNEL=");
1093 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1094 }
1095 }
1096
1097 TRACE("BootOptions: '%s'\n", BootOptions);
1098
1099 /* Check if a RAM disk file was given */
1101 if (FileName && (FileNameLength > 7))
1102 {
1103 /* Load the RAM disk */
1105 if (Status != ESUCCESS)
1106 {
1107 FileName += 7; FileNameLength -= 7;
1108 UiMessageBox("Failed to load RAM disk file '%.*s'",
1110 return Status;
1111 }
1112 }
1113
1114 /* Handle the SOS option */
1116 if (SosEnabled)
1117 UiResetForSOS();
1118
1119 /* Allocate and minimally-initialize the Loader Parameter Block */
1120 AllocateAndInitLPB(OperatingSystemVersion, &LoaderBlock);
1121
1122 /* Load the system hive */
1123 UiUpdateProgressBar(15, "Loading system hive...");
1124 Success = WinLdrInitSystemHive(LoaderBlock, BootPath, FALSE);
1125 TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
1126 /* Bail out if failure */
1127 if (!Success)
1128 return ENOEXEC;
1129
1130 /* Fixup the version number using data from the registry */
1131 if (OperatingSystemVersion == 0)
1132 OperatingSystemVersion = WinLdrDetectVersion();
1133 LoaderBlock->Extension->MajorVersion = (OperatingSystemVersion & 0xFF00) >> 8;
1134 LoaderBlock->Extension->MinorVersion = (OperatingSystemVersion & 0xFF);
1135
1136 /* Load NLS data, OEM font, and prepare boot drivers list */
1137 Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
1138 TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not scanned"));
1139 /* Bail out if failure */
1140 if (!Success)
1141 return ENOEXEC;
1142
1143 /* Load the Firmware Errata file */
1144 Success = WinLdrInitErrataInf(LoaderBlock, OperatingSystemVersion, BootPath);
1145 TRACE("Firmware Errata file %s\n", (Success ? "loaded" : "not loaded"));
1146 /* Not necessarily fatal if not found - carry on going */
1147
1148 /* Finish loading */
1149 return LoadAndBootWindowsCommon(OperatingSystemVersion,
1150 LoaderBlock,
1152 BootPath);
1153}
PCWSTR FilePath
unsigned char BOOLEAN
#define EINVAL
Definition: acclib.h:90
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
PCHAR GetArgumentValue(IN ULONG Argc, IN PCHAR Argv[], IN PCHAR ArgumentName)
Definition: arcsupp.c:41
@ BootOptions
Definition: bl.h:898
ARC_STATUS RamDiskInitialize(IN BOOLEAN InitRamDisk, IN PCSTR LoadOptions OPTIONAL, IN PCSTR DefaultPath OPTIONAL)
Definition: ramdisk.c:206
#define ERR(fmt,...)
Definition: debug.h:110
VOID AppendBootTimeOptions(PCHAR BootOptions)
Definition: options.c:252
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:454
VOID UiDrawBackdrop(VOID)
Definition: ui.c:233
VOID UiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: ui.c:487
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:286
#define _stricmp
Definition: cat.c:22
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
#define ENOEXEC
Definition: errno.h:14
@ Success
Definition: eventcreate.c:712
struct _FileName FileName
Definition: fatprocs.h:896
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
Definition: fltkernel.h:1129
Status
Definition: gdiplustypes.h:25
#define ANSI_NULL
FORCEINLINE VOID UiResetForSOS(VOID)
Definition: winldr.h:83
BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR SystemRoot, IN BOOLEAN Setup)
Definition: wlregistry.c:125
BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR SystemRoot)
Definition: wlregistry.c:231
PCSTR NtLdrGetOption(IN PCSTR Options, IN PCSTR OptionName)
Definition: ntldropts.c:128
PCSTR NtLdrGetOptionEx(IN PCSTR Options, IN PCSTR OptionName, OUT PULONG OptionLength OPTIONAL)
Definition: ntldropts.c:117
NTSTRSAFEAPI RtlStringCbCatA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:625
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
unsigned short USHORT
Definition: pedump.c:61
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
#define _WIN32_WINNT_NT4
Definition: sdkddkver.h:20
#define TRACE(s)
Definition: solgame.cpp:4
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
static PPARTENTRY SystemPartition
Definition: usetup.c:61
ARC_STATUS LoadAndBootWindowsCommon(IN USHORT OperatingSystemVersion, IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath)
Definition: winldr.c:1156
USHORT WinLdrDetectVersion(VOID)
Definition: winldr.c:485
static BOOLEAN WinLdrInitErrataInf(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN USHORT OperatingSystemVersion, IN PCSTR SystemRoot)
Definition: winldr.c:907
BOOLEAN SosEnabled
Definition: winldr.c:33
VOID AllocateAndInitLPB(IN USHORT VersionToBoot, OUT PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
Definition: winldr.c:79
char CHAR
Definition: xmlstorage.h:175

◆ LoadAndBootWindowsCommon()

ARC_STATUS LoadAndBootWindowsCommon ( IN USHORT  OperatingSystemVersion,
IN PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN PCSTR  BootOptions,
IN PCSTR  BootPath 
)

Definition at line 1156 of file winldr.c.

1161{
1162 PLOADER_PARAMETER_BLOCK LoaderBlockVA;
1164 PLDR_DATA_TABLE_ENTRY KernelDTE;
1167
1168 TRACE("LoadAndBootWindowsCommon()\n");
1169
1170 ASSERT(OperatingSystemVersion != 0);
1171
1172#ifdef _M_IX86
1173 /* Setup redirection support */
1175#endif
1176
1177 /* Convert BootPath to SystemRoot */
1178 SystemRoot = strstr(BootPath, "\\");
1179
1180 /* Detect hardware */
1181 UiUpdateProgressBar(20, "Detecting hardware...");
1182 LoaderBlock->ConfigurationRoot = MachHwDetect(BootOptions);
1183
1184 /* Initialize the PE loader import-DLL callback, so that we can obtain
1185 * feedback (for example during SOS) on the PE images that get loaded. */
1187
1188 /* Load the operating system core: the Kernel, the HAL and the Kernel Debugger Transport DLL */
1189 Success = LoadWindowsCore(OperatingSystemVersion,
1190 LoaderBlock,
1192 BootPath,
1193 &KernelDTE);
1194 if (!Success)
1195 {
1196 /* Reset the PE loader import-DLL callback */
1198
1199 UiMessageBox("Error loading NTOS core.");
1200 return ENOEXEC;
1201 }
1202
1203 /* Cleanup INI file */
1204 IniCleanup();
1205
1206/****
1207 **** WE HAVE NOW REACHED THE POINT OF NO RETURN !!
1208 ****/
1209
1210 UiSetProgressBarSubset(40, 90); // NTOS goes from 25 to 75%
1211
1212 /* Load boot drivers */
1213 UiSetProgressBarText("Loading boot drivers...");
1214 Success = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
1215 TRACE("Boot drivers loading %s\n", Success ? "successful" : "failed");
1216
1217 UiSetProgressBarSubset(0, 100);
1218
1219 /* Reset the PE loader import-DLL callback */
1221
1222 /* Initialize Phase 1 - no drivers loading anymore */
1223 WinLdrInitializePhase1(LoaderBlock,
1225 SystemRoot,
1226 BootPath,
1227 OperatingSystemVersion);
1228
1230
1231 /* Save entry-point pointer and Loader block VAs */
1233 LoaderBlockVA = PaToVa(LoaderBlock);
1234
1235 /* "Stop all motors", change videomode */
1237
1238 /* Debugging... */
1239 //DumpMemoryAllocMap();
1240
1241 /* Do the machine specific initialization */
1242 WinLdrSetupMachineDependent(LoaderBlock);
1243
1244 /* Map pages and create memory descriptors */
1245 WinLdrSetupMemoryLayout(LoaderBlock);
1246
1247 /* Set processor context */
1249
1250 /* Save final value of LoaderPagesSpanned */
1251 LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
1252
1253 TRACE("Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
1254 KiSystemStartup, LoaderBlockVA);
1255
1256 /* Zero KI_USER_SHARED_DATA page */
1257 RtlZeroMemory((PVOID)KI_USER_SHARED_DATA, MM_PAGE_SIZE);
1258
1259 WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
1260 WinLdrpDumpBootDriver(LoaderBlockVA);
1261#ifndef _M_AMD64
1262 WinLdrpDumpArcDisks(LoaderBlockVA);
1263#endif
1264
1265 /* Pass control */
1266 (*KiSystemStartup)(LoaderBlockVA);
1267
1268 UNREACHABLE; // return ESUCCESS;
1269}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
VOID WinLdrSetProcessorContext(void)
Definition: winldr.c:349
void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:380
#define MachHwDetect(Options)
Definition: machine.h:136
#define MachPrepareForReactOS()
Definition: machine.h:120
VOID UiSetProgressBarText(_In_ PCSTR ProgressText)
Definition: ui.c:476
VOID UiSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Definition: ui.c:439
FORCEINLINE PVOID PaToVa(PVOID Pa)
Definition: conversion.h:22
static const WCHAR SystemRoot[]
Definition: reg.c:38
VOID IniCleanup(VOID)
Definition: inifile.c:238
#define ASSERT(a)
Definition: mode.c:44
#define UNREACHABLE
VOID(NTAPI * KERNEL_ENTRY_POINT)(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.h:13
BOOLEAN WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: wlmemory.c:181
DECLSPEC_NORETURN VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:476
PELDR_IMPORTDLL_LOAD_CALLBACK PeLdrImportDllLoadCallback
Definition: peloader.c:28
#define KI_USER_SHARED_DATA
Definition: btrfs_drv.h:1876
PVOID EntryPoint
Definition: ntddk_ex.h:203
static BOOLEAN LoadWindowsCore(IN USHORT OperatingSystemVersion, IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath, IN OUT PLDR_DATA_TABLE_ENTRY *KernelDTE)
Definition: winldr.c:609
BOOLEAN WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, PCSTR BootPath)
Definition: winldr.c:367
VOID WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1310
VOID WinLdrSetupEms(IN PCSTR BootOptions)
Definition: headless.c:302
VOID WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock, PCSTR Options, PCSTR SystemRoot, PCSTR BootPath, USHORT VersionToBoot)
Definition: winldr.c:117
VOID WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1272
VOID WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: winldr.c:1291
ULONG LoaderPagesSpanned
Definition: mm.c:29
static VOID NTAPI NtLdrImportDllLoadCallback(_In_ PCSTR FileName)
Definition: winldr.c:47

Referenced by LoadAndBootWindows(), and LoadReactOSSetup().

◆ LoadModule()

static PVOID LoadModule ( IN OUT PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN PCCH  Path,
IN PCCH  File,
IN PCCH  ImportName,
IN TYPE_OF_MEMORY  MemoryType,
OUT PLDR_DATA_TABLE_ENTRY Dte,
IN ULONG  Percentage 
)
static

Definition at line 504 of file winldr.c.

512{
514 CHAR FullFileName[MAX_PATH];
515 CHAR ProgressString[256];
517
518 RtlStringCbPrintfA(ProgressString, sizeof(ProgressString), "Loading %s...", File);
519 UiUpdateProgressBar(Percentage, ProgressString);
520
521 RtlStringCbCopyA(FullFileName, sizeof(FullFileName), Path);
522 RtlStringCbCatA(FullFileName, sizeof(FullFileName), File);
523
524 NtLdrOutputLoadMsg(FullFileName, NULL);
525 Success = PeLdrLoadImage(FullFileName, MemoryType, &BaseAddress);
526 if (!Success)
527 {
528 ERR("PeLdrLoadImage('%s') failed\n", File);
529 return NULL;
530 }
531 TRACE("%s loaded successfully at %p\n", File, BaseAddress);
532
533 Success = PeLdrAllocateDataTableEntry(&LoaderBlock->LoadOrderListHead,
534 ImportName,
535 FullFileName,
537 Dte);
538 if (!Success)
539 {
540 /* Cleanup and bail out */
541 ERR("PeLdrAllocateDataTableEntry('%s') failed\n", FullFileName);
543 return NULL;
544 }
545
546 /* Init security cookie */
548
549 return BaseAddress;
550}
PRTL_UNICODE_STRING_BUFFER Path
VOID MmFreeMemory(PVOID MemoryPointer)
Definition: mm.c:215
Definition: File.h:16
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
PVOID PeLdrInitSecurityCookie(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
BOOLEAN PeLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead, IN PCCH BaseDllName, IN PCCH FullDllName, IN PVOID BasePA, OUT PLDR_DATA_TABLE_ENTRY *NewEntry)
Definition: peloader.c:681
BOOLEAN PeLdrLoadImage(_In_ PCSTR FilePath, _In_ TYPE_OF_MEMORY MemoryType, _Out_ PVOID *ImageBasePA)
Loads the specified image from the file.
Definition: peloader.c:823
VOID NtLdrOutputLoadMsg(_In_ PCSTR FileName, _In_opt_ PCSTR Description)
Definition: winldr.c:54

Referenced by DECLARE_INTERFACE_(), and LoadWindowsCore().

◆ LoadWindowsCore()

static BOOLEAN LoadWindowsCore ( IN USHORT  OperatingSystemVersion,
IN OUT PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN PCSTR  BootOptions,
IN PCSTR  BootPath,
IN OUT PLDR_DATA_TABLE_ENTRY KernelDTE 
)
static

Definition at line 609 of file winldr.c.

614{
616 PCSTR Option;
617 ULONG OptionLength;
618 PVOID KernelBase, HalBase, KdDllBase = NULL;
619 PLDR_DATA_TABLE_ENTRY HalDTE, KdDllDTE = NULL;
620 CHAR DirPath[MAX_PATH];
621 CHAR HalFileName[MAX_PATH];
622 CHAR KernelFileName[MAX_PATH];
623 CHAR KdDllName[MAX_PATH];
624
625 if (!KernelDTE) return FALSE;
626
627 /* Initialize SystemRoot\System32 path */
628 RtlStringCbCopyA(DirPath, sizeof(DirPath), BootPath);
629 RtlStringCbCatA(DirPath, sizeof(DirPath), "system32\\");
630
631 /* Parse the boot options */
632 TRACE("LoadWindowsCore: BootOptions '%s'\n", BootOptions);
633
634#ifdef _M_IX86
635 if (NtLdrGetOption(BootOptions, "3GB"))
636 {
637 /* We found the 3GB option. */
638 FIXME("LoadWindowsCore: 3GB - TRUE (not implemented)\n");
640 }
641 // TODO: "USERVA=" for XP/2k3
642#endif
643
644 if ((OperatingSystemVersion > _WIN32_WINNT_NT4) &&
645 (NtLdrGetOption(BootOptions, "SAFEBOOT") ||
646 NtLdrGetOption(BootOptions, "SAFEBOOT:")))
647 {
648 /* We found the SAFEBOOT option. */
649 FIXME("LoadWindowsCore: SAFEBOOT - TRUE (not implemented)\n");
650 SafeBoot = TRUE;
651 }
652
653 if ((OperatingSystemVersion > _WIN32_WINNT_WIN2K) &&
654 NtLdrGetOption(BootOptions, "BOOTLOGO"))
655 {
656 /* We found the BOOTLOGO option. */
657 FIXME("LoadWindowsCore: BOOTLOGO - TRUE (not implemented)\n");
658 BootLogo = TRUE;
659 }
660
661 /* Check the (NO)EXECUTE options */
662 if ((OperatingSystemVersion > _WIN32_WINNT_WIN2K) &&
663 !LoaderBlock->SetupLdrBlock)
664 {
665 /* Disable NX by default on x86, otherwise enable it */
666#ifdef _M_IX86
668#else
670#endif
671
672#ifdef _M_IX86
673 /* Check the options in decreasing order of precedence */
674 if (NtLdrGetOption(BootOptions, "NOEXECUTE=OPTIN") ||
675 NtLdrGetOption(BootOptions, "NOEXECUTE=OPTOUT") ||
676 NtLdrGetOption(BootOptions, "NOEXECUTE=ALWAYSON"))
677 {
679 }
680 else if (NtLdrGetOption(BootOptions, "NOEXECUTE=ALWAYSOFF"))
682 else
683#else
684 /* Only the following two options really apply for x64 and other platforms */
685#endif
686 if (NtLdrGetOption(BootOptions, "NOEXECUTE"))
688 else if (NtLdrGetOption(BootOptions, "EXECUTE"))
690
691#ifdef _M_IX86
692 /* Disable DEP in SafeBoot mode for x86 only */
693 if (SafeBoot)
695#endif
696 }
697 TRACE("NoExecuteEnabled %X\n", NoExecuteEnabled);
698
699 /*
700 * Select the HAL and KERNEL file names.
701 * Check for any "/HAL=" or "/KERNEL=" override option.
702 *
703 * See the following links to know how the file names are actually chosen:
704 * https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/detecthal.htm
705 * https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/hal.htm
706 * https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/kernel.htm
707 */
708 /* Default HAL and KERNEL file names */
709 RtlStringCbCopyA(HalFileName , sizeof(HalFileName) , "hal.dll");
710 RtlStringCbCopyA(KernelFileName, sizeof(KernelFileName), "ntoskrnl.exe");
711
712 Option = NtLdrGetOptionEx(BootOptions, "HAL=", &OptionLength);
713 if (Option && (OptionLength > 4))
714 {
715 /* Retrieve the HAL file name */
716 Option += 4; OptionLength -= 4;
717 RtlStringCbCopyNA(HalFileName, sizeof(HalFileName), Option, OptionLength);
718 _strlwr(HalFileName);
719 }
720
721 Option = NtLdrGetOptionEx(BootOptions, "KERNEL=", &OptionLength);
722 if (Option && (OptionLength > 7))
723 {
724 /* Retrieve the KERNEL file name */
725 Option += 7; OptionLength -= 7;
726 RtlStringCbCopyNA(KernelFileName, sizeof(KernelFileName), Option, OptionLength);
727 _strlwr(KernelFileName);
728 }
729
730#ifdef _M_IX86
731 /* Check for PAE support and select the adequate kernel image */
732 PaeModeOn = WinLdrIsPaeSupported(OperatingSystemVersion,
733 LoaderBlock,
735 HalFileName,
736 KernelFileName,
737 sizeof(KernelFileName));
738 if (PaeModeOn) FIXME("WinLdrIsPaeSupported: PaeModeOn\n");
739#endif
740
741 TRACE("HAL file = '%s' ; Kernel file = '%s'\n", HalFileName, KernelFileName);
742
743 /*
744 * Load the core NT files: Kernel, HAL and KD transport DLL.
745 * Cheat about their base DLL name so as to satisfy the imports/exports,
746 * even if the corresponding underlying files do not have the same names
747 * -- this happens e.g. with UP vs. MP kernel, standard vs. ACPI hal, or
748 * different KD transport DLLs.
749 */
750
751 /* Load the Kernel */
752 KernelBase = LoadModule(LoaderBlock, DirPath, KernelFileName,
753 "ntoskrnl.exe", LoaderSystemCode, KernelDTE, 30);
754 if (!KernelBase)
755 {
756 ERR("LoadModule('%s') failed\n", KernelFileName);
757 UiMessageBox("Could not load %s", KernelFileName);
758 return FALSE;
759 }
760
761 /* Load the HAL */
762 HalBase = LoadModule(LoaderBlock, DirPath, HalFileName,
763 "hal.dll", LoaderHalCode, &HalDTE, 35);
764 if (!HalBase)
765 {
766 ERR("LoadModule('%s') failed\n", HalFileName);
767 UiMessageBox("Could not load %s", HalFileName);
768 PeLdrFreeDataTableEntry(*KernelDTE);
770 return FALSE;
771 }
772
773 /* Load the Kernel Debugger Transport DLL */
774 if (OperatingSystemVersion > _WIN32_WINNT_WIN2K)
775 {
776 /*
777 * According to http://www.nynaeve.net/?p=173 :
778 * "[...] Another enhancement that could be done Microsoft-side would be
779 * a better interface for replacing KD transport modules. Right now, due
780 * to the fact that ntoskrnl is static linked to KDCOM.DLL, the OS loader
781 * has a hardcoded hack that interprets the KD type in the OS loader options,
782 * loads one of the (hardcoded filenames) "kdcom.dll", "kd1394.dll", or
783 * "kdusb2.dll" modules, and inserts them into the loaded module list under
784 * the name "kdcom.dll". [...]"
785 */
786
787 /*
788 * A Kernel Debugger Transport DLL is always loaded for Windows XP+ :
789 * either the standard KDCOM.DLL (by default): IsCustomKdDll == FALSE
790 * or an alternative user-provided one via the /DEBUGPORT= option:
791 * IsCustomKdDll == TRUE if it does not specify the default KDCOM.
792 */
793 BOOLEAN IsCustomKdDll = FALSE;
794
795 /* Check whether there is a DEBUGPORT option */
796 Option = NtLdrGetOptionEx(BootOptions, "DEBUGPORT=", &OptionLength);
797 if (Option && (OptionLength > 10))
798 {
799 /* Move to the debug port name */
800 Option += 10; OptionLength -= 10;
801
802 /*
803 * Parse the port name.
804 * Format: /DEBUGPORT=COM[0-9]
805 * or: /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log
806 * or: /DEBUGPORT=FOO
807 * If we only have /DEBUGPORT= (i.e. without any port name),
808 * default to "COM".
809 */
810
811 /* Get the actual length of the debug port
812 * until the next whitespace or colon. */
813 OptionLength = (ULONG)strcspn(Option, " \t:");
814
815 if ((OptionLength == 0) ||
816 ( (OptionLength >= 3) && (_strnicmp(Option, "COM", 3) == 0) &&
817 ((OptionLength == 3) || ('0' <= Option[3] && Option[3] <= '9')) ))
818 {
819 /* The standard KDCOM.DLL is used */
820 }
821 else
822 {
823 /* A custom KD DLL is used */
824 IsCustomKdDll = TRUE;
825 }
826 }
827 if (!IsCustomKdDll)
828 {
829 Option = "COM"; OptionLength = 3;
830 }
831
832 RtlStringCbPrintfA(KdDllName, sizeof(KdDllName), "kd%.*s.dll",
833 OptionLength, Option);
834 _strlwr(KdDllName);
835
836 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
837 KdDllBase = LoadModule(LoaderBlock, DirPath, KdDllName,
838 "kdcom.dll", LoaderSystemCode, &KdDllDTE, 40);
839 if (!KdDllBase)
840 {
841 /* If we failed to load a custom KD DLL, fall back to the standard one */
842 if (IsCustomKdDll)
843 {
844 /* The custom KD DLL being optional, just ignore the failure */
845 WARN("LoadModule('%s') failed\n", KdDllName);
846
847 IsCustomKdDll = FALSE;
848 RtlStringCbCopyA(KdDllName, sizeof(KdDllName), "kdcom.dll");
849
850 KdDllBase = LoadModule(LoaderBlock, DirPath, KdDllName,
851 "kdcom.dll", LoaderSystemCode, &KdDllDTE, 40);
852 }
853
854 if (!KdDllBase)
855 {
856 /* Ignore the failure; we will fail later when scanning the
857 * kernel import tables, if it really needs the KD DLL. */
858 ERR("LoadModule('%s') failed\n", KdDllName);
859 }
860 }
861 }
862
863 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
864 Success = PeLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, *KernelDTE);
865 if (!Success)
866 {
867 UiMessageBox("Could not load %s", KernelFileName);
868 goto Quit;
869 }
870 Success = PeLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, HalDTE);
871 if (!Success)
872 {
873 UiMessageBox("Could not load %s", HalFileName);
874 goto Quit;
875 }
876 if (KdDllDTE)
877 {
878 Success = PeLdrScanImportDescriptorTable(&LoaderBlock->LoadOrderListHead, DirPath, KdDllDTE);
879 if (!Success)
880 {
881 UiMessageBox("Could not load %s", KdDllName);
882 goto Quit;
883 }
884 }
885
886Quit:
887 if (!Success)
888 {
889 /* Cleanup and bail out */
890 if (KdDllDTE)
891 PeLdrFreeDataTableEntry(KdDllDTE);
892 if (KdDllBase) // Optional
893 MmFreeMemory(KdDllBase);
894
896 MmFreeMemory(HalBase);
897
898 PeLdrFreeDataTableEntry(*KernelDTE);
900 }
901
902 return Success;
903}
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define TRUE
Definition: types.h:120
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
ULONG_PTR KernelBase
Definition: halinit_mp.c:20
NTSTRSAFEAPI RtlStringCbCopyNA(_Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc, _In_ size_t cbToCopy)
Definition: ntstrsafe.h:395
BOOLEAN PeLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead, IN PCCH DirectoryPath, IN PLDR_DATA_TABLE_ENTRY ScanDTE)
Definition: peloader.c:605
VOID PeLdrFreeDataTableEntry(_In_ PLDR_DATA_TABLE_ENTRY Entry)
Definition: peloader.c:798
_CRTIMP char *__cdecl _strlwr(_Inout_z_ char *_String)
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
@ LoaderSystemCode
Definition: arc.h:183
@ LoaderHalCode
Definition: arc.h:184
#define _WIN32_WINNT_WIN2K
Definition: sdkddkver.h:21
BOOLEAN VirtualBias
Definition: winldr.c:32
BOOLEAN BootLogo
Definition: winldr.c:35
BOOLEAN NoExecuteEnabled
Definition: winldr.c:39
BOOLEAN SafeBoot
Definition: winldr.c:34
static PVOID LoadModule(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCCH Path, IN PCCH File, IN PCCH ImportName, IN TYPE_OF_MEMORY MemoryType, OUT PLDR_DATA_TABLE_ENTRY *Dte, IN ULONG Percentage)
Definition: winldr.c:504

Referenced by LoadAndBootWindowsCommon().

◆ NtLdrImportDllLoadCallback()

static VOID NTAPI NtLdrImportDllLoadCallback ( _In_ PCSTR  FileName)
static

Definition at line 47 of file winldr.c.

Referenced by LoadAndBootWindowsCommon().

◆ NtLdrOutputLoadMsg()

VOID NtLdrOutputLoadMsg ( _In_ PCSTR  FileName,
_In_opt_ PCSTR  Description 
)

Definition at line 54 of file winldr.c.

57{
58 if (SosEnabled)
59 {
60 printf(" %s\n", FileName);
61 TRACE("Loading: %s\n", FileName);
62 }
63 else
64 {
65 /* Inform the user we load a file */
66 CHAR ProgressString[256];
67
68 RtlStringCbPrintfA(ProgressString, sizeof(ProgressString),
69 "Loading %s...",
71 // UiSetProgressBarText(ProgressString);
72 // UiIndicateProgress();
73 UiDrawStatusText(ProgressString);
74 }
75}
static const WCHAR Description[]
Definition: oid.c:1266
#define printf
Definition: freeldr.h:93

Referenced by LoadModule(), NtLdrImportDllLoadCallback(), WinLdrLoadDeviceDriver(), WinLdrLoadModule(), WinLdrLoadNLSData(), and WinLdrLoadSystemHive().

◆ WinLdrDetectVersion()

USHORT WinLdrDetectVersion ( VOID  )

Definition at line 485 of file winldr.c.

486{
487 LONG rc;
488 HKEY hKey;
489
490 rc = RegOpenKey(CurrentControlSetKey, L"Control\\Terminal Server", &hKey);
491 if (rc != ERROR_SUCCESS)
492 {
493 /* Key doesn't exist; assume NT 4.0 */
494 return _WIN32_WINNT_NT4;
495 }
497
498 /* We may here want to read the value of ProductVersion */
499 return _WIN32_WINNT_WS03;
500}
HKEY CurrentControlSetKey
Definition: registry.c:34
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
FxAutoRegKey hKey
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define RegOpenKey
Definition: winreg.h:519

Referenced by LoadAndBootWindows().

◆ WinLdrInitErrataInf()

static BOOLEAN WinLdrInitErrataInf ( IN OUT PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN USHORT  OperatingSystemVersion,
IN PCSTR  SystemRoot 
)
static

Definition at line 907 of file winldr.c.

911{
912 LONG rc;
913 HKEY hKey;
916 PVOID PhysicalBase;
917 WCHAR szFileName[80];
918 CHAR ErrataFilePath[MAX_PATH];
919
920 /* Open either the 'BiosInfo' (Windows <= 2003) or the 'Errata' (Vista+) key */
921 if (OperatingSystemVersion >= _WIN32_WINNT_VISTA)
922 {
923 rc = RegOpenKey(CurrentControlSetKey, L"Control\\Errata", &hKey);
924 }
925 else // (OperatingSystemVersion <= _WIN32_WINNT_WS03)
926 {
927 rc = RegOpenKey(CurrentControlSetKey, L"Control\\BiosInfo", &hKey);
928 }
929 if (rc != ERROR_SUCCESS)
930 {
931 WARN("Could not open the BiosInfo/Errata registry key (Error %u)\n", (int)rc);
932 return FALSE;
933 }
934
935 /* Retrieve the INF file name value */
936 BufferSize = sizeof(szFileName);
937 rc = RegQueryValue(hKey, L"InfName", NULL, (PUCHAR)szFileName, &BufferSize);
938 if (rc != ERROR_SUCCESS)
939 {
940 WARN("Could not retrieve the InfName value (Error %u)\n", (int)rc);
942 return FALSE;
943 }
944
945 // TODO: "SystemBiosDate"
946
948
949 RtlStringCbPrintfA(ErrataFilePath, sizeof(ErrataFilePath), "%s%s%S",
950 SystemRoot, "inf\\", szFileName);
951
952 /* Load the INF file */
953 PhysicalBase = WinLdrLoadModule(ErrataFilePath, &FileSize, LoaderRegistryData);
954 if (!PhysicalBase)
955 {
956 WARN("Could not load '%s'\n", ErrataFilePath);
957 return FALSE;
958 }
959
960 LoaderBlock->Extension->EmInfFileImage = PaToVa(PhysicalBase);
961 LoaderBlock->Extension->EmInfFileSize = FileSize;
962
963 return TRUE;
964}
#define BufferSize
Definition: mmc.h:75
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
@ LoaderRegistryData
Definition: arc.h:193
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
unsigned char * PUCHAR
Definition: typedefs.h:53
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
PVOID WinLdrLoadModule(PCSTR ModuleName, PULONG Size, TYPE_OF_MEMORY MemoryType)
Definition: winldr.c:428
#define RegQueryValue
Definition: winreg.h:523
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LoadAndBootWindows().

◆ WinLdrInitializePhase1()

VOID WinLdrInitializePhase1 ( PLOADER_PARAMETER_BLOCK  LoaderBlock,
PCSTR  Options,
PCSTR  SystemRoot,
PCSTR  BootPath,
USHORT  VersionToBoot 
)

Definition at line 117 of file winldr.c.

122{
123 /*
124 * Examples of correct options and paths:
125 * CHAR Options[] = "/DEBUGPORT=COM1 /BAUDRATE=115200";
126 * CHAR Options[] = "/NODEBUG";
127 * CHAR SystemRoot[] = "\\WINNT\\";
128 * CHAR ArcBoot[] = "multi(0)disk(0)rdisk(0)partition(1)";
129 */
130
131 PSTR LoadOptions, NewLoadOptions;
132 CHAR HalPath[] = "\\";
133 CHAR ArcBoot[MAX_PATH+1];
134 CHAR MiscFiles[MAX_PATH+1];
135 ULONG i;
136 ULONG_PTR PathSeparator;
138
139 /* Construct SystemRoot and ArcBoot from SystemPath */
140 PathSeparator = strstr(BootPath, "\\") - BootPath;
141 RtlStringCbCopyNA(ArcBoot, sizeof(ArcBoot), BootPath, PathSeparator);
142
143 TRACE("ArcBoot: '%s'\n", ArcBoot);
144 TRACE("SystemRoot: '%s'\n", SystemRoot);
145 TRACE("Options: '%s'\n", Options);
146
147 /* Fill ARC BootDevice */
150 LoaderBlock->ArcBootDeviceName = PaToVa(LoaderBlock->ArcBootDeviceName);
151
152//
153// IMPROVE!!
154// SetupBlock->ArcSetupDeviceName must be the path to the setup **SOURCE**,
155// and not the setup boot path. Indeed they may differ!!
156//
157 if (LoaderBlock->SetupLdrBlock)
158 {
159 PSETUP_LOADER_BLOCK SetupBlock = LoaderBlock->SetupLdrBlock;
160
161 /* Adjust the ARC path in the setup block - Matches ArcBoot path */
163 SetupBlock->ArcSetupDeviceName = PaToVa(SetupBlock->ArcSetupDeviceName);
164
165 /* Convert the setup block pointer */
166 LoaderBlock->SetupLdrBlock = PaToVa(LoaderBlock->SetupLdrBlock);
167 }
168
169 /* Fill ARC HalDevice, it matches ArcBoot path */
171 LoaderBlock->ArcHalDeviceName = PaToVa(LoaderBlock->ArcHalDeviceName);
172
173 /* Fill SystemRoot */
176 LoaderBlock->NtBootPathName = PaToVa(LoaderBlock->NtBootPathName);
177
178 /* Fill NtHalPathName */
180 RtlStringCbCopyA(LoaderBlock->NtHalPathName, sizeof(WinLdrSystemBlock->NtHalPathName), HalPath);
181 LoaderBlock->NtHalPathName = PaToVa(LoaderBlock->NtHalPathName);
182
183 /* Fill LoadOptions and strip the '/' switch symbol in front of each option */
184 NewLoadOptions = LoadOptions = LoaderBlock->LoadOptions = WinLdrSystemBlock->LoadOptions;
186
187 do
188 {
189 while (*LoadOptions == '/')
190 ++LoadOptions;
191
192 *NewLoadOptions++ = *LoadOptions;
193 } while (*LoadOptions++);
194
195 LoaderBlock->LoadOptions = PaToVa(LoaderBlock->LoadOptions);
196
197 /* ARC devices */
200
201 /* Convert ARC disk information from freeldr to a correct format */
202 for (i = 0; i < reactos_disk_count; i++)
203 {
204 PARC_DISK_SIGNATURE_EX ArcDiskSig;
205
206 /* Allocate the ARC structure */
207 ArcDiskSig = FrLdrHeapAlloc(sizeof(ARC_DISK_SIGNATURE_EX), 'giSD');
208 if (!ArcDiskSig)
209 {
210 ERR("Failed to allocate ARC structure! Ignoring remaining ARC disks. (i = %lu, DiskCount = %lu)\n",
212 break;
213 }
214
215 /* Copy the data over */
217
218 /* Set the ARC Name pointer */
219 ArcDiskSig->DiskSignature.ArcName = PaToVa(ArcDiskSig->ArcName);
220
221 /* Insert into the list */
223 &ArcDiskSig->DiskSignature.ListEntry);
224 }
225
226 /* Convert all lists to Virtual address */
227
228 /* Convert the ArcDisks list to virtual address */
230 LoaderBlock->ArcDiskInformation = PaToVa(LoaderBlock->ArcDiskInformation);
231
232 /* Convert configuration entries to VA */
234 LoaderBlock->ConfigurationRoot = PaToVa(LoaderBlock->ConfigurationRoot);
235
236 /* Convert all DTE into virtual addresses */
237 List_PaToVa(&LoaderBlock->LoadOrderListHead);
238
239 /* This one will be converted right before switching to virtual paging mode */
240 //List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
241
242 /* Convert list of boot drivers */
243 List_PaToVa(&LoaderBlock->BootDriverListHead);
244
245 Extension = LoaderBlock->Extension;
246
247 /* FIXME! HACK value for docking profile */
248 Extension->Profile.Status = 2;
249
250 /* Check if FreeLdr detected a ACPI table */
251 if (AcpiPresent)
252 {
253 /* Set the pointer to something for compatibility */
254 Extension->AcpiTable = (PVOID)1;
255 // FIXME: Extension->AcpiTableSize;
256 }
257
258#ifdef _M_IX86
259 /* Set headless block pointer */
261 {
262 Extension->HeadlessLoaderBlock = &WinLdrSystemBlock->HeadlessLoaderBlock;
263 RtlCopyMemory(Extension->HeadlessLoaderBlock,
265 sizeof(HEADLESS_LOADER_BLOCK));
266 Extension->HeadlessLoaderBlock = PaToVa(Extension->HeadlessLoaderBlock);
267 }
268#endif
269 /* Load drivers database */
270 RtlStringCbCopyA(MiscFiles, sizeof(MiscFiles), BootPath);
271 RtlStringCbCatA(MiscFiles, sizeof(MiscFiles), "AppPatch\\drvmain.sdb");
272 Extension->DrvDBImage = PaToVa(WinLdrLoadModule(MiscFiles,
273 &Extension->DrvDBSize,
275
276 /* Convert the extension block pointer */
277 LoaderBlock->Extension = PaToVa(LoaderBlock->Extension);
278
279 TRACE("WinLdrInitializePhase1() completed\n");
280}
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
Definition: conversion.c:51
#define InsertTailList(ListHead, Entry)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry)
LIST_ENTRY DiskSignatureListHead
Definition: arc.h:268
CHAR ArcName[MAX_PATH]
Definition: winldr.h:37
ARC_DISK_SIGNATURE DiskSignature
Definition: winldr.h:36
LIST_ENTRY ListEntry
Definition: arc.h:255
PCHAR ArcName
Definition: arc.h:257
PCONFIGURATION_COMPONENT_DATA ConfigurationRoot
Definition: arc.h:549
PARC_DISK_INFORMATION ArcDiskInformation
Definition: arc.h:556
PSTR ArcBootDeviceName
Definition: arc.h:550
struct _SETUP_LOADER_BLOCK * SetupLdrBlock
Definition: arc.h:558
CHAR NtHalPathName[MAX_PATH+1]
Definition: winldr.h:59
ARC_DISK_INFORMATION ArcDiskInformation
Definition: winldr.h:60
CHAR NtBootPathName[MAX_PATH+1]
Definition: winldr.h:58
CHAR ArcBootDeviceName[MAX_PATH+1]
Definition: winldr.h:56
CHAR LoadOptions[MAX_OPTIONS_LENGTH+1]
Definition: winldr.h:55
PCHAR ArcSetupDeviceName
Definition: setupblk.h:112
char * PSTR
Definition: typedefs.h:51
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[]
Definition: archwsup.c:69
BOOLEAN AcpiPresent
Definition: macharm.c:22
ULONG reactos_disk_count
Definition: archwsup.c:68
HEADLESS_LOADER_BLOCK LoaderRedirectionInformation
Definition: headless.c:30
BOOLEAN WinLdrTerminalConnected
Definition: headless.c:31

Referenced by LoadAndBootWindowsCommon().

◆ WinLdrLoadBootDrivers()

BOOLEAN WinLdrLoadBootDrivers ( PLOADER_PARAMETER_BLOCK  LoaderBlock,
PCSTR  BootPath 
)

Definition at line 367 of file winldr.c.

369{
370 PLIST_ENTRY NextBd;
371 PBOOT_DRIVER_NODE DriverNode;
372 PBOOT_DRIVER_LIST_ENTRY BootDriver;
374 BOOLEAN ret = TRUE;
375
376 /* Walk through the boot drivers list */
377 NextBd = LoaderBlock->BootDriverListHead.Flink;
378 while (NextBd != &LoaderBlock->BootDriverListHead)
379 {
380 DriverNode = CONTAINING_RECORD(NextBd,
382 ListEntry.Link);
383 BootDriver = &DriverNode->ListEntry;
384
385 /* Get the next list entry as we may remove the current one on failure */
386 NextBd = BootDriver->Link.Flink;
387
388 TRACE("BootDriver %wZ DTE %08X RegPath: %wZ\n",
389 &BootDriver->FilePath, BootDriver->LdrEntry,
390 &BootDriver->RegistryPath);
391
392 // Paths are relative (FIXME: Are they always relative?)
393
394 /* Load it */
397 BootPath,
398 &BootDriver->FilePath,
399 0,
400 &BootDriver->LdrEntry);
401 if (Success)
402 {
403 /* Convert the addresses to VA since we are not going to use them anymore */
404 BootDriver->RegistryPath.Buffer = PaToVa(BootDriver->RegistryPath.Buffer);
405 BootDriver->FilePath.Buffer = PaToVa(BootDriver->FilePath.Buffer);
406 BootDriver->LdrEntry = PaToVa(BootDriver->LdrEntry);
407
408 if (DriverNode->Group.Buffer)
409 DriverNode->Group.Buffer = PaToVa(DriverNode->Group.Buffer);
410 DriverNode->Name.Buffer = PaToVa(DriverNode->Name.Buffer);
411 }
412 else
413 {
414 /* Loading failed: cry loudly */
415 ERR("Cannot load boot driver '%wZ'!\n", &BootDriver->FilePath);
416 UiMessageBox("Cannot load boot driver '%wZ'!", &BootDriver->FilePath);
417 ret = FALSE;
418
419 /* Remove it from the list and try to continue */
420 RemoveEntryList(&BootDriver->Link);
421 }
422 }
423
424 return ret;
425}
VOID UiIndicateProgress(VOID)
Definition: ui.c:418
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
Definition: arc.h:246
LIST_ENTRY Link
Definition: arc.h:247
UNICODE_STRING RegistryPath
Definition: arc.h:249
UNICODE_STRING FilePath
Definition: arc.h:248
struct _LDR_DATA_TABLE_ENTRY * LdrEntry
Definition: arc.h:250
UNICODE_STRING Group
Definition: cmboot.h:16
BOOT_DRIVER_LIST_ENTRY ListEntry
Definition: cmboot.h:15
UNICODE_STRING Name
Definition: cmboot.h:17
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
int ret
static BOOLEAN WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead, PCSTR BootPath, PUNICODE_STRING FilePath, ULONG Flags, PLDR_DATA_TABLE_ENTRY *DriverDTE)
Definition: winldr.c:283

Referenced by LoadAndBootWindowsCommon().

◆ WinLdrLoadDeviceDriver()

static BOOLEAN WinLdrLoadDeviceDriver ( PLIST_ENTRY  LoadOrderListHead,
PCSTR  BootPath,
PUNICODE_STRING  FilePath,
ULONG  Flags,
PLDR_DATA_TABLE_ENTRY DriverDTE 
)
static

Definition at line 283 of file winldr.c.

288{
289 CHAR FullPath[1024];
290 CHAR DriverPath[1024];
291 CHAR DllName[1024];
292 PCHAR DriverNamePos;
294 PVOID DriverBase = NULL;
295
296 // Separate the path to file name and directory path
297 RtlStringCbPrintfA(DriverPath, sizeof(DriverPath), "%wZ", FilePath);
298 DriverNamePos = strrchr(DriverPath, '\\');
299 if (DriverNamePos != NULL)
300 {
301 // Copy the name
302 RtlStringCbCopyA(DllName, sizeof(DllName), DriverNamePos+1);
303
304 // Cut out the name from the path
305 *(DriverNamePos+1) = ANSI_NULL;
306 }
307 else
308 {
309 // There is no directory in the path
310 RtlStringCbCopyA(DllName, sizeof(DllName), DriverPath);
311 *DriverPath = ANSI_NULL;
312 }
313
314 TRACE("DriverPath: '%s', DllName: '%s', LPB\n", DriverPath, DllName);
315
316 // Check if driver is already loaded
317 Success = PeLdrCheckForLoadedDll(LoadOrderListHead, DllName, DriverDTE);
318 if (Success)
319 {
320 // We've got the pointer to its DTE, just return success
321 return TRUE;
322 }
323
324 // It's not loaded, we have to load it
325 RtlStringCbPrintfA(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
326
327 NtLdrOutputLoadMsg(FullPath, NULL);
328 Success = PeLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
329 if (!Success)
330 {
331 ERR("PeLdrLoadImage('%s') failed\n", DllName);
332 return FALSE;
333 }
334
335 // Allocate a DTE for it
336 Success = PeLdrAllocateDataTableEntry(LoadOrderListHead, DllName, DllName, DriverBase, DriverDTE);
337 if (!Success)
338 {
339 /* Cleanup and bail out */
340 ERR("PeLdrAllocateDataTableEntry('%s') failed\n", DllName);
341 MmFreeMemory(DriverBase);
342 return FALSE;
343 }
344
345 /* Init security cookie */
346 PeLdrInitSecurityCookie(*DriverDTE);
347
348 // Modify any flags, if needed
349 (*DriverDTE)->Flags |= Flags;
350
351 // Look for any dependencies it may have, and load them too
352 RtlStringCbPrintfA(FullPath, sizeof(FullPath), "%s%s", BootPath, DriverPath);
353 Success = PeLdrScanImportDescriptorTable(LoadOrderListHead, FullPath, *DriverDTE);
354 if (!Success)
355 {
356 /* Cleanup and bail out */
357 ERR("PeLdrScanImportDescriptorTable('%s') failed\n", FullPath);
358 PeLdrFreeDataTableEntry(*DriverDTE);
359 MmFreeMemory(DriverBase);
360 return FALSE;
361 }
362
363 return TRUE;
364}
BOOLEAN PeLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead, IN PCH DllName, OUT PLDR_DATA_TABLE_ENTRY *LoadedEntry)
Definition: peloader.c:561
@ LoaderBootDriver
Definition: arc.h:185
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by WinLdrLoadBootDrivers().

◆ WinLdrLoadModule()

PVOID WinLdrLoadModule ( PCSTR  ModuleName,
PULONG  Size,
TYPE_OF_MEMORY  MemoryType 
)

Definition at line 428 of file winldr.c.

431{
432 ULONG FileId;
433 PVOID PhysicalBase;
438
439 *Size = 0;
440
441 /* Open the image file */
444 if (Status != ESUCCESS)
445 {
446 /* In case of errors, we just return, without complaining to the user */
447 WARN("Error while opening '%s', Status: %u\n", ModuleName, Status);
448 return NULL;
449 }
450
451 /* Retrieve its size */
453 if (Status != ESUCCESS)
454 {
455 ArcClose(FileId);
456 return NULL;
457 }
458 FileSize = FileInfo.EndingAddress.LowPart;
459 *Size = FileSize;
460
461 /* Allocate memory */
462 PhysicalBase = MmAllocateMemoryWithType(FileSize, MemoryType);
463 if (PhysicalBase == NULL)
464 {
465 ERR("Could not allocate memory for '%s'\n", ModuleName);
466 ArcClose(FileId);
467 return NULL;
468 }
469
470 /* Load the whole file */
471 Status = ArcRead(FileId, PhysicalBase, FileSize, &BytesRead);
472 ArcClose(FileId);
473 if (Status != ESUCCESS)
474 {
475 WARN("Error while reading '%s', Status: %u\n", ModuleName, Status);
476 return NULL;
477 }
478
479 TRACE("Loaded %s at 0x%x with size 0x%x\n", ModuleName, PhysicalBase, FileSize);
480
481 return PhysicalBase;
482}
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:1280
ARC_STATUS ArcClose(ULONG FileId)
Definition: fs.c:220
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: fs.c:252
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
Definition: fs.c:56
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:238
@ OpenReadOnly
Definition: arc.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870

Referenced by SetupLdrInitErrataInf(), WinLdrInitErrataInf(), and WinLdrInitializePhase1().

◆ WinLdrpDumpArcDisks()

VOID WinLdrpDumpArcDisks ( PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 1310 of file winldr.c.

1311{
1312 PLIST_ENTRY NextBd;
1313 PARC_DISK_SIGNATURE ArcDisk;
1314
1315 NextBd = LoaderBlock->ArcDiskInformation->DiskSignatureListHead.Flink;
1316
1317 while (NextBd != &LoaderBlock->ArcDiskInformation->DiskSignatureListHead)
1318 {
1319 ArcDisk = CONTAINING_RECORD(NextBd, ARC_DISK_SIGNATURE, ListEntry);
1320
1321 TRACE("ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
1322 ArcDisk->ArcName, ArcDisk->CheckSum, ArcDisk->Signature);
1323
1324 NextBd = ArcDisk->ListEntry.Flink;
1325 }
1326}
ULONG CheckSum
Definition: arc.h:258
ULONG Signature
Definition: arc.h:256

Referenced by LoadAndBootWindowsCommon().

◆ WinLdrpDumpBootDriver()

VOID WinLdrpDumpBootDriver ( PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 1291 of file winldr.c.

1292{
1293 PLIST_ENTRY NextBd;
1294 PBOOT_DRIVER_LIST_ENTRY BootDriver;
1295
1296 NextBd = LoaderBlock->BootDriverListHead.Flink;
1297
1298 while (NextBd != &LoaderBlock->BootDriverListHead)
1299 {
1300 BootDriver = CONTAINING_RECORD(NextBd, BOOT_DRIVER_LIST_ENTRY, Link);
1301
1302 TRACE("BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
1303 BootDriver->LdrEntry, &BootDriver->RegistryPath);
1304
1305 NextBd = BootDriver->Link.Flink;
1306 }
1307}
static int Link(const char **args)
Definition: vfdcmd.c:2414

Referenced by LoadAndBootWindowsCommon().

◆ WinLdrpDumpMemoryDescriptors()

VOID WinLdrpDumpMemoryDescriptors ( PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 1272 of file winldr.c.

1273{
1274 PLIST_ENTRY NextMd;
1276
1277 NextMd = LoaderBlock->MemoryDescriptorListHead.Flink;
1278
1279 while (NextMd != &LoaderBlock->MemoryDescriptorListHead)
1280 {
1282
1283 TRACE("BP %08X PC %04X MT %d\n", MemoryDescriptor->BasePage,
1284 MemoryDescriptor->PageCount, MemoryDescriptor->MemoryType);
1285
1286 NextMd = MemoryDescriptor->ListEntry.Flink;
1287 }
1288}
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR MemoryDescriptor
Definition: wdfusb.h:1339

Referenced by LoadAndBootWindowsCommon(), and WinLdrSetupMemoryLayout().

◆ WinLdrSetupEms()

VOID WinLdrSetupEms ( IN PCSTR  BootOptions)

Definition at line 302 of file headless.c.

303{
304 PCSTR Option;
305
306 /* Start fresh */
309
310 /* Use a direction port if one was given, or use ACPI to detect one instead */
311 Option = NtLdrGetOption(BootOptions, "redirect=");
312 if (Option)
313 {
314 Option += 9;
315 if (_strnicmp(Option, "com", 3) == 0)
316 {
317 Option += 3;
320 }
321 else if (_strnicmp(Option, "usebiossettings", 15) == 0)
322 {
323 // FIXME: TODO!
324 UiDrawStatusText("ACPI SRT/SPCR Table Not Supported...");
325 return;
326 }
327 else
328 {
331 {
333 }
334 }
335 }
336
337 /* Use a direction baudrate if one was given */
338 Option = NtLdrGetOption(BootOptions, "redirectbaudrate=");
339 if (Option)
340 {
341 Option += 17;
342 // LoaderRedirectionInformation.BaudRate = atoi(Option);
343 if (strncmp(Option, "115200", 6) == 0)
344 {
346 }
347 else if (strncmp(Option, "57600", 5) == 0)
348 {
350 }
351 else if (strncmp(Option, "19200", 5) == 0)
352 {
354 }
355 else
356 {
358 }
359 }
360
361 /* Enable headless support if parameters were found */
363 {
365 {
367 }
368
370 }
371}
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
VOID WinLdrInitializeHeadlessPort(VOID)
Definition: headless.c:206
HEADLESS_LOADER_BLOCK LoaderRedirectionInformation
Definition: headless.c:30
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
PUCHAR PortAddress
Definition: arc.h:359
USHORT PciDeviceId
Definition: arc.h:360
UCHAR TerminalType
Definition: arc.h:368
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601

Referenced by LoadAndBootWindowsCommon().

Variable Documentation

◆ AcpiPresent

BOOLEAN AcpiPresent
extern

Definition at line 22 of file macharm.c.

Referenced by DetectAcpiBios(), and WinLdrInitializePhase1().

◆ BootFileSystem

PCWSTR BootFileSystem = NULL

◆ BootLogo

BOOLEAN BootLogo = FALSE

Definition at line 35 of file winldr.c.

Referenced by DisplayBootBitmap(), and LoadWindowsCore().

◆ LoaderPagesSpanned

ULONG LoaderPagesSpanned
extern

Definition at line 29 of file mm.c.

Referenced by LoadAndBootWindowsCommon().

◆ LoaderRedirectionInformation

HEADLESS_LOADER_BLOCK LoaderRedirectionInformation
extern

◆ NoExecuteEnabled

BOOLEAN NoExecuteEnabled = FALSE

Definition at line 39 of file winldr.c.

Referenced by LoadWindowsCore().

◆ reactos_arc_disk_info

ARC_DISK_SIGNATURE_EX reactos_arc_disk_info[]
extern

Definition at line 69 of file archwsup.c.

Referenced by AddReactOSArcDiskInfo(), and WinLdrInitializePhase1().

◆ reactos_disk_count

ULONG reactos_disk_count
extern

Definition at line 68 of file archwsup.c.

Referenced by AddReactOSArcDiskInfo(), and WinLdrInitializePhase1().

◆ SafeBoot

BOOLEAN SafeBoot = FALSE

Definition at line 34 of file winldr.c.

Referenced by LoadWindowsCore(), and Phase1InitializationDiscard().

◆ SosEnabled

BOOLEAN SosEnabled = FALSE

◆ VirtualBias

BOOLEAN VirtualBias = FALSE

Definition at line 32 of file winldr.c.

Referenced by LoadWindowsCore().

◆ WinLdrSystemBlock

◆ WinLdrTerminalConnected

BOOLEAN WinLdrTerminalConnected
extern

Definition at line 31 of file headless.c.

Referenced by WinLdrInitializeHeadlessPort(), and WinLdrInitializePhase1().