mirror of
https://github.com/reactos/reactos.git
synced 2024-09-14 06:42:52 +00:00
- Add a new property to the disk entry: NoMbr flag. It's set, if MBR's first two bytes are zero (same algorithm is used by our cdrom bootsector).
- If this flag is set for a boot disk, ReactOS MBR code will be installed on it. See issue #4355 for more details. svn path=/trunk/; revision=40437
This commit is contained in:
parent
6b245eee92
commit
b3c86c2ac0
|
@ -2380,6 +2380,28 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
CheckActiveBootPartition(PartitionList);
|
||||
}
|
||||
|
||||
/* Install MBR if necessary */
|
||||
if (DiskEntry->NoMbr &&
|
||||
DiskEntry->BiosDiskNumber == 0)
|
||||
{
|
||||
wcscpy(PathBuffer, SourceRootPath.Buffer);
|
||||
wcscat(PathBuffer, L"\\loader\\dosmbr.bin");
|
||||
|
||||
DPRINT("Install MBR bootcode: %S ==> %S\n",
|
||||
PathBuffer, DestinationRootPath.Buffer);
|
||||
|
||||
/* Install MBR bootcode */
|
||||
Status = InstallMbrBootCodeToDisk(PathBuffer, DestinationRootPath.Buffer);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
|
||||
Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DiskEntry->NoMbr = FALSE;
|
||||
}
|
||||
|
||||
if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
|
||||
{
|
||||
/* FIXME: Install boot code. This is a hack! */
|
||||
|
|
|
@ -775,10 +775,6 @@ AddDiskToList (HANDLE FileHandle,
|
|||
}
|
||||
Checksum = ~Checksum + 1;
|
||||
|
||||
RtlFreeHeap (ProcessHeap,
|
||||
0,
|
||||
Mbr);
|
||||
|
||||
swprintf(Identifier, L"%08x-%08x-A", Checksum, Signature);
|
||||
DPRINT("Identifier: %S\n", Identifier);
|
||||
|
||||
|
@ -799,6 +795,17 @@ AddDiskToList (HANDLE FileHandle,
|
|||
}
|
||||
DiskEntry->BiosFound = FALSE;
|
||||
|
||||
/* Check if this disk has a valid MBR */
|
||||
if (Mbr->BootCode[0] == 0 && Mbr->BootCode[1] == 0)
|
||||
DiskEntry->NoMbr = TRUE;
|
||||
else
|
||||
DiskEntry->NoMbr = FALSE;
|
||||
|
||||
/* Free Mbr sector buffer */
|
||||
RtlFreeHeap (ProcessHeap,
|
||||
0,
|
||||
Mbr);
|
||||
|
||||
ListEntry = List->BiosDiskListHead.Flink;
|
||||
while(ListEntry != &List->BiosDiskListHead)
|
||||
{
|
||||
|
@ -2672,6 +2679,7 @@ WritePartitionsToDisk (PPARTLIST List)
|
|||
}
|
||||
|
||||
DiskEntry1->NewDisk = FALSE;
|
||||
DiskEntry1->NoMbr = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ typedef struct _DISKENTRY
|
|||
BOOLEAN Modified;
|
||||
|
||||
BOOLEAN NewDisk;
|
||||
BOOLEAN NoMbr; /* MBR is absent */
|
||||
|
||||
UNICODE_STRING DriverName;
|
||||
|
||||
|
|
Loading…
Reference in a new issue