ReactOS  0.4.15-dev-5131-g311fcc6
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 961 of file winldr.c.

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

◆ 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;
484  PSTR FileName;
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 */
534  UiDrawBackdrop();
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,
712  &ExtraOptions,
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  */
745  &ExtraOptions,
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)
773  UiResetForSOS();
774 
775  /* Allocate and minimally-initialize the Loader Parameter Block */
776  AllocateAndInitLPB(_WIN32_WINNT_WS03, &LoaderBlock);
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,
816  BootOptions,
817  BootPath);
818 }
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:462
ARC_STATUS RamDiskInitialize(IN BOOLEAN InitRamDisk, IN PCSTR LoadOptions OPTIONAL, IN PCSTR DefaultPath OPTIONAL)
Definition: ramdisk.c:206
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
BOOLEAN SosEnabled
Definition: winldr.c:33
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
Definition: arc.h:32
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
PCSTR ExtraOptions
Definition: setupldr.c:336
Definition: arc.h:39
char CHAR
Definition: xmlstorage.h:175
#define WARN(fmt,...)
Definition: debug.h:112
ULONG ARC_STATUS
Definition: arc.h:4
VOID NtLdrUpdateLoadOptions(IN OUT PSTR LoadOptions, IN ULONG BufferSize, IN BOOLEAN Append, IN PCSTR OptionsToAdd[] OPTIONAL, IN PCSTR OptionsToRemove[] OPTIONAL)
Definition: setupldr.c:241
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static VOID SetupLdrScanBootDrivers(_Inout_ PLIST_ENTRY BootDriverListHead, _In_ HINF InfHandle, _In_ PCSTR SearchPath)
Definition: setupldr.c:138
#define _stricmp
Definition: cat.c:22
BOOLEAN InfGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PWCHAR *Data)
Definition: infrosget.c:127
PCWSTR FilePath
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
struct _SETUP_LOADER_BLOCK * SetupLdrBlock
Definition: arc.h:511
#define FALSE
Definition: types.h:117
#define ANSI_NULL
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:363
unsigned char BOOLEAN
VOID UiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: ui.c:503
ARC_STATUS LoadAndBootWindowsCommon(IN USHORT OperatingSystemVersion, IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR BootOptions, IN PCSTR BootPath)
Definition: winldr.c:1150
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:34
static VOID SetupLdrLoadNlsData(_Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ HINF InfHandle, _In_ PCSTR SearchPath)
Definition: setupldr.c:25
LIST_ENTRY BootDriverListHead
Definition: arc.h:495
static PPARTENTRY SystemPartition
Definition: usetup.c:61
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:292
VOID InfCloseFile(HINF InfHandle)
Definition: inffile.c:1028
VOID UiDrawBackdrop(VOID)
Definition: ui.c:239
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
Definition: fltkernel.h:1129
SETUP_LOADER_BLOCK SetupBlock
Definition: winldr.h:50
#define ERR(fmt,...)
Definition: debug.h:110
struct _FileName FileName
Definition: fatprocs.h:893
#define TAG_BOOT_OPTIONS
Definition: setupldr.c:362
PCSTR NtLdrGetOption(IN PCSTR Options, IN PCSTR OptionName)
Definition: ntldropts.c:128
#define SETUPLDR_TEXT_MODE
Definition: setupblk.h:7
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
signed char * PSTR
Definition: retypes.h:7
Definition: arc.h:46
#define NULL
Definition: types.h:112
FORCEINLINE VOID UiResetForSOS(VOID)
Definition: winldr.h:83
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
BOOLEAN InfFindFirstLine(HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context)
Definition: inffile.c:1050
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
Definition: arc.h:47
const char * PCSTR
Definition: typedefs.h:52
PCHAR GetArgumentValue(IN ULONG Argc, IN PCHAR Argv[], IN PCHAR ArgumentName)
Definition: arcsupp.c:41
BOOLEAN WinLdrInitSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, IN PCSTR SystemRoot, IN BOOLEAN Setup)
Definition: wlregistry.c:110
VOID NtLdrGetHigherPriorityOptions(IN PCSTR BootOptions, OUT PSTR *ExtraOptions, OUT PSTR *HigherPriorityOptions)
Definition: setupldr.c:365
PCSTR NtLdrGetOptionEx(IN PCSTR Options, IN PCSTR OptionName, OUT PULONG OptionLength OPTIONAL)
Definition: ntldropts.c:117
BOOLEAN InfOpenFile(PHINF InfHandle, PCSTR FileName, PULONG ErrorLine)
Definition: inffile.c:918
PLOADER_SYSTEM_BLOCK WinLdrSystemBlock
Definition: winldr.c:29
NTSTRSAFEAPI RtlStringCbCatA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:625

◆ PaToVa()

◆ VaToPa()