ReactOS 0.4.16-dev-2498-g8632030
winldr.h File Reference
#include <arc/setupblk.h>
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for winldr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RSDP_DESCRIPTOR
 
struct  _ARC_DISK_SIGNATURE_EX
 

Macros

#define TAG_WLDR_DTE   'eDlW'
 
#define TAG_WLDR_BDE   'dBlW'
 
#define TAG_WLDR_NAME   'mNlW'
 

Typedefs

typedef struct RSDP_DESCRIPTORPRSDP_DESCRIPTOR
 
typedef struct _ARC_DISK_SIGNATURE_EX ARC_DISK_SIGNATURE_EX
 
typedef struct _ARC_DISK_SIGNATURE_EXPARC_DISK_SIGNATURE_EX
 

Functions

ARC_STATUS LoadAndBootWindows (IN ULONG Argc, IN PCHAR Argv[], IN PCHAR Envp[])
 
ARC_STATUS LoadReactOSSetup (IN ULONG Argc, IN PCHAR Argv[], IN PCHAR Envp[])
 
PVOID VaToPa (PVOID Va)
 
PVOID PaToVa (PVOID Pa)
 
VOID List_PaToVa (_In_ LIST_ENTRY *ListEntry)
 

Macro Definition Documentation

◆ TAG_WLDR_BDE

#define TAG_WLDR_BDE   'dBlW'

Definition at line 14 of file winldr.h.

◆ TAG_WLDR_DTE

#define TAG_WLDR_DTE   'eDlW'

Definition at line 13 of file winldr.h.

◆ TAG_WLDR_NAME

#define TAG_WLDR_NAME   'mNlW'

Definition at line 15 of file winldr.h.

Typedef Documentation

◆ ARC_DISK_SIGNATURE_EX

◆ PARC_DISK_SIGNATURE_EX

◆ PRSDP_DESCRIPTOR

Function Documentation

◆ List_PaToVa()

VOID List_PaToVa ( _In_ LIST_ENTRY ListEntry)

◆ LoadAndBootWindows()

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

Definition at line 1139 of file winldr.c.

