2009-03-12 14:42:02 +00:00
|
|
|
/*
|
|
|
|
* FreeLoader
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Aleksey Bragin <aleksey@reactos.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-03-12 14:42:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <freeldr.h>
|
2017-06-02 00:52:36 +00:00
|
|
|
#include "winldr.h"
|
2009-03-12 14:42:02 +00:00
|
|
|
|
|
|
|
#include <ndk/ldrtypes.h>
|
2009-03-21 11:11:44 +00:00
|
|
|
#include <arc/setupblk.h>
|
|
|
|
|
2009-03-12 14:42:02 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
2011-09-03 10:56:36 +00:00
|
|
|
DBG_DEFAULT_CHANNEL(WINDOWS);
|
2013-12-26 16:58:56 +00:00
|
|
|
#define TAG_BOOT_OPTIONS 'pOtB'
|
2011-09-03 10:56:36 +00:00
|
|
|
|
2011-08-31 13:47:25 +00:00
|
|
|
// TODO: Move to .h
|
|
|
|
VOID AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK *OutLoaderBlock);
|
2009-03-15 10:46:41 +00:00
|
|
|
|
2011-10-03 08:32:07 +00:00
|
|
|
static VOID
|
2009-03-15 11:10:52 +00:00
|
|
|
SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR SearchPath)
|
|
|
|
{
|
|
|
|
INFCONTEXT InfContext;
|
|
|
|
LPCSTR AnsiName, OemName, LangName;
|
|
|
|
|
|
|
|
/* Get ANSI codepage file */
|
|
|
|
if (!InfFindFirstLine(InfHandle, "NLS", "AnsiCodepage", &InfContext))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to find 'NLS/AnsiCodepage'\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InfGetDataField(&InfContext, 1, &AnsiName))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to get load options\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get OEM codepage file */
|
|
|
|
if (!InfFindFirstLine(InfHandle, "NLS", "OemCodepage", &InfContext))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to find 'NLS/AnsiCodepage'\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InfGetDataField(&InfContext, 1, &OemName))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to get load options\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!InfFindFirstLine(InfHandle, "NLS", "UnicodeCasetable", &InfContext))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to find 'NLS/AnsiCodepage'\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InfGetDataField(&InfContext, 1, &LangName))
|
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to get load options\n");
|
2009-03-15 11:10:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-04 15:29:07 +00:00
|
|
|
TRACE("NLS data '%s' '%s' '%s'\n", AnsiName, OemName, LangName);
|
2017-06-03 14:55:18 +00:00
|
|
|
|
2019-06-25 21:56:21 +00:00
|
|
|
#if DBG
|
|
|
|
{
|
|
|
|
BOOLEAN Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
|
|
|
TRACE("NLS data loading %s\n", Success ? "successful" : "failed");
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
|
|
|
|
#endif
|
2017-06-03 14:55:18 +00:00
|
|
|
|
|
|
|
/* TODO: Load OEM HAL font */
|
|
|
|
// Value "OemHalFont"
|
2009-03-15 11:10:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-03 08:32:07 +00:00
|
|
|
static VOID
|
|
|
|
SetupLdrScanBootDrivers(PLIST_ENTRY BootDriverListHead, HINF InfHandle, LPCSTR SearchPath)
|
2009-03-16 20:56:07 +00:00
|
|
|
{
|
2011-05-20 22:29:54 +00:00
|
|
|
INFCONTEXT InfContext, dirContext;
|
2015-01-05 01:34:29 +00:00
|
|
|
BOOLEAN Success;
|
2011-05-20 22:29:54 +00:00
|
|
|
LPCSTR Media, DriverName, dirIndex, ImagePath;
|
2009-03-16 20:56:07 +00:00
|
|
|
WCHAR ServiceName[256];
|
2011-05-20 22:29:54 +00:00
|
|
|
WCHAR ImagePathW[256];
|
2009-03-16 20:56:07 +00:00
|
|
|
|
|
|
|
/* Open inf section */
|
|
|
|
if (!InfFindFirstLine(InfHandle, "SourceDisksFiles", NULL, &InfContext))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Load all listed boot drivers */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (InfGetDataField(&InfContext, 7, &Media) &&
|
2011-06-25 13:52:47 +00:00
|
|
|
InfGetDataField(&InfContext, 0, &DriverName) &&
|
2011-05-20 22:29:54 +00:00
|
|
|
InfGetDataField(&InfContext, 13, &dirIndex))
|
2009-03-16 20:56:07 +00:00
|
|
|
{
|
2011-05-20 22:29:54 +00:00
|
|
|
if ((strcmp(Media, "x") == 0) &&
|
|
|
|
InfFindFirstLine(InfHandle, "Directories", dirIndex, &dirContext) &&
|
|
|
|
InfGetDataField(&dirContext, 1, &ImagePath))
|
2009-03-16 20:56:07 +00:00
|
|
|
{
|
|
|
|
/* Convert name to widechar */
|
|
|
|
swprintf(ServiceName, L"%S", DriverName);
|
|
|
|
|
2011-05-20 22:29:54 +00:00
|
|
|
/* Prepare image path */
|
|
|
|
swprintf(ImagePathW, L"%S", ImagePath);
|
|
|
|
wcscat(ImagePathW, L"\\");
|
|
|
|
wcscat(ImagePathW, ServiceName);
|
2011-06-25 13:52:47 +00:00
|
|
|
|
2009-03-16 20:56:07 +00:00
|
|
|
/* Remove .sys extension */
|
|
|
|
ServiceName[wcslen(ServiceName) - 4] = 0;
|
|
|
|
|
|
|
|
/* Add it to the list */
|
2015-01-05 01:34:29 +00:00
|
|
|
Success = WinLdrAddDriverToList(BootDriverListHead,
|
|
|
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
|
|
|
|
ImagePathW,
|
|
|
|
ServiceName);
|
|
|
|
if (!Success)
|
2009-03-16 20:56:07 +00:00
|
|
|
{
|
2019-08-04 15:29:07 +00:00
|
|
|
ERR("Could not add boot driver '%s', '%s'\n", SearchPath, DriverName);
|
2009-03-16 20:56:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (InfFindNextLine(&InfContext, &InfContext));
|
|
|
|
}
|
|
|
|
|
2017-06-03 14:55:18 +00:00
|
|
|
|
|
|
|
/* SETUP STARTER **************************************************************/
|
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
ARC_STATUS
|
|
|
|
LoadReactOSSetup(
|
|
|
|
IN ULONG Argc,
|
|
|
|
IN PCHAR Argv[],
|
|
|
|
IN PCHAR Envp[])
|
2009-03-12 14:42:02 +00:00
|
|
|
{
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
PCSTR ArgValue;
|
2014-12-26 11:38:43 +00:00
|
|
|
PCHAR File;
|
2011-08-31 13:47:25 +00:00
|
|
|
CHAR FileName[512];
|
|
|
|
CHAR BootPath[512];
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
CHAR BootOptions2[256];
|
2013-12-26 16:58:56 +00:00
|
|
|
LPCSTR LoadOptions;
|
|
|
|
LPSTR BootOptions;
|
2009-10-03 12:49:14 +00:00
|
|
|
BOOLEAN BootFromFloppy;
|
2017-06-03 14:55:18 +00:00
|
|
|
BOOLEAN Success;
|
2009-03-15 10:46:41 +00:00
|
|
|
ULONG i, ErrorLine;
|
|
|
|
HINF InfHandle;
|
|
|
|
INFCONTEXT InfContext;
|
2011-08-31 13:47:25 +00:00
|
|
|
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
2009-03-21 11:11:44 +00:00
|
|
|
PSETUP_LOADER_BLOCK SetupBlock;
|
2011-08-31 13:47:25 +00:00
|
|
|
LPCSTR SystemPath;
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
|
|
|
|
static LPCSTR SourcePaths[] =
|
2009-03-15 10:46:41 +00:00
|
|
|
{
|
2014-12-26 11:38:43 +00:00
|
|
|
"", /* Only for floppy boot */
|
2009-03-15 10:46:41 +00:00
|
|
|
#if defined(_M_IX86)
|
2014-12-26 11:38:43 +00:00
|
|
|
"I386\\",
|
2009-03-15 10:46:41 +00:00
|
|
|
#elif defined(_M_MPPC)
|
2014-12-26 11:38:43 +00:00
|
|
|
"PPC\\",
|
2009-03-15 10:46:41 +00:00
|
|
|
#elif defined(_M_MRX000)
|
2014-12-26 11:38:43 +00:00
|
|
|
"MIPS\\",
|
2009-03-15 10:46:41 +00:00
|
|
|
#endif
|
2014-12-26 11:38:43 +00:00
|
|
|
"reactos\\",
|
2009-03-15 10:46:41 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2017-06-03 14:55:18 +00:00
|
|
|
UiDrawStatusText("Setup is loading...");
|
|
|
|
|
2014-12-26 11:38:43 +00:00
|
|
|
UiDrawBackdrop();
|
2015-01-04 23:49:18 +00:00
|
|
|
UiDrawProgressBarCenter(1, 100, "Loading ReactOS Setup...");
|
2014-12-26 11:38:43 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
/* Retrieve the system path */
|
|
|
|
*BootPath = ANSI_NULL;
|
|
|
|
ArgValue = GetArgumentValue(Argc, Argv, "SystemPath");
|
|
|
|
if (ArgValue)
|
|
|
|
{
|
|
|
|
RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
|
|
|
|
}
|
|
|
|
else
|
2014-12-26 11:38:43 +00:00
|
|
|
{
|
2015-02-05 21:17:35 +00:00
|
|
|
/*
|
|
|
|
* IMPROVE: I don't want to call MachDiskGetBootPath here as a
|
|
|
|
* default choice because I can call it after (see few lines below).
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
* Instead I reset BootPath here so that we can build the full path
|
|
|
|
* using the general code from below.
|
2015-02-05 21:17:35 +00:00
|
|
|
*/
|
2015-01-04 23:49:18 +00:00
|
|
|
// MachDiskGetBootPath(BootPath, sizeof(BootPath));
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
// RtlStringCbCopyA(BootPath, sizeof(BootPath), ArgValue);
|
|
|
|
*BootPath = ANSI_NULL;
|
2015-01-04 23:49:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check whether BootPath is a full path
|
|
|
|
* and if not, create a full boot path.
|
|
|
|
*
|
|
|
|
* See FsOpenFile for the technique used.
|
|
|
|
*/
|
|
|
|
if (strrchr(BootPath, ')') == NULL)
|
|
|
|
{
|
|
|
|
/* Temporarily save the boot path */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
RtlStringCbCopyA(FileName, sizeof(FileName), BootPath);
|
2015-01-04 23:49:18 +00:00
|
|
|
|
|
|
|
/* This is not a full path. Use the current (i.e. boot) device. */
|
2014-12-26 11:38:43 +00:00
|
|
|
MachDiskGetBootPath(BootPath, sizeof(BootPath));
|
2015-01-04 23:49:18 +00:00
|
|
|
|
|
|
|
/* Append a path separator if needed */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
if (*FileName != '\\' && *FileName != '/')
|
|
|
|
RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
|
2015-01-04 23:49:18 +00:00
|
|
|
|
|
|
|
/* Append the remaining path */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
RtlStringCbCatA(BootPath, sizeof(BootPath), FileName);
|
2014-12-26 11:38:43 +00:00
|
|
|
}
|
|
|
|
|
2015-01-04 23:49:18 +00:00
|
|
|
/* Append a backslash if needed */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
if (!*BootPath || BootPath[strlen(BootPath) - 1] != '\\')
|
|
|
|
RtlStringCbCatA(BootPath, sizeof(BootPath), "\\");
|
2014-12-26 11:38:43 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
TRACE("BootPath: '%s'\n", BootPath);
|
2014-12-26 11:38:43 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
/* Retrieve the boot options */
|
|
|
|
*BootOptions2 = ANSI_NULL;
|
|
|
|
ArgValue = GetArgumentValue(Argc, Argv, "Options");
|
|
|
|
if (ArgValue)
|
|
|
|
RtlStringCbCopyA(BootOptions2, sizeof(BootOptions2), ArgValue);
|
2014-12-26 11:38:43 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
TRACE("BootOptions: '%s'\n", BootOptions2);
|
2014-12-26 11:38:43 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
/* Check if we booted from floppy */
|
2011-08-31 13:47:25 +00:00
|
|
|
BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
|
2009-10-03 12:49:14 +00:00
|
|
|
|
|
|
|
/* Open 'txtsetup.sif' from any of source paths */
|
2014-12-26 11:38:43 +00:00
|
|
|
File = BootPath + strlen(BootPath);
|
2009-10-03 12:49:14 +00:00
|
|
|
for (i = BootFromFloppy ? 0 : 1; ; i++)
|
2009-03-15 10:46:41 +00:00
|
|
|
{
|
2011-08-31 13:47:25 +00:00
|
|
|
SystemPath = SourcePaths[i];
|
|
|
|
if (!SystemPath)
|
2009-03-15 10:46:41 +00:00
|
|
|
{
|
2015-02-05 21:17:35 +00:00
|
|
|
UiMessageBox("Failed to open txtsetup.sif");
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
return ENOENT;
|
2009-03-15 10:46:41 +00:00
|
|
|
}
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
RtlStringCbCopyA(File, sizeof(BootPath) - (File - BootPath)*sizeof(CHAR), SystemPath);
|
|
|
|
RtlStringCbCopyA(FileName, sizeof(FileName), BootPath);
|
|
|
|
RtlStringCbCatA(FileName, sizeof(FileName), "txtsetup.sif");
|
2015-01-04 23:49:18 +00:00
|
|
|
if (InfOpenFile(&InfHandle, FileName, &ErrorLine))
|
2009-04-20 20:04:23 +00:00
|
|
|
{
|
2009-03-15 10:46:41 +00:00
|
|
|
break;
|
2009-04-20 20:04:23 +00:00
|
|
|
}
|
2009-03-15 10:46:41 +00:00
|
|
|
}
|
|
|
|
|
2011-09-03 10:56:36 +00:00
|
|
|
TRACE("BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
|
2011-08-31 13:47:25 +00:00
|
|
|
|
2009-09-25 09:28:37 +00:00
|
|
|
/* Get Load options - debug and non-debug */
|
2011-08-31 13:47:25 +00:00
|
|
|
if (!InfFindFirstLine(InfHandle, "SetupData", "OsLoadOptions", &InfContext))
|
2009-03-15 10:46:41 +00:00
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to find 'SetupData/OsLoadOptions'\n");
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
return EINVAL;
|
2009-03-15 10:46:41 +00:00
|
|
|
}
|
|
|
|
|
2012-12-27 21:52:40 +00:00
|
|
|
if (!InfGetDataField(&InfContext, 1, &LoadOptions))
|
2009-03-15 10:46:41 +00:00
|
|
|
{
|
2011-09-03 10:56:36 +00:00
|
|
|
ERR("Failed to get load options\n");
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
return EINVAL;
|
2009-03-15 10:46:41 +00:00
|
|
|
}
|
|
|
|
|
2009-09-25 09:28:37 +00:00
|
|
|
#if DBG
|
|
|
|
/* Get debug load options and use them */
|
2011-08-31 13:47:25 +00:00
|
|
|
if (InfFindFirstLine(InfHandle, "SetupData", "DbgOsLoadOptions", &InfContext))
|
2009-09-25 09:28:37 +00:00
|
|
|
{
|
2013-12-26 16:58:56 +00:00
|
|
|
LPCSTR DbgLoadOptions;
|
|
|
|
|
|
|
|
if (InfGetDataField(&InfContext, 1, &DbgLoadOptions))
|
|
|
|
LoadOptions = DbgLoadOptions;
|
2009-09-25 09:28:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-26 16:58:56 +00:00
|
|
|
/* Copy loadoptions (original string will be freed) */
|
|
|
|
BootOptions = FrLdrTempAlloc(strlen(LoadOptions) + 1, TAG_BOOT_OPTIONS);
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
ASSERT(BootOptions);
|
2013-12-26 16:58:56 +00:00
|
|
|
strcpy(BootOptions, LoadOptions);
|
|
|
|
|
2011-09-03 10:56:36 +00:00
|
|
|
TRACE("BootOptions: '%s'\n", BootOptions);
|
2009-09-25 09:28:37 +00:00
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
/* Check if a ramdisk file was given */
|
|
|
|
File = strstr(BootOptions2, "/RDPATH=");
|
|
|
|
if (File)
|
|
|
|
{
|
|
|
|
/* Copy the file name and everything else after it */
|
|
|
|
RtlStringCbCopyA(FileName, sizeof(FileName), File + 8);
|
|
|
|
|
|
|
|
/* Null-terminate */
|
|
|
|
*strstr(FileName, " ") = ANSI_NULL;
|
|
|
|
|
|
|
|
/* Load the ramdisk */
|
|
|
|
if (!RamDiskLoadVirtualFile(FileName))
|
|
|
|
{
|
|
|
|
UiMessageBox("Failed to load RAM disk file %s", FileName);
|
|
|
|
return ENOENT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-12 20:53:49 +00:00
|
|
|
/* Allocate and minimalist-initialize LPB */
|
2009-03-15 10:46:41 +00:00
|
|
|
AllocateAndInitLPB(&LoaderBlock);
|
2009-03-12 14:42:02 +00:00
|
|
|
|
2009-03-21 11:11:44 +00:00
|
|
|
/* Allocate and initialize setup loader block */
|
2011-09-26 16:06:19 +00:00
|
|
|
SetupBlock = &WinLdrSystemBlock->SetupBlock;
|
2009-03-21 11:11:44 +00:00
|
|
|
LoaderBlock->SetupLdrBlock = SetupBlock;
|
|
|
|
|
|
|
|
/* Set textmode setup flag */
|
|
|
|
SetupBlock->Flags = SETUPLDR_TEXT_MODE;
|
|
|
|
|
2017-06-03 14:55:18 +00:00
|
|
|
/* Load the system hive "setupreg.hiv" for setup */
|
|
|
|
UiDrawBackdrop();
|
|
|
|
UiDrawProgressBarCenter(15, 100, "Loading setup system hive...");
|
|
|
|
Success = WinLdrInitSystemHive(LoaderBlock, BootPath, TRUE);
|
|
|
|
TRACE("Setup SYSTEM hive %s\n", (Success ? "loaded" : "not loaded"));
|
|
|
|
/* Bail out if failure */
|
|
|
|
if (!Success)
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
return ENOEXEC;
|
2017-06-03 14:55:18 +00:00
|
|
|
|
|
|
|
/* Load NLS data, they are in the System32 directory of the installation medium */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
RtlStringCbCopyA(FileName, sizeof(FileName), BootPath);
|
|
|
|
RtlStringCbCatA(FileName, sizeof(FileName), "system32\\");
|
2011-08-31 13:47:25 +00:00
|
|
|
SetupLdrLoadNlsData(LoaderBlock, InfHandle, FileName);
|
2009-03-15 10:46:41 +00:00
|
|
|
|
2017-06-03 14:55:18 +00:00
|
|
|
// UiDrawStatusText("Press F6 if you need to install a 3rd-party SCSI or RAID driver...");
|
|
|
|
|
2009-03-16 20:56:07 +00:00
|
|
|
/* Get a list of boot drivers */
|
2011-10-03 08:32:07 +00:00
|
|
|
SetupLdrScanBootDrivers(&LoaderBlock->BootDriverListHead, InfHandle, BootPath);
|
2009-03-16 20:56:07 +00:00
|
|
|
|
2013-12-26 16:58:56 +00:00
|
|
|
/* Close the inf file */
|
|
|
|
InfCloseFile(InfHandle);
|
|
|
|
|
2017-06-03 14:55:18 +00:00
|
|
|
UiDrawStatusText("The Setup program is starting...");
|
|
|
|
|
2015-01-03 16:51:26 +00:00
|
|
|
/* Load ReactOS Setup */
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
return LoadAndBootWindowsCommon(_WIN32_WINNT_WS03,
|
|
|
|
LoaderBlock,
|
|
|
|
BootOptions,
|
|
|
|
BootPath,
|
|
|
|
TRUE);
|
2009-03-15 10:46:41 +00:00
|
|
|
}
|