ReactOS 0.4.15-dev-7958-gcd0bb1a
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 976 of file winldr.c.

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

◆ 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: debug.h:112
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
#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:79
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:29

◆ PaToVa()

◆ VaToPa()