1143{
1145 PCSTR ArgValue;
1150 USHORT OperatingSystemVersion;
1151 PLOADER_PARAMETER_BLOCK LoaderBlock;
1152 CHAR BootPath[MAX_PATH];
1154 CHAR BootOptions[256];
1155
1156 /* Retrieve the (mandatory) boot type */
1157 ArgValue = GetArgumentValue(Argc, Argv, "BootType");
1158 if (!ArgValue || !*ArgValue)
1159 {
1160 ERR("No 'BootType' value, aborting!\n");
1161 return EINVAL;
1162 }
1163
1164 /* Convert it to an OS version */
1165 if (_stricmp(ArgValue, "Windows") == 0 ||
1166 _stricmp(ArgValue, "Windows2003") == 0)
1167 {
1168 OperatingSystemVersion = _WIN32_WINNT_WS03;
1169 }
1170 else if (_stricmp(ArgValue, "WindowsNT40") == 0)
1171 {
1172 OperatingSystemVersion = _WIN32_WINNT_NT4;
1173 }
1174 else if (_stricmp(ArgValue, "WindowsVista") == 0)
1175 {
1176 OperatingSystemVersion = _WIN32_WINNT_VISTA;
1177 }
1178 else
1179 {
1180 ERR("Unknown 'BootType' value '%s', aborting!\n", ArgValue);
1181 return EINVAL;
1182 }
1183
1184 /* Retrieve the (mandatory) system partition */
1185 SystemPartition = GetArgumentValue(Argc, Argv, "SystemPartition");
1187 {
1188 ERR("No 'SystemPartition' specified, aborting!\n");
1189 return EINVAL;
1190 }
1191
1192 /* Let the user know we started loading */
1194 UiDrawStatusText("Loading...");
1195 UiDrawProgressBarCenter("Loading NT...");
1196
1197 /* Retrieve the system path */
1198 *BootPath = ANSI_NULL;
1199 ArgValue = GetArgumentValue(Argc, Argv, "SystemPath");
1200 if (ArgValue)
1201 RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
1202
1203 /*
1204 * Check whether BootPath is a full path
1205 * and if not, create a full boot path.
1206 *
1207 * See FsOpenFile for the technique used.
1208 */
1209 if (strrchr(BootPath, ')') == NULL)
1210 {
1211 /* Temporarily save the boot path */
1212 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
1213
1214 /* This is not a full path: prepend the SystemPartition */
1215 RtlStringCbCopyA(BootPath, sizeof(BootPath), SystemPartition);
1216
1217 /* Append a path separator if needed */
1218 if (*FilePath != '\\' && *FilePath != '/')
1219 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1220
1221 /* Append the remaining path */
1222 RtlStringCbCatA(BootPath, sizeof(BootPath), FilePath);
1223 }
1224
1225 /* Append a path separator if needed */
1226 if (!*BootPath || BootPath[strlen(BootPath) - 1] != '\\')
1227 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1228
1229 TRACE("BootPath: '%s'\n", BootPath);
1230
1231 /* Retrieve the boot options */
1232 *BootOptions = ANSI_NULL;
1233 ArgValue = GetArgumentValue(Argc, Argv, "Options");
1234 if (ArgValue && *ArgValue)
1235 RtlStringCbCopyA(BootOptions, sizeof(BootOptions), ArgValue);
1236
1237 /* Append boot-time options */
1238 AppendBootTimeOptions(BootOptions);
1239
1240 /*
1241 * Set the "/HAL=" and "/KERNEL=" options if needed.
1242 * If already present on the standard "Options=" option line, they take
1243 * precedence over those passed via the separate "Hal=" and "Kernel="
1244 * options.
1245 */
1246 if (!NtLdrGetOption(BootOptions, "HAL="))
1247 {
1248 /*
1249 * Not found in the options, try to retrieve the
1250 * separate value and append it to the options.
1251 */
1252 ArgValue = GetArgumentValue(Argc, Argv, "Hal");
1253 if (ArgValue && *ArgValue)
1254 {
1255 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /HAL=");
1256 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1257 }
1258 }
1259 if (!NtLdrGetOption(BootOptions, "KERNEL="))
1260 {
1261 /*
1262 * Not found in the options, try to retrieve the
1263 * separate value and append it to the options.
1264 */
1265 ArgValue = GetArgumentValue(Argc, Argv, "Kernel");
1266 if (ArgValue && *ArgValue)
1267 {
1268 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /KERNEL=");
1269 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1270 }
1271 }
1272
1273 TRACE("BootOptions: '%s'\n", BootOptions);
1274
1275 /* Check if a RAM disk file was given */
1276 FileName = NtLdrGetOptionEx(BootOptions, "RDPATH=", &FileNameLength);
1277 if (FileName && (FileNameLength >= 7))
1278 {
1279 /* Load the RAM disk */
1281 if (Status != ESUCCESS)
1282 {
1283 FileName += 7; FileNameLength -= 7;
1284 UiMessageBox("Failed to load RAM disk file '%.*s'",
1286 return Status;
1287 }
1288 }
1289
1290 /* Handle the SOS option */
1291 SosEnabled = !!NtLdrGetOption(BootOptions, "SOS");
1292 if (SosEnabled)
1293 UiResetForSOS();
1294
1295 /* Allocate and minimally-initialize the Loader Parameter Block */
1296 AllocateAndInitLPB(OperatingSystemVersion, &LoaderBlock);
1297
1298 /* Load the system hive */
1299 UiUpdateProgressBar(15, "Loading system hive...");
1300 Success = WinLdrInitSystemHive(LoaderBlock, BootPath, FALSE);
1301 TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
1302 /* Bail out if failure */
1303 if (!Success)
1304 return ENOEXEC;
1305
1306 /* Fixup the version number using data from the registry */
1307 if (OperatingSystemVersion == 0)
1308 OperatingSystemVersion = WinLdrDetectVersion();
1309 LoaderBlock->Extension->MajorVersion = (OperatingSystemVersion & 0xFF00) >> 8;
1310 LoaderBlock->Extension->MinorVersion = (OperatingSystemVersion & 0xFF);
1311
1312 /* Load NLS data, OEM font, and prepare boot drivers list */
1313 Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
1314 TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not scanned"));
1315 /* Bail out if failure */
1316 if (!Success)
1317 return ENOEXEC;
1318
1319 /* Load the Firmware Errata file */
1320 Success = WinLdrInitErrataInf(LoaderBlock, OperatingSystemVersion, BootPath);
1321 TRACE("Firmware Errata file %s\n", (Success ? "loaded" : "not loaded"));
1322 /* Not necessarily fatal if not found - carry on going */
1323
1324 /* Finish loading */
1325 return LoadAndBootWindowsCommon(OperatingSystemVersion,
1326 LoaderBlock,
1327 BootOptions,
1328 BootPath);
1329}
PCWSTR FilePath
unsigned char BOOLEAN
Definition: actypes.h:127
PSTR GetArgumentValue(_In_ ULONG Argc, _In_ PCHAR Argv[], _In_ PCSTR ArgumentName)
Definition: arcsupp.c:42
PPARTENTRY SystemPartition
Definition: reactos.c:50
#define ERR(fmt,...)
Definition: precomp.h:57
ARC_STATUS RamDiskInitialize(IN BOOLEAN InitRamDisk, IN PCSTR LoadOptions OPTIONAL, IN PCSTR DefaultPath OPTIONAL)
Definition: ramdisk.c:229
VOID AppendBootTimeOptions(PCHAR BootOptions)
Definition: options.c:244
VOID UiDrawBackdrop(ULONG DrawHeight)
Definition: ui.c:233
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:454
ULONG UiGetScreenHeight(VOID)
Definition: ui.c:655
VOID UiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: ui.c:487
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:286
VOID UiResetForSOS(VOID)
Definition: ui.c:639
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define _stricmp
Definition: cat.c:22
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
#define EINVAL
Definition: errno.h:44
#define ENOEXEC
Definition: errno.h:31
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3298
@ Success
Definition: eventcreate.c:712
struct _FileName FileName
Definition: fatprocs.h:897
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
Definition: fltkernel.h:1129
Status
Definition: gdiplustypes.h:25
#define ANSI_NULL
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
@ 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 _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define TRACE(s)
Definition: solgame.cpp:4
PLOADER_PARAMETER_EXTENSION Extension
Definition: arc.h:857
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
ARC_STATUS LoadAndBootWindowsCommon(IN USHORT OperatingSystemVersion, IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath)
Definition: winldr.c:1332
USHORT WinLdrDetectVersion(VOID)
Definition: winldr.c:500
static BOOLEAN WinLdrInitErrataInf(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN USHORT OperatingSystemVersion, IN PCSTR SystemRoot)
Definition: winldr.c:1079
BOOLEAN SosEnabled
Definition: winldr.c:34
VOID AllocateAndInitLPB(IN USHORT VersionToBoot, OUT PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
Definition: winldr.c:80
char CHAR
Definition: xmlstorage.h:175

◆ LoadReactOSSetup()

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

Definition at line 492 of file setupldr.c.

496{
498 PCSTR ArgValue;
500 PCSTR SystemPath;
503 BOOLEAN BootFromFloppy;
505 HINF InfHandle;
506 INFCONTEXT InfContext;
507 ULONG i, ErrorLine;
508 PLOADER_PARAMETER_BLOCK LoaderBlock;
509 PSETUP_LOADER_BLOCK SetupBlock;
510 CHAR BootPath[MAX_PATH];
512 CHAR UserBootOptions[256];
513 PCSTR BootOptions;
514
515 static PCSTR SourcePaths[] =
516 {
517 "", /* Only for floppy boot */
518#if defined(_M_IX86)
519 "I386\\",
520#elif defined(_M_MPPC)
521 "PPC\\",
522#elif defined(_M_MRX000)
523 "MIPS\\",
524#endif
525 "reactos\\",
526 NULL
527 };
528
529 /* Retrieve the (mandatory) boot type */
530 ArgValue = GetArgumentValue(Argc, Argv, "BootType");
531 if (!ArgValue || !*ArgValue)
532 {
533 ERR("No 'BootType' value, aborting!\n");
534 return EINVAL;
535 }
536 if (_stricmp(ArgValue, "ReactOSSetup") != 0)
537 {
538 ERR("Unknown 'BootType' value '%s', aborting!\n", ArgValue);
539 return EINVAL;
540 }
541
542 /* Retrieve the (mandatory) system partition */
543 SystemPartition = GetArgumentValue(Argc, Argv, "SystemPartition");
545 {
546 ERR("No 'SystemPartition' specified, aborting!\n");
547 return EINVAL;
548 }
549
550 /* Let the user know we started loading */
552 UiDrawStatusText("Setup is loading...");
553 UiDrawProgressBarCenter("Loading ReactOS Setup...");
554
555 /* Retrieve the system path */
556 *BootPath = ANSI_NULL;
557 ArgValue = GetArgumentValue(Argc, Argv, "SystemPath");
558 if (ArgValue)
559 {
560 RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
561 }
562 else
563 {
564 /*
565 * IMPROVE: I don't want to use the SystemPartition here as a
566 * default choice because I can do it after (see few lines below).
567 * Instead I reset BootPath here so that we can build the full path
568 * using the general code from below.
569 */
570 // RtlStringCbCopyA(BootPath, sizeof(BootPath), SystemPartition);
571 *BootPath = ANSI_NULL;
572 }
573
574 /*
575 * Check whether BootPath is a full path
576 * and if not, create a full boot path.
577 *
578 * See FsOpenFile for the technique used.
579 */
580 if (strrchr(BootPath, ')') == NULL)
581 {
582 /* Temporarily save the boot path */
583 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
584
585 /* This is not a full path: prepend the SystemPartition */
586 RtlStringCbCopyA(BootPath, sizeof(BootPath), SystemPartition);
587
588 /* Append a path separator if needed */
589 if (*FilePath != '\\' && *FilePath != '/')
590 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
591
592 /* Append the remaining path */
593 RtlStringCbCatA(BootPath, sizeof(BootPath), FilePath);
594 }
595
596 /* Append a path separator if needed */
597 if (!*BootPath || BootPath[strlen(BootPath) - 1] != '\\')
598 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
599
600 TRACE("BootPath: '%s'\n", BootPath);
601
602 /*
603 * Retrieve the boot options. Any options present here will supplement or
604 * override those that will be specified in TXTSETUP.SIF's OsLoadOptions.
605 */
606 BootOptions = GetArgumentValue(Argc, Argv, "Options");
607 if (!BootOptions)
608 BootOptions = "";
609
610 TRACE("BootOptions: '%s'\n", BootOptions);
611
612 /* Check if a RAM disk file was given */
613 FileName = (PSTR)NtLdrGetOptionEx(BootOptions, "RDPATH=", &FileNameLength);
614 if (FileName && (FileNameLength >= 7))
615 {
616 /* Load the RAM disk */
618 if (Status != ESUCCESS)
619 {
620 FileName += 7; FileNameLength -= 7;
621 UiMessageBox("Failed to load RAM disk file '%.*s'",
623 return Status;
624 }
625 }
626
627 /* Check if we booted from floppy */
628 BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
629
630 /* Open 'txtsetup.sif' from any of the source paths */
631 FileName = BootPath + strlen(BootPath);
632 for (i = BootFromFloppy ? 0 : 1; ; i++)
633 {
634 SystemPath = SourcePaths[i];
635 if (!SystemPath)
636 {
637 UiMessageBox("Failed to open txtsetup.sif");
638 return ENOENT;
639 }
640 FileNameLength = (ULONG)(sizeof(BootPath) - (FileName - BootPath)*sizeof(CHAR));
642 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
643 RtlStringCbCatA(FilePath, sizeof(FilePath), "txtsetup.sif");
644 if (InfOpenFile(&InfHandle, FilePath, &ErrorLine))
645 {
646 break;
647 }
648 }
649
650 TRACE("BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
651
652 // UseLocalSif = NtLdrGetOption(BootOptions, "USELOCALSIF");
653
654 if (NtLdrGetOption(BootOptions, "SIFOPTIONSOVERRIDE"))
655 {
656 PCSTR OptionsToRemove[2] = {"SIFOPTIONSOVERRIDE", NULL};
657
658 /* Do not use any load options from TXTSETUP.SIF, but
659 * use instead those passed from the command line. */
660 RtlStringCbCopyA(UserBootOptions, sizeof(UserBootOptions), BootOptions);
661
662 /* Remove the private switch from the options */
663 NtLdrUpdateLoadOptions(UserBootOptions,
664 sizeof(UserBootOptions),
665 FALSE,
666 NULL,
667 OptionsToRemove);
668
669 BootOptions = UserBootOptions;
670 }
671 else // if (!*BootOptions || NtLdrGetOption(BootOptions, "SIFOPTIONSADD"))
672 {
673 PCSTR LoadOptions = NULL;
674 PCSTR DbgLoadOptions = NULL;
675 PSTR ExtraOptions, HigherPriorityOptions;
676 PSTR OptionsToAdd[3];
677 PSTR OptionsToRemove[4];
678
679 /* Load the options from TXTSETUP.SIF */
680 if (InfFindFirstLine(InfHandle, "SetupData", "OsLoadOptions", &InfContext))
681 {
682 if (!InfGetDataField(&InfContext, 1, &LoadOptions))
683 WARN("Failed to get load options\n");
684 }
685
686#if !DBG
687 /* Non-debug mode: get the debug load options only if /DEBUG was specified
688 * in the Argv command-line options (was e.g. added to the options when
689 * the user selected "Debugging Mode" in the advanced boot menu). */
690 if (NtLdrGetOption(BootOptions, "DEBUG") ||
691 NtLdrGetOption(BootOptions, "DEBUG="))
692 {
693#else
694 /* Debug mode: always get the debug load options */
695#endif
696 if (InfFindFirstLine(InfHandle, "SetupData", "SetupDebugOptions", &InfContext))
697 {
698 if (!InfGetDataField(&InfContext, 1, &DbgLoadOptions))
699 WARN("Failed to get debug load options\n");
700 }
701 /* If none was found, default to enabling debugging */
702 if (!DbgLoadOptions)
703 DbgLoadOptions = "/DEBUG";
704#if !DBG
705 }
706#endif
707
708 /* Initialize the load options with those from TXTSETUP.SIF */
709 *UserBootOptions = ANSI_NULL;
710 if (LoadOptions && *LoadOptions)
711 RtlStringCbCopyA(UserBootOptions, sizeof(UserBootOptions), LoadOptions);
712
713 /* Merge the debug load options if any */
714 if (DbgLoadOptions)
715 {
716 RtlZeroMemory(OptionsToAdd, sizeof(OptionsToAdd));
717 RtlZeroMemory(OptionsToRemove, sizeof(OptionsToRemove));
718
719 /*
720 * Retrieve any option patterns that we should remove from the
721 * SIF load options because they are of higher precedence than
722 * those specified in the debug load options to be added.
723 * Also always remove NODEBUG (even if the debug load options
724 * do not contain explicitly the DEBUG option), since we want
725 * to have debugging enabled if possible.
726 */
727 OptionsToRemove[0] = "/NODEBUG";
728 NtLdrGetHigherPriorityOptions(DbgLoadOptions,
730 &HigherPriorityOptions);
731 OptionsToAdd[1] = (ExtraOptions ? ExtraOptions : "");
732 OptionsToRemove[1] = (HigherPriorityOptions ? HigherPriorityOptions : "");
733
734 /*
735 * Prepend the debug load options, so that in case it contains
736 * redundant options with respect to the SIF load options, the
737 * former can take precedence over the latter.
738 */
739 OptionsToAdd[0] = (PSTR)DbgLoadOptions;
740 OptionsToRemove[2] = (PSTR)DbgLoadOptions;
741 NtLdrUpdateLoadOptions(UserBootOptions,
742 sizeof(UserBootOptions),
743 FALSE,
744 (PCSTR*)OptionsToAdd,
745 (PCSTR*)OptionsToRemove);
746
747 if (ExtraOptions)
749 if (HigherPriorityOptions)
750 FrLdrHeapFree(HigherPriorityOptions, TAG_BOOT_OPTIONS);
751 }
752
753 RtlZeroMemory(OptionsToAdd, sizeof(OptionsToAdd));
754 RtlZeroMemory(OptionsToRemove, sizeof(OptionsToRemove));
755
756 /*
757 * Retrieve any option patterns that we should remove from the
758 * SIF load options because they are of higher precedence than
759 * those specified in the options to be added.
760 */
763 &HigherPriorityOptions);
764 OptionsToAdd[1] = (ExtraOptions ? ExtraOptions : "");
765 OptionsToRemove[0] = (HigherPriorityOptions ? HigherPriorityOptions : "");
766
767 /* Finally, prepend the user-specified options that
768 * take precedence over those from TXTSETUP.SIF. */
769 OptionsToAdd[0] = (PSTR)BootOptions;
770 OptionsToRemove[1] = (PSTR)BootOptions;
771 NtLdrUpdateLoadOptions(UserBootOptions,
772 sizeof(UserBootOptions),
773 FALSE,
774 (PCSTR*)OptionsToAdd,
775 (PCSTR*)OptionsToRemove);
776
777 if (ExtraOptions)
779 if (HigherPriorityOptions)
780 FrLdrHeapFree(HigherPriorityOptions, TAG_BOOT_OPTIONS);
781
782 BootOptions = UserBootOptions;
783 }
784
785 TRACE("BootOptions: '%s'\n", BootOptions);
786
787 /* Handle the SOS option */
788 SosEnabled = !!NtLdrGetOption(BootOptions, "SOS");
789 if (SosEnabled)
791
792 /* Allocate and minimally-initialize the Loader Parameter Block */
794
795 /* Allocate and initialize the setup loader block */
796 SetupBlock = &WinLdrSystemBlock->SetupBlock;
797 LoaderBlock->SetupLdrBlock = SetupBlock;
798
799 /* Set textmode setup flag */
800 SetupBlock->Flags = SETUPLDR_TEXT_MODE;
801
802 /* Load the "setupreg.hiv" setup system hive */
803 UiUpdateProgressBar(15, "Loading setup system hive...");
804 Success = WinLdrInitSystemHive(LoaderBlock, BootPath, TRUE);
805 TRACE("Setup SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
806 /* Bail out if failure */
807 if (!Success)
808 return ENOEXEC;
809
810 /* Load NLS data, they are in the System32 directory of the installation medium */
811 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
812 RtlStringCbCatA(FilePath, sizeof(FilePath), "system32\\");
813 SetupLdrLoadNlsData(LoaderBlock, InfHandle, FilePath);
814
815 /* Load the Firmware Errata file from the installation medium */
816 Success = SetupLdrInitErrataInf(LoaderBlock, InfHandle, BootPath);
817 TRACE("Firmware Errata file %s\n", (Success ? "loaded" : "not loaded"));
818 /* Not necessarily fatal if not found - carry on going */
819
820 // UiDrawStatusText("Press F6 if you need to install a 3rd-party SCSI or RAID driver...");
821
822 /* Get a list of boot drivers */
823 SetupLdrScanBootDrivers(&LoaderBlock->BootDriverListHead, InfHandle, BootPath);
824
825 /* Close the inf file */
826 InfCloseFile(InfHandle);
827
828 UiDrawStatusText("The Setup program is starting...");
829
830 /* Finish loading */
832 LoaderBlock,
833 BootOptions,
834 BootPath);
835}
#define WARN(fmt,...)
Definition: precomp.h:61
VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: heap.c:539
#define TRUE
Definition: types.h:120
#define ENOENT
Definition: errno.h:25
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3415
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
BOOLEAN InfFindFirstLine(HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context)
Definition: inffile.c:1050
BOOLEAN InfOpenFile(PHINF InfHandle, PCSTR FileName, PULONG ErrorLine)
Definition: inffile.c:918
#define SETUPLDR_TEXT_MODE
Definition: setupblk.h:7
VOID NtLdrUpdateLoadOptions(IN OUT PSTR LoadOptions, IN ULONG BufferSize, IN BOOLEAN Append, IN PCSTR OptionsToAdd[] OPTIONAL, IN PCSTR OptionsToRemove[] OPTIONAL)
Definition: setupldr.c:258
static VOID SetupLdrLoadNlsData(_Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ HINF InfHandle, _In_ PCSTR SearchPath)
Definition: setupldr.c:36
static VOID SetupLdrScanBootDrivers(_Inout_ PLIST_ENTRY BootDriverListHead, _In_ HINF InfHandle, _In_ PCSTR SearchPath)
Definition: setupldr.c:149
PCSTR ExtraOptions
Definition: setupldr.c:353
VOID NtLdrGetHigherPriorityOptions(IN PCSTR BootOptions, OUT PSTR *ExtraOptions, OUT PSTR *HigherPriorityOptions)
Definition: setupldr.c:382
#define TAG_BOOT_OPTIONS
Definition: setupldr.c:379
static BOOLEAN SetupLdrInitErrataInf(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN HINF InfHandle, IN PCSTR SystemRoot)
Definition: setupldr.c:108
VOID AllocateAndInitLPB(IN USHORT VersionToBoot, OUT PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
Definition: winldr.c:80
LIST_ENTRY BootDriverListHead
Definition: arc.h:822
SETUP_LOADER_BLOCK SetupBlock
Definition: winldr.h:50
char * PSTR
Definition: typedefs.h:51
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
BOOLEAN InfGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PWCHAR *Data)
Definition: infrosget.c:127
VOID InfCloseFile(HINF InfHandle)
Definition: inffile.c:1028
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock
Definition: winldr.c:30

◆ PaToVa()

◆ VaToPa()