mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Replaced partition arrays by a doubly-linked lists.
Display unpartitioned disk space correctly. svn path=/trunk/; revision=5392
This commit is contained in:
parent
922496846f
commit
94880f6c27
2 changed files with 406 additions and 275 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: partlist.c,v 1.11 2003/08/02 16:49:36 ekohl Exp $
|
/* $Id: partlist.c,v 1.12 2003/08/03 12:20:22 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: subsys/system/usetup/partlist.c
|
* FILE: subsys/system/usetup/partlist.c
|
||||||
|
@ -80,119 +80,153 @@ AddPartitionToList (ULONG DiskNumber,
|
||||||
{
|
{
|
||||||
PPARTENTRY PartEntry;
|
PPARTENTRY PartEntry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG EntryCount;
|
ULONG j;
|
||||||
BOOLEAN LastEntryWasUnused;
|
|
||||||
ULONGLONG LastStartingOffset;
|
|
||||||
ULONGLONG LastPartitionSize;
|
|
||||||
ULONGLONG LastUnusedPartitionSize;
|
|
||||||
ULONG LastUnusedEntry;
|
|
||||||
|
|
||||||
/*
|
for (i = 0; i < LayoutBuffer->PartitionCount; i += 4)
|
||||||
* FIXME:
|
|
||||||
* Determine required number of partiton entries.
|
|
||||||
* This must include entries for unused disk space.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Check for unpartitioned disk */
|
|
||||||
if (LayoutBuffer->PartitionCount == 0)
|
|
||||||
{
|
{
|
||||||
EntryCount = 1;
|
PartEntry = (PPARTENTRY)RtlAllocateHeap (ProcessHeap,
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EntryCount = LayoutBuffer->PartitionCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DiskEntry->PartArray = (PPARTENTRY)RtlAllocateHeap(ProcessHeap,
|
|
||||||
0,
|
0,
|
||||||
EntryCount * sizeof(PARTENTRY));
|
sizeof(PARTENTRY));
|
||||||
DiskEntry->PartCount = EntryCount;
|
if (PartEntry == NULL)
|
||||||
|
|
||||||
RtlZeroMemory(DiskEntry->PartArray,
|
|
||||||
EntryCount * sizeof(PARTENTRY));
|
|
||||||
|
|
||||||
if (LayoutBuffer->PartitionCount == 0)
|
|
||||||
{
|
{
|
||||||
/* Initialize an 'Unpartitioned space' entry */
|
return;
|
||||||
PartEntry = &DiskEntry->PartArray[0];
|
|
||||||
|
|
||||||
PartEntry->Unpartitioned = TRUE;
|
|
||||||
// Start partition at head 1, cylinder 0
|
|
||||||
PartEntry->StartingOffset = DiskEntry->SectorsPerTrack * DiskEntry->BytesPerSector;
|
|
||||||
PartEntry->PartSize = DiskEntry->DiskSize - PartEntry->StartingOffset;
|
|
||||||
PartEntry->Used = FALSE;
|
|
||||||
PartEntry->HidePartEntry = FALSE;
|
|
||||||
PartEntry->PartNumber = 1;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LastEntryWasUnused = FALSE;
|
|
||||||
// Start partition at head 1, cylinder 0
|
|
||||||
LastStartingOffset = DiskEntry->SectorsPerTrack * DiskEntry->BytesPerSector;
|
|
||||||
LastPartitionSize = 0;
|
|
||||||
LastUnusedEntry = -1;
|
|
||||||
LastUnusedPartitionSize = 0;
|
|
||||||
for (i = 0; i < LayoutBuffer->PartitionCount; i++)
|
|
||||||
{
|
|
||||||
PartEntry = &DiskEntry->PartArray[i];
|
|
||||||
|
|
||||||
if ((LayoutBuffer->PartitionEntry[i].PartitionType != PARTITION_ENTRY_UNUSED) &&
|
RtlZeroMemory (PartEntry,
|
||||||
(!IsContainerPartition(LayoutBuffer->PartitionEntry[i].PartitionType)))
|
sizeof(PARTENTRY));
|
||||||
{
|
|
||||||
LastUnusedPartitionSize = LayoutBuffer->PartitionEntry[i].StartingOffset.QuadPart
|
|
||||||
- (LastStartingOffset + LastPartitionSize);
|
|
||||||
if (LastUnusedEntry != -1)
|
|
||||||
{
|
|
||||||
DiskEntry->PartArray[LastUnusedEntry].StartingOffset = LastStartingOffset + LastPartitionSize;
|
|
||||||
DiskEntry->PartArray[LastUnusedEntry].PartSize = LastUnusedPartitionSize;
|
|
||||||
DiskEntry->PartArray[LastUnusedEntry].PartNumber = LastUnusedEntry + 1; /* FIXME: Is this always correct? */
|
|
||||||
}
|
|
||||||
LastStartingOffset = LayoutBuffer->PartitionEntry[i].StartingOffset.QuadPart;
|
|
||||||
LastPartitionSize = LayoutBuffer->PartitionEntry[i].PartitionLength.QuadPart;
|
|
||||||
|
|
||||||
PartEntry->StartingOffset = LayoutBuffer->PartitionEntry[i].StartingOffset.QuadPart;
|
|
||||||
PartEntry->PartSize = LayoutBuffer->PartitionEntry[i].PartitionLength.QuadPart;
|
|
||||||
PartEntry->PartNumber = LayoutBuffer->PartitionEntry[i].PartitionNumber,
|
|
||||||
PartEntry->PartType = LayoutBuffer->PartitionEntry[i].PartitionType;
|
|
||||||
PartEntry->Active = LayoutBuffer->PartitionEntry[i].BootIndicator;
|
|
||||||
|
|
||||||
PartEntry->DriveLetter = GetDriveLetter(DiskNumber,
|
PartEntry->DriveLetter = GetDriveLetter(DiskNumber,
|
||||||
LayoutBuffer->PartitionEntry[i].PartitionNumber);
|
LayoutBuffer->PartitionEntry[i].PartitionNumber);
|
||||||
|
|
||||||
PartEntry->Unpartitioned = FALSE;
|
PartEntry->Unpartitioned = FALSE;
|
||||||
|
|
||||||
PartEntry->Used = TRUE;
|
for (j = 0; j < 4; j++)
|
||||||
PartEntry->HidePartEntry = FALSE;
|
|
||||||
LastEntryWasUnused = FALSE;
|
|
||||||
LastUnusedEntry = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (LastEntryWasUnused)
|
RtlCopyMemory (&PartEntry->PartInfo[j],
|
||||||
{
|
&LayoutBuffer->PartitionEntry[i+j],
|
||||||
/* Group unused entries into one unpartitioned disk space area */
|
sizeof(PARTITION_INFORMATION));
|
||||||
PartEntry->HidePartEntry = TRUE;
|
|
||||||
PartEntry->PartSize = 0;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
InsertTailList (&DiskEntry->PartListHead,
|
||||||
LastUnusedEntry = i;
|
&PartEntry->ListEntry);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
ScanForUnpartitionedDiskSpace (PDISKENTRY DiskEntry)
|
||||||
|
{
|
||||||
|
ULONGLONG LastStartingOffset;
|
||||||
|
ULONGLONG LastPartitionLength;
|
||||||
|
ULONGLONG LastUnusedPartitionLength;
|
||||||
|
PPARTENTRY PartEntry;
|
||||||
|
PPARTENTRY NewPartEntry;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
ULONG i;
|
||||||
|
ULONG j;
|
||||||
|
|
||||||
|
if (IsListEmpty (&DiskEntry->PartListHead))
|
||||||
|
{
|
||||||
|
/* Create a partition table that represents the empty disk */
|
||||||
|
PartEntry = (PPARTENTRY)RtlAllocateHeap (ProcessHeap,
|
||||||
|
0,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
if (PartEntry == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RtlZeroMemory (PartEntry,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
|
||||||
PartEntry->Unpartitioned = TRUE;
|
PartEntry->Unpartitioned = TRUE;
|
||||||
|
PartEntry->UnpartitionedOffset = 0ULL;
|
||||||
|
PartEntry->UnpartitionedLength = DiskEntry->DiskSize;
|
||||||
|
|
||||||
PartEntry->Used = FALSE;
|
InsertTailList (&DiskEntry->PartListHead,
|
||||||
LastEntryWasUnused = TRUE;
|
&PartEntry->ListEntry);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
LastUnusedPartitionSize = DiskEntry->DiskSize
|
|
||||||
- (LastStartingOffset + LastPartitionSize);
|
|
||||||
if (LastUnusedEntry != -1)
|
|
||||||
{
|
{
|
||||||
DiskEntry->PartArray[LastUnusedEntry].StartingOffset = LastStartingOffset + LastPartitionSize;
|
/* Start partition at head 1, cylinder 0 */
|
||||||
DiskEntry->PartArray[LastUnusedEntry].PartSize = LastUnusedPartitionSize;
|
LastStartingOffset = DiskEntry->TrackSize;
|
||||||
DiskEntry->PartArray[LastUnusedEntry].PartNumber = LastUnusedEntry + 1; /* FIXME: Is this always correct? */
|
LastPartitionLength = 0ULL;
|
||||||
|
LastUnusedPartitionLength = 0ULL;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
Entry = DiskEntry->PartListHead.Flink;
|
||||||
|
while (Entry != &DiskEntry->PartListHead)
|
||||||
|
{
|
||||||
|
PartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
for (j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
if ((!IsContainerPartition(PartEntry->PartInfo[j].PartitionType)) &&
|
||||||
|
(PartEntry->PartInfo[j].PartitionType != PARTITION_ENTRY_UNUSED ||
|
||||||
|
PartEntry->PartInfo[j].PartitionLength.QuadPart != 0LL))
|
||||||
|
{
|
||||||
|
LastUnusedPartitionLength =
|
||||||
|
PartEntry->PartInfo[j].StartingOffset.QuadPart -
|
||||||
|
(LastStartingOffset + LastPartitionLength);
|
||||||
|
|
||||||
|
if (LastUnusedPartitionLength >= DiskEntry->CylinderSize)
|
||||||
|
{
|
||||||
|
DPRINT ("Unpartitioned disk space %I64u\n", LastUnusedPartitionLength);
|
||||||
|
|
||||||
|
NewPartEntry = (PPARTENTRY)RtlAllocateHeap (ProcessHeap,
|
||||||
|
0,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
if (NewPartEntry == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RtlZeroMemory (NewPartEntry,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
|
||||||
|
NewPartEntry->Unpartitioned = TRUE;
|
||||||
|
NewPartEntry->UnpartitionedOffset = LastStartingOffset + LastPartitionLength;
|
||||||
|
NewPartEntry->UnpartitionedLength = LastUnusedPartitionLength;
|
||||||
|
if (j == 0)
|
||||||
|
NewPartEntry->UnpartitionedLength -= DiskEntry->TrackSize;
|
||||||
|
|
||||||
|
/* Insert the table into the list */
|
||||||
|
InsertTailList (&PartEntry->ListEntry,
|
||||||
|
&NewPartEntry->ListEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
LastStartingOffset = PartEntry->PartInfo[j].StartingOffset.QuadPart;
|
||||||
|
LastPartitionLength = PartEntry->PartInfo[j].PartitionLength.QuadPart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 4;
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for trailing unpartitioned disk space */
|
||||||
|
if (DiskEntry->DiskSize > (LastStartingOffset + LastPartitionLength))
|
||||||
|
{
|
||||||
|
LastUnusedPartitionLength =
|
||||||
|
DiskEntry->DiskSize - (LastStartingOffset + LastPartitionLength);
|
||||||
|
|
||||||
|
if (LastUnusedPartitionLength >= DiskEntry->CylinderSize)
|
||||||
|
{
|
||||||
|
DPRINT ("Unpartitioned disk space %I64u\n", LastUnusedPartitionLength);
|
||||||
|
|
||||||
|
NewPartEntry = (PPARTENTRY)RtlAllocateHeap (ProcessHeap,
|
||||||
|
0,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
if (NewPartEntry == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RtlZeroMemory (NewPartEntry,
|
||||||
|
sizeof(PARTENTRY));
|
||||||
|
|
||||||
|
NewPartEntry->Unpartitioned = TRUE;
|
||||||
|
NewPartEntry->UnpartitionedOffset = LastStartingOffset + LastPartitionLength;
|
||||||
|
NewPartEntry->UnpartitionedLength = LastUnusedPartitionLength;
|
||||||
|
|
||||||
|
/* Append the table to the list */
|
||||||
|
InsertTailList (&DiskEntry->PartListHead,
|
||||||
|
&NewPartEntry->ListEntry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,6 +287,8 @@ AddDiskToList (HANDLE FileHandle,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InitializeListHead (&DiskEntry->PartListHead);
|
||||||
|
|
||||||
DiskEntry->Cylinders = DiskGeometry.Cylinders.QuadPart;
|
DiskEntry->Cylinders = DiskGeometry.Cylinders.QuadPart;
|
||||||
DiskEntry->TracksPerCylinder = DiskGeometry.TracksPerCylinder;
|
DiskEntry->TracksPerCylinder = DiskGeometry.TracksPerCylinder;
|
||||||
DiskEntry->SectorsPerTrack = DiskGeometry.SectorsPerTrack;
|
DiskEntry->SectorsPerTrack = DiskGeometry.SectorsPerTrack;
|
||||||
|
@ -268,6 +304,14 @@ AddDiskToList (HANDLE FileHandle,
|
||||||
(ULONGLONG)DiskGeometry.TracksPerCylinder *
|
(ULONGLONG)DiskGeometry.TracksPerCylinder *
|
||||||
(ULONGLONG)DiskGeometry.SectorsPerTrack *
|
(ULONGLONG)DiskGeometry.SectorsPerTrack *
|
||||||
(ULONGLONG)DiskGeometry.BytesPerSector;
|
(ULONGLONG)DiskGeometry.BytesPerSector;
|
||||||
|
DiskEntry->CylinderSize =
|
||||||
|
(ULONGLONG)DiskGeometry.TracksPerCylinder *
|
||||||
|
(ULONGLONG)DiskGeometry.SectorsPerTrack *
|
||||||
|
(ULONGLONG)DiskGeometry.BytesPerSector;
|
||||||
|
DiskEntry->TrackSize =
|
||||||
|
(ULONGLONG)DiskGeometry.SectorsPerTrack *
|
||||||
|
(ULONGLONG)DiskGeometry.BytesPerSector;
|
||||||
|
|
||||||
DiskEntry->DiskNumber = DiskNumber;
|
DiskEntry->DiskNumber = DiskNumber;
|
||||||
DiskEntry->Port = ScsiAddress.PortNumber;
|
DiskEntry->Port = ScsiAddress.PortNumber;
|
||||||
DiskEntry->Bus = ScsiAddress.PathId;
|
DiskEntry->Bus = ScsiAddress.PathId;
|
||||||
|
@ -275,7 +319,8 @@ AddDiskToList (HANDLE FileHandle,
|
||||||
|
|
||||||
GetDriverName (DiskEntry);
|
GetDriverName (DiskEntry);
|
||||||
|
|
||||||
InsertTailList (&List->DiskList, &DiskEntry->ListEntry);
|
InsertTailList (&List->DiskListHead,
|
||||||
|
&DiskEntry->ListEntry);
|
||||||
|
|
||||||
LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap (ProcessHeap,
|
LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap (ProcessHeap,
|
||||||
0,
|
0,
|
||||||
|
@ -300,6 +345,8 @@ AddDiskToList (HANDLE FileHandle,
|
||||||
AddPartitionToList (DiskNumber,
|
AddPartitionToList (DiskNumber,
|
||||||
DiskEntry,
|
DiskEntry,
|
||||||
LayoutBuffer);
|
LayoutBuffer);
|
||||||
|
|
||||||
|
ScanForUnpartitionedDiskSpace (DiskEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlFreeHeap (ProcessHeap,
|
RtlFreeHeap (ProcessHeap,
|
||||||
|
@ -338,9 +385,9 @@ InitializePartitionList(VOID)
|
||||||
List->TopPartition = (ULONG)-1;
|
List->TopPartition = (ULONG)-1;
|
||||||
|
|
||||||
List->CurrentDisk = NULL;
|
List->CurrentDisk = NULL;
|
||||||
List->CurrentPartition = (ULONG)-1;
|
List->CurrentPartition = NULL;
|
||||||
|
|
||||||
InitializeListHead (&List->DiskList);
|
InitializeListHead (&List->DiskListHead);
|
||||||
|
|
||||||
Status = NtQuerySystemInformation(SystemDeviceInformation,
|
Status = NtQuerySystemInformation(SystemDeviceInformation,
|
||||||
&Sdi,
|
&Sdi,
|
||||||
|
@ -386,16 +433,24 @@ InitializePartitionList(VOID)
|
||||||
List->TopPartition = 0;
|
List->TopPartition = 0;
|
||||||
|
|
||||||
/* Search for first usable disk and partition */
|
/* Search for first usable disk and partition */
|
||||||
if (IsListEmpty (&List->DiskList))
|
if (IsListEmpty (&List->DiskListHead))
|
||||||
{
|
{
|
||||||
List->CurrentDisk = NULL;
|
List->CurrentDisk = NULL;
|
||||||
List->CurrentPartition = (ULONG)-1;
|
List->CurrentPartition = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List->CurrentDisk = CONTAINING_RECORD(List->DiskList.Flink, DISKENTRY, ListEntry);
|
List->CurrentDisk = CONTAINING_RECORD(List->DiskListHead.Flink, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
|
if (IsListEmpty (&List->CurrentDisk->PartListHead))
|
||||||
|
{
|
||||||
List->CurrentPartition = 0;
|
List->CurrentPartition = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List->CurrentPartition = CONTAINING_RECORD(List->CurrentDisk->PartListHead.Flink, PARTENTRY, ListEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return(List);
|
return(List);
|
||||||
}
|
}
|
||||||
|
@ -433,7 +488,7 @@ GetPartitionInformation(PPARTLIST List,
|
||||||
PPARTENTRY PartEntry;
|
PPARTENTRY PartEntry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
if (IsListEmpty(&List->DiskList))
|
if (IsListEmpty(&List->DiskListHead))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -471,8 +526,9 @@ GetPartitionInformation(PPARTLIST List,
|
||||||
VOID
|
VOID
|
||||||
DestroyPartitionList(PPARTLIST List)
|
DestroyPartitionList(PPARTLIST List)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
|
PPARTENTRY PartEntry;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
#if 0
|
#if 0
|
||||||
COORD coPos;
|
COORD coPos;
|
||||||
USHORT Width;
|
USHORT Width;
|
||||||
|
@ -495,18 +551,23 @@ DestroyPartitionList(PPARTLIST List)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Release disk and partition info */
|
/* Release disk and partition info */
|
||||||
while (!IsListEmpty (&List->DiskList))
|
while (!IsListEmpty (&List->DiskListHead))
|
||||||
{
|
{
|
||||||
Entry = RemoveHeadList (&List->DiskList);
|
Entry = RemoveHeadList (&List->DiskListHead);
|
||||||
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
/* Release driver name */
|
/* Release driver name */
|
||||||
RtlFreeUnicodeString(&DiskEntry->DriverName);
|
RtlFreeUnicodeString(&DiskEntry->DriverName);
|
||||||
|
|
||||||
/* Release partition array */
|
/* Release partition array */
|
||||||
if (DiskEntry->PartArray != NULL)
|
while (!IsListEmpty (&DiskEntry->PartListHead))
|
||||||
{
|
{
|
||||||
RtlFreeHeap(ProcessHeap, 0, DiskEntry->PartArray);
|
Entry = RemoveHeadList (&DiskEntry->PartListHead);
|
||||||
|
PartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
RtlFreeHeap (ProcessHeap,
|
||||||
|
0,
|
||||||
|
PartEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release disk entry */
|
/* Release disk entry */
|
||||||
|
@ -552,9 +613,8 @@ PrintEmptyLine(PPARTLIST List)
|
||||||
static VOID
|
static VOID
|
||||||
PrintPartitionData(PPARTLIST List,
|
PrintPartitionData(PPARTLIST List,
|
||||||
PDISKENTRY DiskEntry,
|
PDISKENTRY DiskEntry,
|
||||||
SHORT PartIndex)
|
PPARTENTRY PartEntry)
|
||||||
{
|
{
|
||||||
PPARTENTRY PartEntry;
|
|
||||||
CHAR LineBuffer[128];
|
CHAR LineBuffer[128];
|
||||||
COORD coPos;
|
COORD coPos;
|
||||||
ULONG Written;
|
ULONG Written;
|
||||||
|
@ -575,73 +635,93 @@ PrintPartitionData(PPARTLIST List,
|
||||||
coPos.X = List->Left + 1;
|
coPos.X = List->Left + 1;
|
||||||
coPos.Y = List->Top + 1 + List->Line;
|
coPos.Y = List->Top + 1 + List->Line;
|
||||||
|
|
||||||
PartEntry = &DiskEntry->PartArray[PartIndex];
|
|
||||||
|
|
||||||
|
if (PartEntry->Unpartitioned == TRUE)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if (PartEntry->UnpartitionledLength >= 0x280000000ULL) /* 10 GB */
|
||||||
|
{
|
||||||
|
PartSize = (PartEntry->UnpartitionedLength + (1 << 29)) >> 30;
|
||||||
|
Unit = "GB";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (PartEntry->UnpartitionedLength >= 0xA00000ULL) /* 10 MB */
|
||||||
|
{
|
||||||
|
PartSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20;
|
||||||
|
Unit = "MB";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PartSize = (PartEntry->UnpartitionedLength + (1 << 9)) >> 10;
|
||||||
|
Unit = "KB";
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(LineBuffer,
|
||||||
|
" Unpartitioned space %6I64u %s",
|
||||||
|
PartSize,
|
||||||
|
Unit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
/* Determine partition type */
|
/* Determine partition type */
|
||||||
PartType = NULL;
|
PartType = NULL;
|
||||||
if (PartEntry->Unpartitioned == FALSE)
|
if (PartEntry->Unpartitioned == FALSE)
|
||||||
{
|
{
|
||||||
if ((PartEntry->PartType == PARTITION_FAT_12) ||
|
if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
|
||||||
(PartEntry->PartType == PARTITION_FAT_16) ||
|
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
|
||||||
(PartEntry->PartType == PARTITION_HUGE) ||
|
(PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) ||
|
||||||
(PartEntry->PartType == PARTITION_XINT13))
|
(PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13))
|
||||||
{
|
{
|
||||||
PartType = "FAT";
|
PartType = "FAT";
|
||||||
}
|
}
|
||||||
else if ((PartEntry->PartType == PARTITION_FAT32) ||
|
else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||||
(PartEntry->PartType == PARTITION_FAT32_XINT13))
|
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||||
{
|
{
|
||||||
PartType = "FAT32";
|
PartType = "FAT32";
|
||||||
}
|
}
|
||||||
else if (PartEntry->PartType == PARTITION_IFS)
|
else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)
|
||||||
{
|
{
|
||||||
PartType = "NTFS"; /* FIXME: Not quite correct! */
|
PartType = "NTFS"; /* FIXME: Not quite correct! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (PartEntry->PartSize >= 0x280000000ULL) /* 10 GB */
|
if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000ULL) /* 10 GB */
|
||||||
{
|
{
|
||||||
PartSize = (PartEntry->PartSize + (1 << 29)) >> 30;
|
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
|
||||||
Unit = "GB";
|
Unit = "GB";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (PartEntry->PartSize >= 0xA00000ULL) /* 10 MB */
|
if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000ULL) /* 10 MB */
|
||||||
{
|
{
|
||||||
PartSize = (PartEntry->PartSize + (1 << 19)) >> 20;
|
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;
|
||||||
Unit = "MB";
|
Unit = "MB";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PartSize = (PartEntry->PartSize + (1 << 9)) >> 10;
|
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 9)) >> 10;
|
||||||
Unit = "KB";
|
Unit = "KB";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PartEntry->DriveLetter != (CHAR)0)
|
||||||
if (PartEntry->Unpartitioned == TRUE)
|
|
||||||
{
|
|
||||||
sprintf(LineBuffer,
|
|
||||||
" Unpartitioned space %I64u %s",
|
|
||||||
PartSize,
|
|
||||||
Unit);
|
|
||||||
}
|
|
||||||
else if (PartEntry->DriveLetter != (CHAR)0)
|
|
||||||
{
|
{
|
||||||
if (PartType == NULL)
|
if (PartType == NULL)
|
||||||
{
|
{
|
||||||
sprintf(LineBuffer,
|
sprintf(LineBuffer,
|
||||||
"%c: Type %-3lu %I64u %s",
|
"%c: Type %-3lu %6I64u %s",
|
||||||
PartEntry->DriveLetter,
|
PartEntry->DriveLetter,
|
||||||
PartEntry->PartType,
|
PartEntry->PartInfo[0].PartitionType,
|
||||||
PartSize,
|
PartSize,
|
||||||
Unit);
|
Unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(LineBuffer,
|
sprintf(LineBuffer,
|
||||||
"%c: %s %I64u %s",
|
"%c: %-8s %6I64u %s",
|
||||||
PartEntry->DriveLetter,
|
PartEntry->DriveLetter,
|
||||||
PartType,
|
PartType,
|
||||||
PartSize,
|
PartSize,
|
||||||
|
@ -651,15 +731,16 @@ PrintPartitionData(PPARTLIST List,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(LineBuffer,
|
sprintf(LineBuffer,
|
||||||
"-- %s Type -3lu %I64u %s",
|
"-- %-8s Type %-3lu %6I64u %s",
|
||||||
PartEntry->FileSystemName,
|
PartEntry->FileSystemName,
|
||||||
PartEntry->PartType,
|
PartEntry->PartInfo[0].PartitionType,
|
||||||
PartSize,
|
PartSize,
|
||||||
Unit);
|
Unit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Attribute = (List->CurrentDisk == DiskEntry &&
|
Attribute = (List->CurrentDisk == DiskEntry &&
|
||||||
List->CurrentPartition == PartIndex) ? 0x71 : 0x17;
|
List->CurrentPartition == PartEntry) ? 0x71 : 0x17;
|
||||||
|
|
||||||
FillConsoleOutputCharacter(' ',
|
FillConsoleOutputCharacter(' ',
|
||||||
Width,
|
Width,
|
||||||
|
@ -687,6 +768,8 @@ static VOID
|
||||||
PrintDiskData(PPARTLIST List,
|
PrintDiskData(PPARTLIST List,
|
||||||
PDISKENTRY DiskEntry)
|
PDISKENTRY DiskEntry)
|
||||||
{
|
{
|
||||||
|
PPARTENTRY PartEntry;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
CHAR LineBuffer[128];
|
CHAR LineBuffer[128];
|
||||||
COORD coPos;
|
COORD coPos;
|
||||||
ULONG Written;
|
ULONG Written;
|
||||||
|
@ -765,14 +848,17 @@ PrintDiskData(PPARTLIST List,
|
||||||
PrintEmptyLine(List);
|
PrintEmptyLine(List);
|
||||||
|
|
||||||
/* Print partition lines*/
|
/* Print partition lines*/
|
||||||
for (PartIndex = 0; PartIndex < DiskEntry->PartCount; PartIndex++)
|
Entry = DiskEntry->PartListHead.Flink;
|
||||||
{
|
while (Entry != &DiskEntry->PartListHead)
|
||||||
if (!DiskEntry->PartArray[PartIndex].HidePartEntry)
|
|
||||||
{
|
{
|
||||||
|
PartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
/* Print disk entry */
|
||||||
PrintPartitionData (List,
|
PrintPartitionData (List,
|
||||||
DiskEntry,
|
DiskEntry,
|
||||||
PartIndex);
|
PartEntry);
|
||||||
}
|
|
||||||
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print separator line */
|
/* Print separator line */
|
||||||
|
@ -859,8 +945,8 @@ DrawPartitionList(PPARTLIST List)
|
||||||
/* print list entries */
|
/* print list entries */
|
||||||
List->Line = 0;
|
List->Line = 0;
|
||||||
|
|
||||||
Entry = List->DiskList.Flink;
|
Entry = List->DiskListHead.Flink;
|
||||||
while (Entry != &List->DiskList)
|
while (Entry != &List->DiskListHead)
|
||||||
{
|
{
|
||||||
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
|
@ -876,41 +962,59 @@ DrawPartitionList(PPARTLIST List)
|
||||||
VOID
|
VOID
|
||||||
ScrollDownPartitionList(PPARTLIST List)
|
ScrollDownPartitionList(PPARTLIST List)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
ULONG i;
|
PPARTENTRY PartEntry;
|
||||||
|
PLIST_ENTRY Entry1;
|
||||||
|
PLIST_ENTRY Entry2;
|
||||||
|
|
||||||
/* Check for empty disks */
|
/* Check for empty disks */
|
||||||
if (IsListEmpty (&List->DiskList))
|
if (IsListEmpty (&List->DiskListHead))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check for next usable entry on current disk */
|
/* Check for next usable entry on current disk */
|
||||||
for (i = List->CurrentPartition + 1; i < List->CurrentDisk->PartCount; i++)
|
if (List->CurrentPartition != NULL)
|
||||||
{
|
{
|
||||||
if (List->CurrentDisk->PartArray[i].HidePartEntry == FALSE)
|
Entry2 = List->CurrentPartition->ListEntry.Flink;
|
||||||
|
while (Entry2 != &List->CurrentDisk->PartListHead)
|
||||||
{
|
{
|
||||||
List->CurrentPartition = i;
|
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
// if (PartEntry->HidePartEntry == FALSE)
|
||||||
|
{
|
||||||
|
List->CurrentPartition = PartEntry;
|
||||||
DrawPartitionList (List);
|
DrawPartitionList (List);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Entry2 = Entry2->Flink;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for first usable entry on next disk */
|
/* Check for first usable entry on next disk */
|
||||||
Entry = List->CurrentDisk->ListEntry.Flink;
|
if (List->CurrentDisk != NULL)
|
||||||
while (Entry != &List->DiskList)
|
|
||||||
{
|
{
|
||||||
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
Entry1 = List->CurrentDisk->ListEntry.Flink;
|
||||||
for (i = 0; i < DiskEntry->PartCount; i++)
|
while (Entry1 != &List->DiskListHead)
|
||||||
{
|
{
|
||||||
if (DiskEntry->PartArray[i].HidePartEntry == FALSE)
|
DiskEntry = CONTAINING_RECORD (Entry1, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
|
Entry2 = DiskEntry->PartListHead.Flink;
|
||||||
|
while (Entry2 != &DiskEntry->PartListHead)
|
||||||
|
{
|
||||||
|
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
// if (PartEntry->HidePartEntry == FALSE)
|
||||||
{
|
{
|
||||||
List->CurrentDisk = DiskEntry;
|
List->CurrentDisk = DiskEntry;
|
||||||
List->CurrentPartition = i;
|
List->CurrentPartition = PartEntry;
|
||||||
DrawPartitionList (List);
|
DrawPartitionList (List);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entry2 = Entry2->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry1 = Entry1->Flink;
|
||||||
}
|
}
|
||||||
Entry = Entry->Flink;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,41 +1022,61 @@ ScrollDownPartitionList(PPARTLIST List)
|
||||||
VOID
|
VOID
|
||||||
ScrollUpPartitionList(PPARTLIST List)
|
ScrollUpPartitionList(PPARTLIST List)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
|
PPARTENTRY PartEntry;
|
||||||
|
PLIST_ENTRY Entry1;
|
||||||
|
PLIST_ENTRY Entry2;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
/* Check for empty disks */
|
/* Check for empty disks */
|
||||||
if (IsListEmpty (&List->DiskList))
|
if (IsListEmpty (&List->DiskListHead))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check for previous usable entry on current disk */
|
/* check for previous usable entry on current disk */
|
||||||
for (i = List->CurrentPartition - 1; i != (ULONG)-1; i--)
|
if (List->CurrentPartition != NULL)
|
||||||
{
|
{
|
||||||
if (List->CurrentDisk->PartArray[i].HidePartEntry == FALSE)
|
Entry2 = List->CurrentPartition->ListEntry.Blink;
|
||||||
|
while (Entry2 != &List->CurrentDisk->PartListHead)
|
||||||
{
|
{
|
||||||
List->CurrentPartition = i;
|
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
// if (PartEntry->HidePartEntry == FALSE)
|
||||||
|
{
|
||||||
|
List->CurrentPartition = PartEntry;
|
||||||
DrawPartitionList (List);
|
DrawPartitionList (List);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Entry2 = Entry2->Blink;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* check for last usable entry on previous disk */
|
/* check for last usable entry on previous disk */
|
||||||
Entry = List->CurrentDisk->ListEntry.Blink;
|
if (List->CurrentDisk != NULL)
|
||||||
while (Entry != &List->DiskList)
|
|
||||||
{
|
{
|
||||||
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
Entry1 = List->CurrentDisk->ListEntry.Blink;
|
||||||
for (i = DiskEntry->PartCount - 1; i != (ULONG)-1; i--)
|
while (Entry1 != &List->DiskListHead)
|
||||||
{
|
{
|
||||||
if (DiskEntry->PartArray[i].HidePartEntry == FALSE)
|
DiskEntry = CONTAINING_RECORD (Entry1, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
|
Entry2 = DiskEntry->PartListHead.Blink;
|
||||||
|
while (Entry2 != &DiskEntry->PartListHead)
|
||||||
|
{
|
||||||
|
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
|
||||||
|
|
||||||
|
// if (PartEntry->HidePartEntry == FALSE)
|
||||||
{
|
{
|
||||||
List->CurrentDisk = DiskEntry;
|
List->CurrentDisk = DiskEntry;
|
||||||
List->CurrentPartition = i;
|
List->CurrentPartition = PartEntry;
|
||||||
DrawPartitionList (List);
|
DrawPartitionList (List);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entry2 = Entry2->Blink;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry1 = Entry1->Blink;
|
||||||
}
|
}
|
||||||
Entry = Entry->Blink;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,15 +1093,10 @@ GetSelectedPartition(PPARTLIST List,
|
||||||
|
|
||||||
DiskEntry = List->CurrentDisk;
|
DiskEntry = List->CurrentDisk;
|
||||||
|
|
||||||
if (List->CurrentPartition >= DiskEntry->PartCount)
|
if (List->CurrentPartition == NULL)
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
|
|
||||||
PartEntry = &DiskEntry->PartArray[List->CurrentPartition];
|
PartEntry = List->CurrentPartition;
|
||||||
|
|
||||||
if (PartEntry->Used == FALSE)
|
|
||||||
{
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy disk-specific data */
|
/* Copy disk-specific data */
|
||||||
Data->DiskSize = DiskEntry->DiskSize;
|
Data->DiskSize = DiskEntry->DiskSize;
|
||||||
|
@ -1007,12 +1126,12 @@ GetSelectedPartition(PPARTLIST List,
|
||||||
/* Copy partition-specific data */
|
/* Copy partition-specific data */
|
||||||
Data->CreatePartition = FALSE;
|
Data->CreatePartition = FALSE;
|
||||||
Data->NewPartSize = 0;
|
Data->NewPartSize = 0;
|
||||||
Data->PartSize = PartEntry->PartSize;
|
Data->PartSize = PartEntry->PartInfo[0].PartitionLength.QuadPart;
|
||||||
Data->PartNumber = PartEntry->PartNumber;
|
Data->PartNumber = PartEntry->PartInfo[0].PartitionNumber;
|
||||||
Data->PartType = PartEntry->PartType;
|
Data->PartType = PartEntry->PartInfo[0].PartitionType;
|
||||||
Data->DriveLetter = PartEntry->DriveLetter;
|
Data->DriveLetter = PartEntry->DriveLetter;
|
||||||
|
|
||||||
return(TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1022,24 +1141,23 @@ GetActiveBootPartition(PPARTLIST List,
|
||||||
{
|
{
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
PPARTENTRY PartEntry;
|
PPARTENTRY PartEntry;
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
if (List->CurrentDisk == NULL)
|
if (IsListEmpty (&List->DiskListHead))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DiskEntry = List->CurrentDisk;
|
/* Get first disk entry from the disk list */
|
||||||
|
Entry = List->DiskListHead.Flink;
|
||||||
|
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
|
||||||
|
|
||||||
for (i = 0; i < DiskEntry->PartCount; i++)
|
Entry = DiskEntry->PartListHead.Flink;
|
||||||
|
while (Entry != &DiskEntry->PartListHead)
|
||||||
{
|
{
|
||||||
if (DiskEntry->PartArray[i].Active)
|
PartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
|
||||||
{
|
|
||||||
PartEntry = &DiskEntry->PartArray[i];
|
|
||||||
|
|
||||||
if (PartEntry->Used == FALSE)
|
if (PartEntry->PartInfo[0].BootIndicator)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy disk-specific data */
|
/* Copy disk-specific data */
|
||||||
Data->DiskSize = DiskEntry->DiskSize;
|
Data->DiskSize = DiskEntry->DiskSize;
|
||||||
Data->DiskNumber = DiskEntry->DiskNumber;
|
Data->DiskNumber = DiskEntry->DiskNumber;
|
||||||
|
@ -1066,16 +1184,18 @@ GetActiveBootPartition(PPARTLIST List,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy partition-specific data */
|
/* Copy partition-specific data */
|
||||||
Data->PartSize = PartEntry->PartSize;
|
Data->PartSize = PartEntry->PartInfo[0].PartitionLength.QuadPart;
|
||||||
Data->PartNumber = PartEntry->PartNumber;
|
Data->PartNumber = PartEntry->PartInfo[0].PartitionNumber;
|
||||||
Data->PartType = PartEntry->PartType;
|
Data->PartType = PartEntry->PartInfo[0].PartitionType;
|
||||||
Data->DriveLetter = PartEntry->DriveLetter;
|
Data->DriveLetter = PartEntry->DriveLetter;
|
||||||
|
|
||||||
return(TRUE);
|
return TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(FALSE);
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1084,6 +1204,7 @@ CreateSelectedPartition(PPARTLIST List,
|
||||||
ULONG PartType,
|
ULONG PartType,
|
||||||
ULONGLONG NewPartSize)
|
ULONGLONG NewPartSize)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
PPARTENTRY PartEntry;
|
PPARTENTRY PartEntry;
|
||||||
ULONG PartEntryNumber;
|
ULONG PartEntryNumber;
|
||||||
|
@ -1097,7 +1218,8 @@ CreateSelectedPartition(PPARTLIST List,
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
|
|
||||||
DiskEntry = List->CurrentDisk;
|
DiskEntry = List->CurrentDisk;
|
||||||
PartEntry = &DiskEntry->PartArray[List->CurrentPartition];
|
PartEntry = List->CurrentPartition;
|
||||||
|
|
||||||
PartEntry->PartType = PartType;
|
PartEntry->PartType = PartType;
|
||||||
PartEntryNumber = List->CurrentPartition;
|
PartEntryNumber = List->CurrentPartition;
|
||||||
|
|
||||||
|
@ -1186,6 +1308,7 @@ CreateSelectedPartition(PPARTLIST List,
|
||||||
|
|
||||||
NtClose(FileHandle);
|
NtClose(FileHandle);
|
||||||
RtlFreeHeap(ProcessHeap, 0, LayoutBuffer);
|
RtlFreeHeap(ProcessHeap, 0, LayoutBuffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1194,9 +1317,10 @@ CreateSelectedPartition(PPARTLIST List,
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DeleteSelectedPartition(PPARTLIST List)
|
DeleteSelectedPartition(PPARTLIST List)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
PDISKENTRY DiskEntry;
|
PDISKENTRY DiskEntry;
|
||||||
PPARTENTRY PartEntry;
|
PPARTENTRY PartEntry;
|
||||||
ULONG PartEntryNumber;
|
// ULONG PartEntryNumber;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
DRIVE_LAYOUT_INFORMATION *LayoutBuffer;
|
DRIVE_LAYOUT_INFORMATION *LayoutBuffer;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
@ -1207,9 +1331,10 @@ DeleteSelectedPartition(PPARTLIST List)
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
|
|
||||||
DiskEntry = List->CurrentDisk;
|
DiskEntry = List->CurrentDisk;
|
||||||
PartEntry = &DiskEntry->PartArray[List->CurrentPartition];
|
PartEntry = List->CurrentPartition;
|
||||||
PartEntry->PartType = PARTITION_ENTRY_UNUSED;
|
PartEntry->PartType = PARTITION_ENTRY_UNUSED;
|
||||||
PartEntryNumber = List->CurrentPartition;
|
|
||||||
|
// PartEntryNumber = List->CurrentPartition;
|
||||||
|
|
||||||
DPRINT1("DeleteSelectedPartition(PartEntryNumber = %d)\n", PartEntryNumber);
|
DPRINT1("DeleteSelectedPartition(PartEntryNumber = %d)\n", PartEntryNumber);
|
||||||
DPRINT1("PartEntry->StartingOffset %d\n", PartEntry->StartingOffset);
|
DPRINT1("PartEntry->StartingOffset %d\n", PartEntry->StartingOffset);
|
||||||
|
@ -1294,6 +1419,7 @@ DeleteSelectedPartition(PPARTLIST List)
|
||||||
|
|
||||||
NtClose(FileHandle);
|
NtClose(FileHandle);
|
||||||
RtlFreeHeap(ProcessHeap, 0, LayoutBuffer);
|
RtlFreeHeap(ProcessHeap, 0, LayoutBuffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: partlist.h,v 1.11 2003/08/02 16:49:36 ekohl Exp $
|
/* $Id: partlist.h,v 1.12 2003/08/03 12:20:22 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: subsys/system/usetup/partlist.h
|
* FILE: subsys/system/usetup/partlist.h
|
||||||
|
@ -49,21 +49,23 @@ typedef struct _PARTDATA
|
||||||
|
|
||||||
typedef struct _PARTENTRY
|
typedef struct _PARTENTRY
|
||||||
{
|
{
|
||||||
ULONGLONG StartingOffset;
|
LIST_ENTRY ListEntry;
|
||||||
ULONGLONG PartSize;
|
|
||||||
ULONG PartNumber;
|
|
||||||
ULONG PartType;
|
|
||||||
BOOLEAN Active;
|
|
||||||
|
|
||||||
CHAR DriveLetter;
|
CHAR DriveLetter;
|
||||||
CHAR VolumeLabel[17];
|
CHAR VolumeLabel[17];
|
||||||
CHAR FileSystemName[9];
|
CHAR FileSystemName[9];
|
||||||
|
|
||||||
BOOL Unpartitioned;
|
BOOLEAN Unpartitioned;
|
||||||
|
|
||||||
BOOL Used;
|
/*
|
||||||
|
* Raw offset and length of the unpartitioned disk space.
|
||||||
|
* Includes the leading, not yet existing, partition table.
|
||||||
|
*/
|
||||||
|
ULONGLONG UnpartitionedOffset;
|
||||||
|
ULONGLONG UnpartitionedLength;
|
||||||
|
|
||||||
|
PARTITION_INFORMATION PartInfo[4];
|
||||||
|
|
||||||
BOOLEAN HidePartEntry;
|
|
||||||
} PARTENTRY, *PPARTENTRY;
|
} PARTENTRY, *PPARTENTRY;
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,11 +73,15 @@ typedef struct _DISKENTRY
|
||||||
{
|
{
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
|
|
||||||
ULONGLONG DiskSize;
|
|
||||||
ULONGLONG Cylinders;
|
ULONGLONG Cylinders;
|
||||||
ULONGLONG TracksPerCylinder;
|
ULONGLONG TracksPerCylinder;
|
||||||
ULONGLONG SectorsPerTrack;
|
ULONGLONG SectorsPerTrack;
|
||||||
ULONGLONG BytesPerSector;
|
ULONGLONG BytesPerSector;
|
||||||
|
|
||||||
|
ULONGLONG DiskSize;
|
||||||
|
ULONGLONG CylinderSize;
|
||||||
|
ULONGLONG TrackSize;
|
||||||
|
|
||||||
ULONG DiskNumber;
|
ULONG DiskNumber;
|
||||||
USHORT Port;
|
USHORT Port;
|
||||||
USHORT Bus;
|
USHORT Bus;
|
||||||
|
@ -83,8 +89,7 @@ typedef struct _DISKENTRY
|
||||||
|
|
||||||
UNICODE_STRING DriverName;
|
UNICODE_STRING DriverName;
|
||||||
|
|
||||||
ULONG PartCount;
|
LIST_ENTRY PartListHead;
|
||||||
PPARTENTRY PartArray;
|
|
||||||
|
|
||||||
} DISKENTRY, *PDISKENTRY;
|
} DISKENTRY, *PDISKENTRY;
|
||||||
|
|
||||||
|
@ -102,9 +107,9 @@ typedef struct _PARTLIST
|
||||||
ULONG TopPartition;
|
ULONG TopPartition;
|
||||||
|
|
||||||
PDISKENTRY CurrentDisk;
|
PDISKENTRY CurrentDisk;
|
||||||
ULONG CurrentPartition;
|
PPARTENTRY CurrentPartition;
|
||||||
|
|
||||||
LIST_ENTRY DiskList;
|
LIST_ENTRY DiskListHead;
|
||||||
|
|
||||||
} PARTLIST, *PPARTLIST;
|
} PARTLIST, *PPARTLIST;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue