mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 12:23:30 +00:00
[USETUP]
- Remove some unused structure members. - Consistently use the vocable "system partition" and "boot partition" (using MS aka. hardware-oriented definition) according to: https://en.wikipedia.org/wiki/System_partition_and_boot_partition http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html in few words: "system partition": the one that will be started by the platform firmware, and where the bootloader is found (only one per computer); "boot partition": the one where the OS of your choice resides (any number). svn path=/trunk/; revision=70797
This commit is contained in:
@@ -1270,9 +1270,9 @@ InstallMbrBootCodeToDisk(
|
||||
}
|
||||
|
||||
/* Copy partition table from old MBR to new */
|
||||
RtlCopyMemory (&NewBootSector->Signature,
|
||||
&OrigBootSector->Signature,
|
||||
sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, Signature) /* Length of partition table */);
|
||||
RtlCopyMemory(&NewBootSector->Signature,
|
||||
&OrigBootSector->Signature,
|
||||
sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, Signature) /* Length of partition table */);
|
||||
|
||||
/* Free the original boot sector */
|
||||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
@@ -2262,7 +2262,7 @@ InstallFatBootcodeToPartition(
|
||||
/* FAT or FAT32 partition */
|
||||
DPRINT("System path: '%wZ'\n", SystemRootPath);
|
||||
|
||||
/* Copy FreeLoader to the boot partition */
|
||||
/* Copy FreeLoader to the system partition */
|
||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||
wcscat(SrcPath, L"\\loader\\freeldr.sys");
|
||||
wcscpy(DstPath, SystemRootPath->Buffer);
|
||||
@@ -2520,7 +2520,7 @@ InstallExt2BootcodeToPartition(
|
||||
/* EXT2 partition */
|
||||
DPRINT("System path: '%wZ'\n", SystemRootPath);
|
||||
|
||||
/* Copy FreeLoader to the boot partition */
|
||||
/* Copy FreeLoader to the system partition */
|
||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||
wcscat(SrcPath, L"\\loader\\freeldr.sys");
|
||||
wcscpy(DstPath, SystemRootPath->Buffer);
|
||||
|
||||
@@ -66,16 +66,28 @@ static PFILE_SYSTEM_LIST FileSystemList = NULL;
|
||||
|
||||
static UNICODE_STRING InstallPath;
|
||||
|
||||
/* Path to the install directory */
|
||||
/*
|
||||
* Path to the system partition, where the boot manager resides.
|
||||
* On x86 PCs, this is usually the active partition.
|
||||
* On ARC, (u)EFI, ... platforms, this is a dedicated partition.
|
||||
*
|
||||
* For more information, see:
|
||||
* https://en.wikipedia.org/wiki/System_partition_and_boot_partition
|
||||
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
|
||||
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
|
||||
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
|
||||
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
|
||||
* http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
|
||||
*/
|
||||
static UNICODE_STRING SystemRootPath;
|
||||
|
||||
/* Path to the install directory inside the ReactOS boot partition */
|
||||
static UNICODE_STRING DestinationPath;
|
||||
static UNICODE_STRING DestinationArcPath;
|
||||
static UNICODE_STRING DestinationRootPath;
|
||||
|
||||
static WCHAR DestinationDriveLetter;
|
||||
|
||||
/* Path to the active partition (boot manager) */
|
||||
static UNICODE_STRING SystemRootPath;
|
||||
|
||||
static HINF SetupInf;
|
||||
|
||||
static HSPFILEQ SetupFileQueue = NULL;
|
||||
@@ -2525,7 +2537,7 @@ DeletePartitionPage(PINPUT_RECORD Ir)
|
||||
*
|
||||
* SIDEEFFECTS
|
||||
* Sets PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType (via UpdatePartitionType)
|
||||
* Calls CheckActiveBootPartition()
|
||||
* Calls CheckActiveSystemPartition()
|
||||
*
|
||||
* RETURNS
|
||||
* Number of the next page.
|
||||
@@ -2551,11 +2563,11 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
/* Find or set the active partition */
|
||||
CheckActiveBootPartition(PartitionList);
|
||||
/* Find or set the active system partition */
|
||||
CheckActiveSystemPartition(PartitionList);
|
||||
|
||||
if (PartitionList->BootDisk == NULL ||
|
||||
PartitionList->BootPartition == NULL)
|
||||
if (PartitionList->SystemDisk == NULL ||
|
||||
PartitionList->SystemPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
@@ -2564,10 +2576,10 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
||||
switch (PartitionList->FormatState)
|
||||
{
|
||||
case Start:
|
||||
if (PartitionList->CurrentPartition != PartitionList->BootPartition)
|
||||
if (PartitionList->CurrentPartition != PartitionList->SystemPartition)
|
||||
{
|
||||
PartitionList->TempDisk = PartitionList->BootDisk;
|
||||
PartitionList->TempPartition = PartitionList->BootPartition;
|
||||
PartitionList->TempDisk = PartitionList->SystemDisk;
|
||||
PartitionList->TempPartition = PartitionList->SystemPartition;
|
||||
PartitionList->TempPartition->NeedsCheck = TRUE;
|
||||
|
||||
PartitionList->FormatState = FormatSystemPartition;
|
||||
@@ -3224,8 +3236,7 @@ InstallDirectoryPage1(PWCHAR InstallDir,
|
||||
|
||||
/* Create 'InstallPath' string */
|
||||
RtlFreeUnicodeString(&InstallPath);
|
||||
RtlCreateUnicodeString(&InstallPath,
|
||||
InstallDir);
|
||||
RtlCreateUnicodeString(&InstallPath, InstallDir);
|
||||
|
||||
/* Create 'DestinationRootPath' string */
|
||||
RtlFreeUnicodeString(&DestinationRootPath);
|
||||
@@ -4174,13 +4185,12 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
||||
RtlFreeUnicodeString(&SystemRootPath);
|
||||
swprintf(PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->BootDisk->DiskNumber,
|
||||
PartitionList->BootPartition->PartitionNumber);
|
||||
RtlCreateUnicodeString(&SystemRootPath,
|
||||
PathBuffer);
|
||||
PartitionList->SystemDisk->DiskNumber,
|
||||
PartitionList->SystemPartition->PartitionNumber);
|
||||
RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
|
||||
DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
|
||||
PartitionType = PartitionList->BootPartition->PartitionType;
|
||||
PartitionType = PartitionList->SystemPartition->PartitionType;
|
||||
|
||||
if (IsUnattendedSetup)
|
||||
{
|
||||
@@ -4196,7 +4206,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
||||
|
||||
if (PartitionType == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
DPRINT("Error: active partition invalid (unused)\n");
|
||||
DPRINT("Error: system partition invalid (unused)\n");
|
||||
InstallOnFloppy = TRUE;
|
||||
}
|
||||
else if (PartitionType == PARTITION_OS2BOOTMGR)
|
||||
@@ -4207,8 +4217,8 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
||||
}
|
||||
else if (PartitionType == PARTITION_EXT2)
|
||||
{
|
||||
/* Linux ext2 partition */
|
||||
DPRINT("Found Linux ext2 partition\n");
|
||||
/* Linux EXT2 partition */
|
||||
DPRINT("Found Linux EXT2 partition\n");
|
||||
InstallOnFloppy = FALSE;
|
||||
}
|
||||
else if (PartitionType == PARTITION_IFS)
|
||||
@@ -4393,7 +4403,7 @@ BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir)
|
||||
UCHAR PartitionType;
|
||||
NTSTATUS Status;
|
||||
|
||||
PartitionType = PartitionList->BootPartition->PartitionType;
|
||||
PartitionType = PartitionList->SystemPartition->PartitionType;
|
||||
|
||||
Status = InstallVBRToPartition(&SystemRootPath,
|
||||
&SourceRootPath,
|
||||
@@ -4432,7 +4442,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
|
||||
WCHAR SourceMbrPathBuffer[MAX_PATH];
|
||||
|
||||
/* Step 1: Write the VBR */
|
||||
PartitionType = PartitionList->BootPartition->PartitionType;
|
||||
PartitionType = PartitionList->SystemPartition->PartitionType;
|
||||
|
||||
Status = InstallVBRToPartition(&SystemRootPath,
|
||||
&SourceRootPath,
|
||||
@@ -4447,7 +4457,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
|
||||
/* Step 2: Write the MBR */
|
||||
swprintf(DestinationDevicePathBuffer,
|
||||
L"\\Device\\Harddisk%d\\Partition0",
|
||||
PartitionList->BootDisk->DiskNumber);
|
||||
PartitionList->SystemDisk->DiskNumber);
|
||||
|
||||
wcscpy(SourceMbrPathBuffer, SourceRootPath.Buffer);
|
||||
wcscat(SourceMbrPathBuffer, L"\\loader\\dosmbr.bin");
|
||||
|
||||
@@ -1434,14 +1434,11 @@ CreatePartitionList(
|
||||
List->Line = 0;
|
||||
List->Offset = 0;
|
||||
|
||||
List->TopDisk = (ULONG)-1;
|
||||
List->TopPartition = (ULONG)-1;
|
||||
|
||||
List->CurrentDisk = NULL;
|
||||
List->CurrentPartition = NULL;
|
||||
|
||||
List->BootDisk = NULL;
|
||||
List->BootPartition = NULL;
|
||||
List->SystemDisk = NULL;
|
||||
List->SystemPartition = NULL;
|
||||
|
||||
List->TempDisk = NULL;
|
||||
List->TempPartition = NULL;
|
||||
@@ -1496,9 +1493,6 @@ CreatePartitionList(
|
||||
|
||||
AssignDriveLetters(List);
|
||||
|
||||
List->TopDisk = 0;
|
||||
List->TopPartition = 0;
|
||||
|
||||
/* Search for first usable disk and partition */
|
||||
if (IsListEmpty(&List->DiskListHead))
|
||||
{
|
||||
@@ -3130,7 +3124,7 @@ DeleteCurrentPartition(
|
||||
|
||||
|
||||
VOID
|
||||
CheckActiveBootPartition(
|
||||
CheckActiveSystemPartition(
|
||||
PPARTLIST List)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
@@ -3138,18 +3132,18 @@ CheckActiveBootPartition(
|
||||
PLIST_ENTRY ListEntry;
|
||||
|
||||
/* Check for empty disk list */
|
||||
if (IsListEmpty (&List->DiskListHead))
|
||||
if (IsListEmpty(&List->DiskListHead))
|
||||
{
|
||||
List->BootDisk = NULL;
|
||||
List->BootPartition = NULL;
|
||||
List->SystemDisk = NULL;
|
||||
List->SystemPartition = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (List->BootDisk != NULL &&
|
||||
List->BootPartition != NULL)
|
||||
if (List->SystemDisk != NULL &&
|
||||
List->SystemPartition != NULL)
|
||||
{
|
||||
/* We already have an active boot partition */
|
||||
/* We already have an active system partition */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3158,18 +3152,23 @@ CheckActiveBootPartition(
|
||||
DiskEntry = List->CurrentDisk;
|
||||
|
||||
/* Check for empty partition list */
|
||||
if (IsListEmpty (&DiskEntry->PrimaryPartListHead))
|
||||
if (IsListEmpty(&DiskEntry->PrimaryPartListHead))
|
||||
{
|
||||
List->BootDisk = NULL;
|
||||
List->BootPartition = NULL;
|
||||
List->SystemDisk = NULL;
|
||||
List->SystemPartition = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the first partition of the disk in case it is fresh new,
|
||||
* and if so, use it as the system partition.
|
||||
*/
|
||||
|
||||
PartEntry = CONTAINING_RECORD(DiskEntry->PrimaryPartListHead.Flink,
|
||||
PARTENTRY,
|
||||
ListEntry);
|
||||
|
||||
/* Set active boot partition */
|
||||
/* Set active system partition */
|
||||
if ((DiskEntry->NewDisk == TRUE) ||
|
||||
(PartEntry->BootIndicator == FALSE))
|
||||
{
|
||||
@@ -3179,15 +3178,15 @@ CheckActiveBootPartition(
|
||||
DiskEntry->Dirty = TRUE;
|
||||
|
||||
/* FIXME: Might be incorrect if partitions were created by Linux FDISK */
|
||||
List->BootDisk = DiskEntry;
|
||||
List->BootPartition = PartEntry;
|
||||
List->SystemDisk = DiskEntry;
|
||||
List->SystemPartition = PartEntry;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Disk is not new, scan all partitions to find a bootable one */
|
||||
List->BootDisk = NULL;
|
||||
List->BootPartition = NULL;
|
||||
List->SystemDisk = NULL;
|
||||
List->SystemPartition = NULL;
|
||||
|
||||
ListEntry = DiskEntry->PrimaryPartListHead.Flink;
|
||||
while (ListEntry != &DiskEntry->PrimaryPartListHead)
|
||||
@@ -3203,8 +3202,8 @@ CheckActiveBootPartition(
|
||||
PartEntry->BootIndicator)
|
||||
{
|
||||
/* Yes, we found it */
|
||||
List->BootDisk = DiskEntry;
|
||||
List->BootPartition = PartEntry;
|
||||
List->SystemDisk = DiskEntry;
|
||||
List->SystemPartition = PartEntry;
|
||||
|
||||
DPRINT("Found bootable partition disk %d, drive letter %c\n",
|
||||
DiskEntry->DiskNumber, PartEntry->DriveLetter);
|
||||
|
||||
@@ -71,10 +71,10 @@ typedef struct _PARTENTRY
|
||||
/* Partition is partitioned disk space */
|
||||
BOOLEAN IsPartitioned;
|
||||
|
||||
/* Partition is new. Table does not exist on disk yet */
|
||||
/* Partition is new, table does not exist on disk yet */
|
||||
BOOLEAN New;
|
||||
|
||||
/* Partition was created automatically. */
|
||||
/* Partition was created automatically */
|
||||
BOOLEAN AutoCreate;
|
||||
|
||||
FORMATSTATE FormatState;
|
||||
@@ -149,14 +149,12 @@ typedef struct _PARTLIST
|
||||
SHORT Line;
|
||||
SHORT Offset;
|
||||
|
||||
ULONG TopDisk;
|
||||
ULONG TopPartition;
|
||||
|
||||
PDISKENTRY CurrentDisk;
|
||||
PPARTENTRY CurrentPartition;
|
||||
|
||||
PDISKENTRY BootDisk;
|
||||
PPARTENTRY BootPartition;
|
||||
/* The system disk and partition where the boot manager resides */
|
||||
PDISKENTRY SystemDisk;
|
||||
PPARTENTRY SystemPartition;
|
||||
|
||||
PDISKENTRY TempDisk;
|
||||
PPARTENTRY TempPartition;
|
||||
@@ -259,7 +257,7 @@ DeleteCurrentPartition(
|
||||
PPARTLIST List);
|
||||
|
||||
VOID
|
||||
CheckActiveBootPartition(
|
||||
CheckActiveSystemPartition(
|
||||
PPARTLIST List);
|
||||
|
||||
BOOLEAN
|
||||
|
||||
Reference in New Issue
Block a user