mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 12:24:48 +00:00
* Write modified partition sectors to disk.
* Enable partition formatting code. svn path=/trunk/; revision=5653
This commit is contained in:
parent
c5cce225e2
commit
c01dbcf16b
6 changed files with 234 additions and 269 deletions
|
@ -922,8 +922,8 @@ CHECKPOINT1;
|
|||
|
||||
|
||||
NTSTATUS
|
||||
InstallMBRBootCodeToDisk(PWSTR SrcPath,
|
||||
PWSTR RootPath)
|
||||
InstallMbrCodeToDisk (PWSTR SrcPath,
|
||||
PWSTR RootPath)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
|
@ -1030,7 +1030,9 @@ InstallMBRBootCodeToDisk(PWSTR SrcPath,
|
|||
}
|
||||
|
||||
/* Copy partition table from old MBR to new */
|
||||
memcpy((NewBootSector + 446), (OrigBootSector + 446), 4*16 /* Length of partition table */);
|
||||
memcpy((NewBootSector + 446),
|
||||
(OrigBootSector + 446),
|
||||
4*16 /* Length of partition table */);
|
||||
|
||||
/* Free the original boot sector */
|
||||
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bootsup.h,v 1.4 2003/04/05 15:36:34 chorns Exp $
|
||||
/* $Id: bootsup.h,v 1.5 2003/08/18 17:39:26 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/bootsup.h
|
||||
|
@ -55,7 +55,7 @@ InstallFat32BootCodeToFile(PWSTR SrcPath,
|
|||
|
||||
NTSTATUS
|
||||
InstallMBRBootCodeToDisk(PWSTR SrcPath,
|
||||
PWSTR RootPath);
|
||||
PWSTR RootPath);
|
||||
|
||||
NTSTATUS
|
||||
InstallFat16BootCodeToDisk(PWSTR SrcPath,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: format.c,v 1.1 2003/04/28 19:44:13 chorns Exp $
|
||||
/* $Id: format.c,v 1.2 2003/08/18 17:39:26 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/format.c
|
||||
|
@ -41,13 +41,13 @@ FormatPartition(PUNICODE_STRING DriveRoot)
|
|||
|
||||
VfatInitialize();
|
||||
|
||||
Status = VfatFormat(DriveRoot,
|
||||
0, // MediaFlag
|
||||
NULL, // Label
|
||||
TRUE, // QuickFormat
|
||||
0, // ClusterSize
|
||||
NULL); // Callback
|
||||
DPRINT("VfatFormat() status 0x%.08x\n", Status);
|
||||
Status = VfatFormat (DriveRoot,
|
||||
0, // MediaFlag
|
||||
NULL, // Label
|
||||
TRUE, // QuickFormat
|
||||
0, // ClusterSize
|
||||
NULL); // Callback
|
||||
DPRINT1("VfatFormat() status 0x%.08x\n", Status);
|
||||
|
||||
VfatCleanup();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: partlist.c,v 1.17 2003/08/12 15:56:21 ekohl Exp $
|
||||
/* $Id: partlist.c,v 1.18 2003/08/18 17:39:26 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.c
|
||||
|
@ -47,33 +47,28 @@ GetDriverName (PDISKENTRY DiskEntry)
|
|||
WCHAR KeyName[32];
|
||||
NTSTATUS Status;
|
||||
|
||||
#if 0
|
||||
RtlCreateUnicodeString (&DiskEntry->DriverName,
|
||||
L"atapi");
|
||||
#endif
|
||||
RtlInitUnicodeString (&DiskEntry->DriverName,
|
||||
NULL);
|
||||
|
||||
RtlInitUnicodeString(&DiskEntry->DriverName,
|
||||
NULL);
|
||||
swprintf (KeyName,
|
||||
L"\\Scsi\\Scsi Port %lu",
|
||||
DiskEntry->Port);
|
||||
|
||||
swprintf(KeyName,
|
||||
L"\\Scsi\\Scsi Port %lu",
|
||||
DiskEntry->Port);
|
||||
|
||||
RtlZeroMemory(&QueryTable,
|
||||
sizeof(QueryTable));
|
||||
RtlZeroMemory (&QueryTable,
|
||||
sizeof(QueryTable));
|
||||
|
||||
QueryTable[0].Name = L"Driver";
|
||||
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||
QueryTable[0].EntryContext = &DiskEntry->DriverName;
|
||||
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_DEVICEMAP,
|
||||
KeyName,
|
||||
QueryTable,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
Status = RtlQueryRegistryValues (RTL_REGISTRY_DEVICEMAP,
|
||||
KeyName,
|
||||
QueryTable,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
|
||||
DPRINT1 ("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,9 +99,9 @@ AssignDriverLetters (PPARTLIST List)
|
|||
PartEntry->DriveLetter = 0;
|
||||
|
||||
if (PartEntry->Unpartitioned == FALSE &&
|
||||
!IsContainerPartition(PartEntry->PartInfo[0].PartitionType))
|
||||
!IsContainerPartition (PartEntry->PartInfo[0].PartitionType))
|
||||
{
|
||||
if (IsRecognizedPartition(PartEntry->PartInfo[0].PartitionType) ||
|
||||
if (IsRecognizedPartition (PartEntry->PartInfo[0].PartitionType) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED &&
|
||||
PartEntry->PartInfo[0].PartitionLength.QuadPart != 0LL))
|
||||
{
|
||||
|
@ -142,9 +137,9 @@ AssignDriverLetters (PPARTLIST List)
|
|||
PartEntry->DriveLetter = 0;
|
||||
|
||||
if (PartEntry->Unpartitioned == FALSE &&
|
||||
!IsContainerPartition(PartEntry->PartInfo[0].PartitionType))
|
||||
!IsContainerPartition (PartEntry->PartInfo[0].PartitionType))
|
||||
{
|
||||
if (IsRecognizedPartition(PartEntry->PartInfo[0].PartitionType) ||
|
||||
if (IsRecognizedPartition (PartEntry->PartInfo[0].PartitionType) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED &&
|
||||
PartEntry->PartInfo[0].PartitionLength.QuadPart != 0LL))
|
||||
{
|
||||
|
@ -192,7 +187,7 @@ UpdatePartitionNumbers (PDISKENTRY DiskEntry)
|
|||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (IsContainerPartition(PartEntry->PartInfo[i].PartitionType))
|
||||
if (IsContainerPartition (PartEntry->PartInfo[i].PartitionType))
|
||||
{
|
||||
PartEntry->PartInfo[i].PartitionNumber = 0;
|
||||
}
|
||||
|
@ -297,7 +292,7 @@ ScanForUnpartitionedDiskSpace (PDISKENTRY DiskEntry)
|
|||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if ((!IsContainerPartition(PartEntry->PartInfo[j].PartitionType)) &&
|
||||
if ((!IsContainerPartition (PartEntry->PartInfo[j].PartitionType)) &&
|
||||
(PartEntry->PartInfo[j].PartitionType != PARTITION_ENTRY_UNUSED ||
|
||||
PartEntry->PartInfo[j].PartitionLength.QuadPart != 0LL))
|
||||
{
|
||||
|
@ -394,7 +389,7 @@ AddDiskToList (HANDLE FileHandle,
|
|||
0,
|
||||
&DiskGeometry,
|
||||
sizeof(DISK_GEOMETRY));
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -434,10 +429,10 @@ AddDiskToList (HANDLE FileHandle,
|
|||
DiskEntry->SectorsPerTrack = DiskGeometry.SectorsPerTrack;
|
||||
DiskEntry->BytesPerSector = DiskGeometry.BytesPerSector;
|
||||
|
||||
DPRINT("Cylinders %d\n", DiskEntry->Cylinders);
|
||||
DPRINT("TracksPerCylinder %d\n", DiskEntry->TracksPerCylinder);
|
||||
DPRINT("SectorsPerTrack %d\n", DiskEntry->SectorsPerTrack);
|
||||
DPRINT("BytesPerSector %d\n", DiskEntry->BytesPerSector);
|
||||
DPRINT ("Cylinders %d\n", DiskEntry->Cylinders);
|
||||
DPRINT ("TracksPerCylinder %d\n", DiskEntry->TracksPerCylinder);
|
||||
DPRINT ("SectorsPerTrack %d\n", DiskEntry->SectorsPerTrack);
|
||||
DPRINT ("BytesPerSector %d\n", DiskEntry->BytesPerSector);
|
||||
|
||||
DiskEntry->DiskSize =
|
||||
DiskGeometry.Cylinders.QuadPart *
|
||||
|
@ -521,10 +516,6 @@ CreatePartitionList (SHORT Left,
|
|||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
// List->Left = 0;
|
||||
// List->Top = 0;
|
||||
// List->Right = 0;
|
||||
// List->Bottom = 0;
|
||||
List->Left = Left;
|
||||
List->Top = Top;
|
||||
List->Right = Right;
|
||||
|
@ -621,26 +612,6 @@ DestroyPartitionList (PPARTLIST List)
|
|||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
#if 0
|
||||
COORD coPos;
|
||||
USHORT Width;
|
||||
|
||||
/* clear occupied screen area */
|
||||
coPos.X = List->Left;
|
||||
Width = List->Right - List->Left + 1;
|
||||
for (coPos.Y = List->Top; coPos.Y <= List->Bottom; coPos.Y++)
|
||||
{
|
||||
FillConsoleOutputAttribute(0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&i);
|
||||
|
||||
FillConsoleOutputCharacter(' ',
|
||||
Width,
|
||||
coPos,
|
||||
&i);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Release disk and partition info */
|
||||
while (!IsListEmpty (&List->DiskListHead))
|
||||
|
@ -748,14 +719,13 @@ PrintPartitionData (PPARTLIST List,
|
|||
Unit = "KB";
|
||||
}
|
||||
|
||||
sprintf(LineBuffer,
|
||||
" Unpartitioned space %6I64u %s",
|
||||
PartSize,
|
||||
Unit);
|
||||
sprintf (LineBuffer,
|
||||
" Unpartitioned space %6I64u %s",
|
||||
PartSize,
|
||||
Unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Determine partition type */
|
||||
PartType = NULL;
|
||||
if (PartEntry->New == TRUE)
|
||||
|
@ -826,23 +796,23 @@ PrintPartitionData (PPARTLIST List,
|
|||
Attribute = (List->CurrentDisk == DiskEntry &&
|
||||
List->CurrentPartition == PartEntry) ? 0x71 : 0x17;
|
||||
|
||||
FillConsoleOutputCharacter(' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
coPos.X += 4;
|
||||
Width -= 8;
|
||||
FillConsoleOutputAttribute(Attribute,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputAttribute (Attribute,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
coPos.X++;
|
||||
Width -= 2;
|
||||
WriteConsoleOutputCharacters(LineBuffer,
|
||||
min(strlen(LineBuffer), Width),
|
||||
coPos);
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width),
|
||||
coPos);
|
||||
|
||||
List->Line++;
|
||||
}
|
||||
|
@ -889,47 +859,47 @@ PrintDiskData (PPARTLIST List,
|
|||
|
||||
if (DiskEntry->DriverName.Length > 0)
|
||||
{
|
||||
sprintf(LineBuffer,
|
||||
"%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
|
||||
DiskSize,
|
||||
Unit,
|
||||
DiskEntry->DiskNumber,
|
||||
DiskEntry->Port,
|
||||
DiskEntry->Bus,
|
||||
DiskEntry->Id,
|
||||
&DiskEntry->DriverName);
|
||||
sprintf (LineBuffer,
|
||||
"%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
|
||||
DiskSize,
|
||||
Unit,
|
||||
DiskEntry->DiskNumber,
|
||||
DiskEntry->Port,
|
||||
DiskEntry->Bus,
|
||||
DiskEntry->Id,
|
||||
&DiskEntry->DriverName);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(LineBuffer,
|
||||
"%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
|
||||
DiskSize,
|
||||
Unit,
|
||||
DiskEntry->DiskNumber,
|
||||
DiskEntry->Port,
|
||||
DiskEntry->Bus,
|
||||
DiskEntry->Id);
|
||||
sprintf (LineBuffer,
|
||||
"%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
|
||||
DiskSize,
|
||||
Unit,
|
||||
DiskEntry->DiskNumber,
|
||||
DiskEntry->Port,
|
||||
DiskEntry->Bus,
|
||||
DiskEntry->Id);
|
||||
}
|
||||
|
||||
FillConsoleOutputAttribute(0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputAttribute (0x17,
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
FillConsoleOutputCharacter(' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (' ',
|
||||
Width,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
coPos.X++;
|
||||
WriteConsoleOutputCharacters(LineBuffer,
|
||||
min(strlen(LineBuffer), Width - 2),
|
||||
coPos);
|
||||
WriteConsoleOutputCharacters (LineBuffer,
|
||||
min (strlen (LineBuffer), Width - 2),
|
||||
coPos);
|
||||
|
||||
List->Line++;
|
||||
|
||||
/* Print separator line */
|
||||
PrintEmptyLine(List);
|
||||
PrintEmptyLine (List);
|
||||
|
||||
/* Print partition lines*/
|
||||
Entry = DiskEntry->PartListHead.Flink;
|
||||
|
@ -946,7 +916,7 @@ PrintDiskData (PPARTLIST List,
|
|||
}
|
||||
|
||||
/* Print separator line */
|
||||
PrintEmptyLine(List);
|
||||
PrintEmptyLine (List);
|
||||
}
|
||||
|
||||
|
||||
|
@ -964,67 +934,67 @@ DrawPartitionList (PPARTLIST List)
|
|||
/* draw upper left corner */
|
||||
coPos.X = List->Left;
|
||||
coPos.Y = List->Top;
|
||||
FillConsoleOutputCharacter(0xDA, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xDA, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* draw upper edge */
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Top;
|
||||
FillConsoleOutputCharacter(0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* draw upper right corner */
|
||||
coPos.X = List->Right;
|
||||
coPos.Y = List->Top;
|
||||
FillConsoleOutputCharacter(0xBF, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xBF, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* draw left and right edge */
|
||||
for (i = List->Top + 1; i < List->Bottom; i++)
|
||||
{
|
||||
coPos.X = List->Left;
|
||||
coPos.Y = i;
|
||||
FillConsoleOutputCharacter(0xB3, // '|',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xB3, // '|',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
coPos.X = List->Right;
|
||||
FillConsoleOutputCharacter(0xB3, //'|',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xB3, //'|',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
/* draw lower left corner */
|
||||
coPos.X = List->Left;
|
||||
coPos.Y = List->Bottom;
|
||||
FillConsoleOutputCharacter(0xC0, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xC0, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* draw lower edge */
|
||||
coPos.X = List->Left + 1;
|
||||
coPos.Y = List->Bottom;
|
||||
FillConsoleOutputCharacter(0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xC4, // '-',
|
||||
List->Right - List->Left - 1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* draw lower right corner */
|
||||
coPos.X = List->Right;
|
||||
coPos.Y = List->Bottom;
|
||||
FillConsoleOutputCharacter(0xD9, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
FillConsoleOutputCharacter (0xD9, // '+',
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
|
||||
/* print list entries */
|
||||
List->Line = 0;
|
||||
|
@ -1166,45 +1136,49 @@ ScrollUpPartitionList (PPARTLIST List)
|
|||
|
||||
|
||||
VOID
|
||||
GetActiveBootPartition (PPARTLIST List,
|
||||
PDISKENTRY *DiskEntry,
|
||||
PPARTENTRY *PartEntry)
|
||||
SetActiveBootPartition (PPARTLIST List)
|
||||
{
|
||||
PDISKENTRY LocalDiskEntry;
|
||||
PPARTENTRY LocalPartEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
ULONG i;
|
||||
|
||||
*DiskEntry = NULL;
|
||||
*PartEntry = NULL;
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
|
||||
/* Check for empty disk list */
|
||||
if (IsListEmpty (&List->DiskListHead))
|
||||
return;
|
||||
{
|
||||
List->ActiveBootDisk = NULL;
|
||||
List->ActiveBootPartition = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get first disk entry from the disk list */
|
||||
Entry = List->DiskListHead.Flink;
|
||||
LocalDiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
||||
DiskEntry = CONTAINING_RECORD (List->DiskListHead.Flink,
|
||||
DISKENTRY,
|
||||
ListEntry);
|
||||
|
||||
/* Check for empty partition list */
|
||||
if (IsListEmpty (&LocalDiskEntry->PartListHead))
|
||||
return;
|
||||
|
||||
/* Search for active partition */
|
||||
Entry = LocalDiskEntry->PartListHead.Flink;
|
||||
while (Entry != &LocalDiskEntry->PartListHead)
|
||||
if (IsListEmpty (&DiskEntry->PartListHead))
|
||||
{
|
||||
LocalPartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
|
||||
|
||||
if (LocalPartEntry->PartInfo[0].BootIndicator)
|
||||
{
|
||||
*DiskEntry = LocalDiskEntry;
|
||||
*PartEntry = LocalPartEntry;
|
||||
return;
|
||||
}
|
||||
|
||||
Entry = Entry->Flink;
|
||||
List->ActiveBootDisk = NULL;
|
||||
List->ActiveBootPartition = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
PartEntry = CONTAINING_RECORD (DiskEntry->PartListHead.Flink,
|
||||
PARTENTRY,
|
||||
ListEntry);
|
||||
|
||||
/* Set active boot partition 1 */
|
||||
if (PartEntry->PartInfo[0].BootIndicator == FALSE &&
|
||||
PartEntry->PartInfo[1].BootIndicator == FALSE &&
|
||||
PartEntry->PartInfo[2].BootIndicator == FALSE &&
|
||||
PartEntry->PartInfo[3].BootIndicator == FALSE)
|
||||
{
|
||||
PartEntry->PartInfo[0].BootIndicator == TRUE;
|
||||
PartEntry->PartInfo[0].RewritePartition == TRUE;
|
||||
DiskEntry->Modified = TRUE;
|
||||
}
|
||||
|
||||
/* FIXME: Might be incorrect if partitions were created by Linux FDISK */
|
||||
List->ActiveBootDisk = DiskEntry;
|
||||
List->ActiveBootPartition = PartEntry;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1661,7 +1635,6 @@ DeleteCurrentPartition (PPARTLIST List)
|
|||
BOOLEAN
|
||||
WritePartitionsToDisk (PPARTLIST List)
|
||||
{
|
||||
#if 0
|
||||
PDRIVE_LAYOUT_INFORMATION DriveLayout;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
|
@ -1776,22 +1749,25 @@ WritePartitionsToDisk (PPARTLIST List)
|
|||
DriveLayoutSize,
|
||||
NULL,
|
||||
0);
|
||||
NtClose (FileHandle);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT1 ("NtDeviceIoControlFile() failed (Status %lx)\n", Status);
|
||||
NtClose (FileHandle);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RtlFreeHeap (ProcessHeap,
|
||||
0,
|
||||
DriveLayout);
|
||||
|
||||
/* FIXME: Install MBR code */
|
||||
|
||||
NtClose (FileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
Entry1 = Entry1->Flink;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: partlist.h,v 1.17 2003/08/12 15:56:21 ekohl Exp $
|
||||
/* $Id: partlist.h,v 1.18 2003/08/18 17:39:26 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.h
|
||||
|
@ -103,11 +103,8 @@ typedef struct _PARTLIST
|
|||
PDISKENTRY CurrentDisk;
|
||||
PPARTENTRY CurrentPartition;
|
||||
|
||||
#if 0
|
||||
/* Not used yet! */
|
||||
PDISKENTRY ActiveBootDisk;
|
||||
PPARTENTRY ActiveBootPartition;
|
||||
#endif
|
||||
|
||||
LIST_ENTRY DiskListHead;
|
||||
|
||||
|
@ -134,9 +131,7 @@ VOID
|
|||
ScrollUpPartitionList (PPARTLIST List);
|
||||
|
||||
VOID
|
||||
GetActiveBootPartition(PPARTLIST List,
|
||||
PDISKENTRY *DiskEntry,
|
||||
PPARTENTRY *PartEntry);
|
||||
SetActiveBootPartition (PPARTLIST List);
|
||||
|
||||
VOID
|
||||
CreateNewPartition (PPARTLIST List,
|
||||
|
|
|
@ -94,9 +94,6 @@ UNICODE_STRING SourceRootPath;
|
|||
|
||||
static PPARTLIST PartitionList = NULL;
|
||||
|
||||
static PDISKENTRY ActiveBootDisk = NULL;
|
||||
static PPARTENTRY ActiveBootPartition = NULL;
|
||||
|
||||
static PFILE_SYSTEM_LIST FileSystemList = NULL;
|
||||
|
||||
|
||||
|
@ -677,7 +674,6 @@ InstallIntroPage(PINPUT_RECORD Ir)
|
|||
static PAGE_NUMBER
|
||||
SelectPartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
SHORT xScreen;
|
||||
SHORT yScreen;
|
||||
|
||||
|
@ -691,9 +687,6 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
SetStatusText(" Please wait...");
|
||||
|
||||
RtlFreeUnicodeString(&DestinationPath);
|
||||
RtlFreeUnicodeString(&DestinationRootPath);
|
||||
|
||||
GetScreenSize(&xScreen, &yScreen);
|
||||
|
||||
if (PartitionList == NULL)
|
||||
|
@ -755,54 +748,9 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
CreateNewPartition (PartitionList,
|
||||
0ULL,
|
||||
TRUE);
|
||||
|
||||
/* FIXME: Update drive letters and partition numbers */
|
||||
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlFreeUnicodeString (&DestinationRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&DestinationRootPath,
|
||||
PathBuffer);
|
||||
|
||||
GetActiveBootPartition (PartitionList,
|
||||
&ActiveBootDisk,
|
||||
&ActiveBootPartition);
|
||||
|
||||
RtlFreeUnicodeString (&SystemRootPath);
|
||||
if (ActiveBootDisk != NULL && ActiveBootPartition != NULL)
|
||||
{
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
ActiveBootDisk->DiskNumber,
|
||||
ActiveBootPartition->PartInfo[0].PartitionNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* FIXME:
|
||||
* Check whether partition can be activated.
|
||||
* We may have to force Disk0\Partition1.
|
||||
* Mark partition active.
|
||||
*/
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
}
|
||||
RtlCreateUnicodeString (&SystemRootPath,
|
||||
PathBuffer);
|
||||
|
||||
DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
||||
DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_C) /* C */
|
||||
{
|
||||
|
@ -1347,7 +1295,6 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
|
|||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
// BOOLEAN ForceFormat;
|
||||
ULONGLONG DiskSize;
|
||||
ULONGLONG PartSize;
|
||||
PCHAR DiskUnit;
|
||||
|
@ -1488,11 +1435,8 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
|
|||
SetTextXY(8, 21, "\x07 Press ENTER to format the partition.");
|
||||
SetTextXY(8, 23, "\x07 Press ESC to select another partition.");
|
||||
|
||||
// ForceFormat = (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED);
|
||||
|
||||
if (FileSystemList == NULL)
|
||||
{
|
||||
// FileSystemList = CreateFileSystemList (6, 26, ForceFormat, FsFat);
|
||||
FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, FsFat);
|
||||
if (FileSystemList == NULL)
|
||||
{
|
||||
|
@ -1536,7 +1480,6 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
||||
{
|
||||
#if 0
|
||||
if (FileSystemList->CurrentFileSystem == FsKeep)
|
||||
{
|
||||
return CHECK_FILE_SYSTEM_PAGE;
|
||||
|
@ -1545,8 +1488,6 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
|
|||
{
|
||||
return FORMAT_PARTITION_PAGE;
|
||||
}
|
||||
#endif
|
||||
return FORMAT_PARTITION_PAGE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,14 +1498,16 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
|
|||
static ULONG
|
||||
FormatPartitionPage (PINPUT_RECORD Ir)
|
||||
{
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
// NTSTATUS Status;
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
//#ifndef NDEBUG
|
||||
ULONG Line;
|
||||
ULONG i;
|
||||
//#endif
|
||||
|
||||
|
||||
SetTextXY(6, 8, "Format partition");
|
||||
|
@ -1637,7 +1580,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
//#if 0
|
||||
//#ifndef NDEBUG
|
||||
PrintTextXY (6, 12,
|
||||
"Disk: %I64u Cylinder: %I64u Track: %I64u",
|
||||
DiskEntry->DiskSize,
|
||||
|
@ -1675,6 +1618,8 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
}
|
||||
//#endif
|
||||
|
||||
SetActiveBootPartition (PartitionList);
|
||||
|
||||
if (WritePartitionsToDisk (PartitionList) == FALSE)
|
||||
{
|
||||
DPRINT ("WritePartitionsToDisk() failed\n");
|
||||
|
@ -1693,17 +1638,36 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
|
||||
SetStatusText (" Press any key ...");
|
||||
ConInKey(Ir);
|
||||
|
||||
#if 0
|
||||
/* Set DestinationRootPath */
|
||||
RtlFreeUnicodeString (&DestinationRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&DestinationRootPath,
|
||||
PathBuffer);
|
||||
DPRINT1 ("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
||||
|
||||
|
||||
/* Set SystemRootPath */
|
||||
RtlFreeUnicodeString (&SystemRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->ActiveBootDisk->DiskNumber,
|
||||
PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&SystemRootPath,
|
||||
PathBuffer);
|
||||
DPRINT1 ("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
|
||||
|
||||
switch (FileSystemList->CurrentFileSystem)
|
||||
{
|
||||
case FsFat:
|
||||
Status = FormatPartition (&DestinationRootPath);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT1("FormatPartition() failed with status 0x%.08x\n", Status);
|
||||
DPRINT1 ("FormatPartition() failed with status 0x%.08x\n", Status);
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
@ -1716,6 +1680,10 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
SetStatusText (" Done. Press any key ...");
|
||||
ConInKey(Ir);
|
||||
|
||||
#if 0
|
||||
return INSTALL_DIRECTORY_PAGE;
|
||||
#endif
|
||||
|
||||
|
@ -1730,6 +1698,8 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
static ULONG
|
||||
CheckFileSystemPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
|
||||
SetTextXY(6, 8, "Check file system");
|
||||
|
||||
SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
|
||||
|
@ -1739,6 +1709,28 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
|
|||
|
||||
SetStatusText(" ENTER = Continue F3 = Quit");
|
||||
|
||||
|
||||
/* Set DestinationRootPath */
|
||||
RtlFreeUnicodeString (&DestinationRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&DestinationRootPath,
|
||||
PathBuffer);
|
||||
DPRINT1 ("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
||||
|
||||
/* Set SystemRootPath */
|
||||
RtlFreeUnicodeString (&SystemRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->ActiveBootDisk->DiskNumber,
|
||||
PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&SystemRootPath,
|
||||
PathBuffer);
|
||||
DPRINT1 ("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
ConInKey(Ir);
|
||||
|
@ -2367,7 +2359,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
|
||||
if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
DPRINT1("Error: active partition invalid (unused)\n");
|
||||
PopupError("The active partition is unused (invalid).\n",
|
||||
|
@ -2384,7 +2376,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
|
||||
if (ActiveBootPartition->PartInfo[0].PartitionType == 0x0A)
|
||||
if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == 0x0A)
|
||||
{
|
||||
/* OS/2 boot manager partition */
|
||||
DPRINT1("Found OS/2 boot manager partition\n");
|
||||
|
@ -2402,7 +2394,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (ActiveBootPartition->PartInfo[0].PartitionType == 0x83)
|
||||
else if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == 0x83)
|
||||
{
|
||||
/* Linux ext2 partition */
|
||||
DPRINT1("Found Linux ext2 partition\n");
|
||||
|
@ -2420,7 +2412,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_IFS)
|
||||
else if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_IFS)
|
||||
{
|
||||
/* NTFS partition */
|
||||
DPRINT1("Found NTFS partition\n");
|
||||
|
@ -2438,12 +2430,12 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_HUGE) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_XINT13) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
else if ((PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_HUGE) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_XINT13) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
/* FAT or FAT32 partition */
|
||||
DPRINT1("System path: '%wZ'\n", &SystemRootPath);
|
||||
|
@ -2507,8 +2499,8 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
/* Install new bootcode */
|
||||
if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
if ((PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
/* Install FAT32 bootcode */
|
||||
wcscpy(SrcPath, SourceRootPath.Buffer);
|
||||
|
@ -2703,8 +2695,8 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
/* Install new bootsector */
|
||||
if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
if ((PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
wcscpy(SrcPath, SourceRootPath.Buffer);
|
||||
wcscat(SrcPath, L"\\loader\\fat32.bin");
|
||||
|
@ -2864,8 +2856,8 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
/* Install new bootsector */
|
||||
if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
if ((PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
wcscpy(SrcPath, SourceRootPath.Buffer);
|
||||
wcscat(SrcPath, L"\\loader\\fat32.bin");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue