mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 21:01:54 +00:00
[SETUPLIB] Adjustments in the code.
- Call OpenAndMapFile() with its new ReadWrite parameter; - Add informative comments in osdetect.c; - In partlist.c, check whether a disk has a valid MBR by also checking for its 0xAA55 signature. svn path=/branches/setup_improvements/; revision=74712
This commit is contained in:
parent
7f5428633b
commit
563d9f26c4
3 changed files with 20 additions and 6 deletions
|
@ -89,7 +89,7 @@ FindNTOSBootLoader( // By handle
|
|||
#if 0
|
||||
/* Check whether the loader configuration file exists */
|
||||
Status = OpenAndMapFile(PartitionHandle, NtosBootLoaders[Type].LoaderConfigurationFile,
|
||||
&FileHandle, &SectionHandle, &ViewBase, &FileSize);
|
||||
&FileHandle, &SectionHandle, &ViewBase, &FileSize, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* The loader does not exist, continue with another one */
|
||||
|
@ -314,7 +314,7 @@ EnumerateNTOSBootEntries(
|
|||
|
||||
/* Check whether the loader configuration file exists */
|
||||
Status = OpenAndMapFile(PartitionHandle, NtosBootLoaders[Type].LoaderConfigurationFile,
|
||||
&FileHandle, &SectionHandle, &ViewBase, &FileSize);
|
||||
&FileHandle, &SectionHandle, &ViewBase, &FileSize, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* The loader does not exist, continue with another one */
|
||||
|
|
|
@ -150,6 +150,8 @@ EnumerateInstallations(
|
|||
{
|
||||
/* This is not a ReactOS entry */
|
||||
/* Certainly not a ReactOS installation */
|
||||
DPRINT1(" A Win2k3 install '%wZ' without an ARC path?!\n", &InstallName);
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +173,7 @@ EnumerateInstallations(
|
|||
{
|
||||
DPRINT1(" An NTOS installation with name \"%S\" already exists in SystemRoot '%wZ'\n",
|
||||
NtOsInstall->InstallationName, &NtOsInstall->SystemArcPath);
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -183,6 +186,7 @@ EnumerateInstallations(
|
|||
if (!ArcPathToNtPath(&SystemRootPath, BootEntry->OsLoadPath, Data->PartList))
|
||||
{
|
||||
DPRINT1("ArcPathToNtPath(%S) failed, skip the installation.\n", BootEntry->OsLoadPath);
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -198,6 +202,7 @@ EnumerateInstallations(
|
|||
{
|
||||
DPRINT1(" An NTOS installation with name \"%S\" already exists in SystemRoot '%wZ'\n",
|
||||
NtOsInstall->InstallationName, &NtOsInstall->SystemNtPath);
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -205,7 +210,10 @@ EnumerateInstallations(
|
|||
|
||||
/* Check if this is a valid NTOS installation; stop there if it isn't one */
|
||||
if (!IsValidNTOSInstallation_UStr(&SystemRootPath))
|
||||
{
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
DPRINT1("Found a valid NTOS installation in SystemRoot ARC path '%S', NT path '%wZ'\n",
|
||||
BootEntry->OsLoadPath, &SystemRootPath);
|
||||
|
@ -228,6 +236,7 @@ EnumerateInstallations(
|
|||
DPRINT1("NtPathToDiskPartComponents(%wZ) failed\n", &SystemRootPath);
|
||||
}
|
||||
|
||||
/* Add the discovered NTOS installation into the list */
|
||||
if (PartEntry && PartEntry->DriveLetter)
|
||||
{
|
||||
/* We have retrieved a partition that is mounted */
|
||||
|
@ -245,6 +254,7 @@ EnumerateInstallations(
|
|||
DiskNumber, PartitionNumber, PartEntry,
|
||||
InstallNameW);
|
||||
|
||||
/* Continue the enumeration */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -301,7 +311,8 @@ CheckForValidPEAndVendor(
|
|||
VendorName->Length = 0;
|
||||
|
||||
Status = OpenAndMapFile(RootDirectory, PathNameToFile,
|
||||
&FileHandle, &SectionHandle, &ViewBase, NULL);
|
||||
&FileHandle, &SectionHandle, &ViewBase,
|
||||
NULL, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed to open and map file '%S', Status 0x%08lx\n", PathNameToFile, Status);
|
||||
|
|
|
@ -989,9 +989,12 @@ AddDiskToList(
|
|||
// DiskEntry->Signature = Signature;
|
||||
DiskEntry->BiosFound = FALSE;
|
||||
|
||||
/* Check if this disk has a valid MBR */
|
||||
// FIXME: Check for the MBR signature as well, etc...
|
||||
if (Mbr->BootCode[0] == 0 && Mbr->BootCode[1] == 0)
|
||||
/*
|
||||
* Check if this disk has a valid MBR: verify its signature,
|
||||
* and whether its two first bytes are a valid instruction
|
||||
* (related to this, see IsThereAValidBootSector() in partlist.c).
|
||||
*/
|
||||
if (Mbr->Magic != 0xaa55 || (*(PUSHORT)Mbr->BootCode) == 0x0000)
|
||||
DiskEntry->NoMbr = TRUE;
|
||||
else
|
||||
DiskEntry->NoMbr = FALSE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue