ReactOS 0.4.16-dev-1040-g85afe48
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 979 of file winldr.c.

983{
985 PCSTR ArgValue;
990 USHORT OperatingSystemVersion;
991 PLOADER_PARAMETER_BLOCK LoaderBlock;
992 CHAR BootPath[MAX_PATH];
994 CHAR BootOptions[256];
995
996 /* Retrieve the (mandatory) boot type */
997 ArgValue = GetArgumentValue(Argc, Argv, "BootType");
998 if (!ArgValue || !*ArgValue)
999 {
1000 ERR("No 'BootType' value, aborting!\n");
1001 return EINVAL;
1002 }
1003
1004 /* Convert it to an OS version */
1005 if (_stricmp(ArgValue, "Windows") == 0 ||
1006 _stricmp(ArgValue, "Windows2003") == 0)
1007 {
1008 OperatingSystemVersion = _WIN32_WINNT_WS03;
1009 }
1010 else if (_stricmp(ArgValue, "WindowsNT40") == 0)
1011 {
1012 OperatingSystemVersion = _WIN32_WINNT_NT4;
1013 }
1014 else if (_stricmp(ArgValue, "WindowsVista") == 0)
1015 {
1016 OperatingSystemVersion = _WIN32_WINNT_VISTA;
1017 }
1018 else
1019 {
1020 ERR("Unknown 'BootType' value '%s', aborting!\n", ArgValue);
1021 return EINVAL;
1022 }
1023
1024 /* Retrieve the (mandatory) system partition */
1025 SystemPartition = GetArgumentValue(Argc, Argv, "SystemPartition");
1027 {
1028 ERR("No 'SystemPartition' specified, aborting!\n");
1029 return EINVAL;
1030 }
1031
1032 /* Let the user know we started loading */
1034 UiDrawStatusText("Loading...");
1035 UiDrawProgressBarCenter("Loading NT...");
1036
1037 /* Retrieve the system path */
1038 *BootPath = ANSI_NULL;
1039 ArgValue = GetArgumentValue(Argc, Argv, "SystemPath");
1040 if (ArgValue)
1041 RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
1042
1043 /*
1044 * Check whether BootPath is a full path
1045 * and if not, create a full boot path.
1046 *
1047 * See FsOpenFile for the technique used.
1048 */
1049 if (strrchr(BootPath, ')') == NULL)
1050 {
1051 /* Temporarily save the boot path */
1052 RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
1053
1054 /* This is not a full path: prepend the SystemPartition */
1055 RtlStringCbCopyA(BootPath, sizeof(BootPath), SystemPartition);
1056
1057 /* Append a path separator if needed */
1058 if (*FilePath != '\\' && *FilePath != '/')
1059 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1060
1061 /* Append the remaining path */
1062 RtlStringCbCatA(BootPath, sizeof(BootPath), FilePath);
1063 }
1064
1065 /* Append a path separator if needed */
1066 if (!*BootPath || BootPath[strlen(BootPath) - 1] != '\\')
1067 RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
1068
1069 TRACE("BootPath: '%s'\n", BootPath);
1070
1071 /* Retrieve the boot options */
1073 ArgValue = GetArgumentValue(Argc, Argv, "Options");
1074 if (ArgValue && *ArgValue)
1075 RtlStringCbCopyA(BootOptions, sizeof(BootOptions), ArgValue);
1076
1077 /* Append boot-time options */
1079
1080 /*
1081 * Set the "/HAL=" and "/KERNEL=" options if needed.
1082 * If already present on the standard "Options=" option line, they take
1083 * precedence over those passed via the separate "Hal=" and "Kernel="
1084 * options.
1085 */
1086 if (!NtLdrGetOption(BootOptions, "HAL="))
1087 {
1088 /*
1089 * Not found in the options, try to retrieve the
1090 * separate value and append it to the options.
1091 */
1092 ArgValue = GetArgumentValue(Argc, Argv, "Hal");
1093 if (ArgValue && *ArgValue)
1094 {
1095 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /HAL=");
1096 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1097 }
1098 }
1099 if (!NtLdrGetOption(BootOptions, "KERNEL="))
1100 {
1101 /*
1102 * Not found in the options, try to retrieve the
1103 * separate value and append it to the options.
1104 */
1105 ArgValue = GetArgumentValue(Argc, Argv, "Kernel");
1106 if (ArgValue && *ArgValue)
1107 {
1108 RtlStringCbCatA(BootOptions, sizeof(BootOptions), " /KERNEL=");
1109 RtlStringCbCatA(BootOptions, sizeof(BootOptions), ArgValue);
1110 }
1111 }
1112
1113 TRACE("BootOptions: '%s'\n", BootOptions);
1114
1115 /* Check if a RAM disk file was given */
1117 if (FileName && (FileNameLength > 7))
1118 {
1119 /* Load the RAM disk */
1121 if (Status != ESUCCESS)
1122 {
1123 FileName += 7; FileNameLength -= 7;
1124 UiMessageBox("Failed to load RAM disk file '%.*s'",
1126 return Status;
1127 }
1128 }
1129
1130 /* Handle the SOS option */
1132 if (SosEnabled)
1133 UiResetForSOS();
1134
1135 /* Allocate and minimally-initialize the Loader Parameter Block */
1136 AllocateAndInitLPB(OperatingSystemVersion, &LoaderBlock);
1137
1138 /* Load the system hive */
1139 UiUpdateProgressBar(15, "Loading system hive...");
1140 Success = WinLdrInitSystemHive(LoaderBlock, BootPath, FALSE);
1141 TRACE("SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
1142 /* Bail out if failure */
1143 if (!Success)
1144 return ENOEXEC;
1145
1146 /* Fixup the version number using data from the registry */
1147 if (OperatingSystemVersion == 0)
1148 OperatingSystemVersion = WinLdrDetectVersion();
1149 LoaderBlock->Extension->MajorVersion = (OperatingSystemVersion & 0xFF00) >> 8;
1150 LoaderBlock->Extension->MinorVersion = (OperatingSystemVersion & 0xFF);
1151
1152 /* Load NLS data, OEM font, and prepare boot drivers list */
1153 Success = WinLdrScanSystemHive(LoaderBlock, BootPath);
1154 TRACE("SYSTEM hive %s\n", (Success ? "scanned" : "not scanned"));
1155 /* Bail out if failure */
1156 if (!Success)
1157 return ENOEXEC;
1158
1159 /* Load the Firmware Errata file */
1160 Success = WinLdrInitErrataInf(LoaderBlock, OperatingSystemVersion, BootPath);
1161 TRACE("Firmware Errata file %s\n", (Success ? "loaded" : "not loaded"));
1162 /* Not necessarily fatal if not found - carry on going */
1163
1164 /* Finish loading */
1165 return LoadAndBootWindowsCommon(OperatingSystemVersion,
1166 LoaderBlock,
1168 BootPath);
1169}
PCWSTR FilePath
unsigned char BOOLEAN
#define EINVAL
Definition: acclib.h:90
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
@ BootOptions
Definition: bl.h:898
ARC_STATUS RamDiskInitialize(IN BOOLEAN InitRamDisk, IN PCSTR LoadOptions OPTIONAL, IN PCSTR DefaultPath OPTIONAL)
Definition: ramdisk.c:206
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 ENOEXEC
Definition: errno.h:14
@ 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
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _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 _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define TRACE(s)
Definition: solgame.cpp:4
PLOADER_PARAMETER_EXTENSION Extension
Definition: arc.h:559
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:1172
USHORT WinLdrDetectVersion(VOID)
Definition: winldr.c:497
static BOOLEAN WinLdrInitErrataInf(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN USHORT OperatingSystemVersion, IN PCSTR SystemRoot)
Definition: winldr.c:919
BOOLEAN SosEnabled
Definition: winldr.c:31
VOID AllocateAndInitLPB(IN USHORT VersionToBoot, OUT PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
Definition: winldr.c:77
char CHAR
Definition: xmlstorage.h:175

◆ LoadReactOSSetup()

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

Definition at line 475 of file setupldr.c.

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

◆ PaToVa()

◆ VaToPa()