mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 17:01:28 +00:00
![Hermès Bélusca-Maïto](/assets/img/avatar_default.png)
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).
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
/*
|
|
* PROJECT: FreeLoader
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
|
* PURPOSE: Generic ARC Support Functions
|
|
* COPYRIGHT: Copyright 2019 Hermes Belusca-Maito
|
|
*/
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
#include <freeldr.h>
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
PCHAR
|
|
GetNextArgumentValue(
|
|
IN ULONG Argc,
|
|
IN PCHAR Argv[],
|
|
IN OUT PULONG LastIndex OPTIONAL,
|
|
IN PCHAR ArgumentName)
|
|
{
|
|
ULONG i;
|
|
SIZE_T ArgNameLen = strlen(ArgumentName);
|
|
|
|
for (i = (LastIndex ? *LastIndex : 0); i < Argc; ++i)
|
|
{
|
|
if (strlen(Argv[i]) >= ArgNameLen + 1 /* Count the '=' sign */ &&
|
|
_strnicmp(Argv[i], ArgumentName, ArgNameLen) == 0 &&
|
|
Argv[i][ArgNameLen] == '=')
|
|
{
|
|
/* Found it, return the value */
|
|
if (LastIndex) *LastIndex = i;
|
|
return &Argv[i][ArgNameLen + 1];
|
|
}
|
|
}
|
|
|
|
if (LastIndex) *LastIndex = (ULONG)-1;
|
|
return NULL;
|
|
}
|
|
|
|
PCHAR
|
|
GetArgumentValue(
|
|
IN ULONG Argc,
|
|
IN PCHAR Argv[],
|
|
IN PCHAR ArgumentName)
|
|
{
|
|
return GetNextArgumentValue(Argc, Argv, NULL, ArgumentName);
|
|
}
|