ReactOS 0.4.16-dev-1527-g49e652b
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 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];
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 */
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 */
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,
834 BootPath);
835}
#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: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: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()