mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[FREELDR:SETUPLDR] Add the missing known platform-specific SourcePaths where TXTSETUP.SIF can be found
And slightly improve the search loop. - Unconditionally look into the root directory as well, in order to cover all possible boot disk layouts in case someone customizes the ReactOS boot media layout. - Improve the `InfOpenFile()` call error handling, in order to show the erroneous line _iff_ the call failed because of a wrong syntax in TXTSETUP.SIF . Distinguish it from a failure because the file doesn't exist in the source path being tested (in which case, no error is shown).
This commit is contained in:
@@ -514,16 +514,21 @@ LoadReactOSSetup(
|
||||
|
||||
static PCSTR SourcePaths[] =
|
||||
{
|
||||
"", /* Only for floppy boot */
|
||||
"", /* Keep first to optimize TXTSETUP.SIF search on floppy boot */
|
||||
#if defined(_M_IX86)
|
||||
"I386\\",
|
||||
#elif defined(_M_AMD64)
|
||||
"AMD64\\",
|
||||
#elif defined(_M_ARM)
|
||||
"ARM\\",
|
||||
#elif defined(_M_ARM64)
|
||||
"ARM64\\",
|
||||
#elif defined(_M_MPPC)
|
||||
"PPC\\",
|
||||
#elif defined(_M_MRX000)
|
||||
"MIPS\\",
|
||||
#endif
|
||||
"reactos\\",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Retrieve the (mandatory) boot type */
|
||||
@@ -624,26 +629,38 @@ LoadReactOSSetup(
|
||||
}
|
||||
|
||||
/* Check if we booted from floppy */
|
||||
BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
|
||||
BootFromFloppy = !!strstr(BootPath, ")fdisk(");
|
||||
// FIXME: Use for implementing disk tag check when booting using multiple floppies.
|
||||
DBG_UNREFERENCED_LOCAL_VARIABLE(BootFromFloppy);
|
||||
|
||||
/* Open 'txtsetup.sif' from any of the source paths */
|
||||
/* Open 'TXTSETUP.SIF' from any of the source paths */
|
||||
FileName = BootPath + strlen(BootPath);
|
||||
for (i = BootFromFloppy ? 0 : 1; ; i++)
|
||||
for (i = 0;; ++i)
|
||||
{
|
||||
SystemPath = SourcePaths[i];
|
||||
if (!SystemPath)
|
||||
if (i >= RTL_NUMBER_OF(SourcePaths))
|
||||
{
|
||||
UiMessageBox("Failed to open txtsetup.sif");
|
||||
return ENOENT;
|
||||
}
|
||||
SystemPath = SourcePaths[i];
|
||||
|
||||
/* Adjust the tentative BootPath */
|
||||
FileNameLength = (ULONG)(sizeof(BootPath) - (FileName - BootPath)*sizeof(CHAR));
|
||||
RtlStringCbCopyA(FileName, FileNameLength, SystemPath);
|
||||
|
||||
/* Try to open TXTSETUP.SIF from this BootPath */
|
||||
RtlStringCbCopyA(FilePath, sizeof(FilePath), BootPath);
|
||||
RtlStringCbCatA(FilePath, sizeof(FilePath), "txtsetup.sif");
|
||||
if (InfOpenFile(&InfHandle, FilePath, &ErrorLine))
|
||||
{
|
||||
/* Found and opened: TXTSETUP.SIF is in the correct BootPath */
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ErrorLine != -1)
|
||||
UiMessageBox("Error in %s at line %lu", FilePath, ErrorLine);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
|
||||
|
||||
Reference in New Issue
Block a user