Cleaned up the partition list and update the status line.

Removed some global partition data.
Added delete partition page.

svn path=/trunk/; revision=5408
This commit is contained in:
Eric Kohl 2003-08-04 15:54:05 +00:00
parent 0b2338e5a9
commit 92bab0c786
3 changed files with 426 additions and 387 deletions

View file

@ -1,6 +1,6 @@
/* /*
* ReactOS kernel * ReactOS kernel
* Copyright (C) 2002 ReactOS Team * Copyright (C) 2002, 2003 ReactOS Team
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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.12 2003/08/03 12:20:22 ekohl Exp $ /* $Id: partlist.c,v 1.13 2003/08/04 15:54:05 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
@ -806,7 +806,7 @@ PrintDiskData(PPARTLIST List,
if (DiskEntry->DriverName.Length > 0) if (DiskEntry->DriverName.Length > 0)
{ {
sprintf(LineBuffer, sprintf(LineBuffer,
"%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ", "%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
DiskSize, DiskSize,
Unit, Unit,
DiskEntry->DiskNumber, DiskEntry->DiskNumber,
@ -818,7 +818,7 @@ PrintDiskData(PPARTLIST List,
else else
{ {
sprintf(LineBuffer, sprintf(LineBuffer,
"%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)", "%6I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
DiskSize, DiskSize,
Unit, Unit,
DiskEntry->DiskNumber, DiskEntry->DiskNumber,
@ -1081,121 +1081,46 @@ ScrollUpPartitionList(PPARTLIST List)
} }
BOOLEAN VOID
GetSelectedPartition(PPARTLIST List,
PPARTDATA Data)
{
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
if (List->CurrentDisk == NULL)
return FALSE;
DiskEntry = List->CurrentDisk;
if (List->CurrentPartition == NULL)
return FALSE;
PartEntry = List->CurrentPartition;
/* Copy disk-specific data */
Data->DiskSize = DiskEntry->DiskSize;
Data->DiskNumber = DiskEntry->DiskNumber;
Data->Port = DiskEntry->Port;
Data->Bus = DiskEntry->Bus;
Data->Id = DiskEntry->Id;
/* Copy driver name */
RtlInitUnicodeString(&Data->DriverName,
NULL);
if (DiskEntry->DriverName.Length != 0)
{
Data->DriverName.Buffer = RtlAllocateHeap(ProcessHeap,
0,
DiskEntry->DriverName.MaximumLength);
if (Data->DriverName.Buffer != NULL)
{
Data->DriverName.MaximumLength = DiskEntry->DriverName.MaximumLength;
Data->DriverName.Length = DiskEntry->DriverName.Length;
RtlCopyMemory(Data->DriverName.Buffer,
DiskEntry->DriverName.Buffer,
DiskEntry->DriverName.MaximumLength);
}
}
/* Copy partition-specific data */
Data->CreatePartition = FALSE;
Data->NewPartSize = 0;
Data->PartSize = PartEntry->PartInfo[0].PartitionLength.QuadPart;
Data->PartNumber = PartEntry->PartInfo[0].PartitionNumber;
Data->PartType = PartEntry->PartInfo[0].PartitionType;
Data->DriveLetter = PartEntry->DriveLetter;
return TRUE;
}
BOOLEAN
GetActiveBootPartition(PPARTLIST List, GetActiveBootPartition(PPARTLIST List,
PPARTDATA Data) PDISKENTRY *DiskEntry,
PPARTENTRY *PartEntry)
{ {
PDISKENTRY DiskEntry; PDISKENTRY LocalDiskEntry;
PPARTENTRY PartEntry; PPARTENTRY LocalPartEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
ULONG i; ULONG i;
*DiskEntry = NULL;
*PartEntry = NULL;
/* Check for empty disk list */
if (IsListEmpty (&List->DiskListHead)) if (IsListEmpty (&List->DiskListHead))
return FALSE; return;
/* Get first disk entry from the disk list */ /* Get first disk entry from the disk list */
Entry = List->DiskListHead.Flink; Entry = List->DiskListHead.Flink;
DiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry); LocalDiskEntry = CONTAINING_RECORD (Entry, DISKENTRY, ListEntry);
Entry = DiskEntry->PartListHead.Flink; /* Check for empty partition list */
while (Entry != &DiskEntry->PartListHead) if (IsListEmpty (&LocalDiskEntry->PartListHead))
return;
/* Search for active partition */
Entry = LocalDiskEntry->PartListHead.Flink;
while (Entry != &LocalDiskEntry->PartListHead)
{ {
PartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry); LocalPartEntry = CONTAINING_RECORD (Entry, PARTENTRY, ListEntry);
if (PartEntry->PartInfo[0].BootIndicator) if (LocalPartEntry->PartInfo[0].BootIndicator)
{ {
/* Copy disk-specific data */ *DiskEntry = LocalDiskEntry;
Data->DiskSize = DiskEntry->DiskSize; *PartEntry = LocalPartEntry;
Data->DiskNumber = DiskEntry->DiskNumber; return;
Data->Port = DiskEntry->Port;
Data->Bus = DiskEntry->Bus;
Data->Id = DiskEntry->Id;
/* Copy driver name */
RtlInitUnicodeString(&Data->DriverName,
NULL);
if (DiskEntry->DriverName.Length != 0)
{
Data->DriverName.Buffer = RtlAllocateHeap(ProcessHeap,
0,
DiskEntry->DriverName.MaximumLength);
if (Data->DriverName.Buffer != NULL)
{
Data->DriverName.MaximumLength = DiskEntry->DriverName.MaximumLength;
Data->DriverName.Length = DiskEntry->DriverName.Length;
RtlCopyMemory(Data->DriverName.Buffer,
DiskEntry->DriverName.Buffer,
DiskEntry->DriverName.MaximumLength);
}
}
/* Copy partition-specific data */
Data->PartSize = PartEntry->PartInfo[0].PartitionLength.QuadPart;
Data->PartNumber = PartEntry->PartInfo[0].PartitionNumber;
Data->PartType = PartEntry->PartInfo[0].PartitionType;
Data->DriveLetter = PartEntry->DriveLetter;
return TRUE;
} }
Entry = Entry->Flink; Entry = Entry->Flink;
} }
return FALSE;
} }

View file

@ -1,6 +1,6 @@
/* /*
* ReactOS kernel * ReactOS kernel
* Copyright (C) 2002 ReactOS Team * Copyright (C) 2002, 2003 ReactOS Team
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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.12 2003/08/03 12:20:22 ekohl Exp $ /* $Id: partlist.h,v 1.13 2003/08/04 15:54:05 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
@ -27,25 +27,6 @@
#ifndef __PARTLIST_H__ #ifndef __PARTLIST_H__
#define __PARTLIST_H__ #define __PARTLIST_H__
typedef struct _PARTDATA
{
ULONGLONG DiskSize;
ULONG DiskNumber;
USHORT Port;
USHORT Bus;
USHORT Id;
BOOLEAN CreatePartition;
ULONGLONG PartSize;
ULONGLONG NewPartSize;
ULONG PartNumber;
ULONG PartType;
CHAR DriveLetter;
UNICODE_STRING DriverName;
} PARTDATA, *PPARTDATA;
typedef struct _PARTENTRY typedef struct _PARTENTRY
{ {
@ -109,24 +90,24 @@ typedef struct _PARTLIST
PDISKENTRY CurrentDisk; PDISKENTRY CurrentDisk;
PPARTENTRY CurrentPartition; PPARTENTRY CurrentPartition;
#if 0
/* Not used yet! */
PDISKENTRY ActiveBootDisk;
PPARTENTRY ActiveBootPartition;
#endif
LIST_ENTRY DiskListHead; LIST_ENTRY DiskListHead;
} PARTLIST, *PPARTLIST; } PARTLIST, *PPARTLIST;
PPARTLIST PPARTLIST
CreatePartitionList(SHORT Left, CreatePartitionList(SHORT Left,
SHORT Top, SHORT Top,
SHORT Right, SHORT Right,
SHORT Bottom); SHORT Bottom);
BOOLEAN
MarkPartitionActive(ULONG DiskNumber,
ULONG PartitionNumber,
PPARTDATA ActivePartition);
VOID VOID
DestroyPartitionList(PPARTLIST List); DestroyPartitionList(PPARTLIST List);
@ -139,22 +120,26 @@ ScrollDownPartitionList(PPARTLIST List);
VOID VOID
ScrollUpPartitionList(PPARTLIST List); ScrollUpPartitionList(PPARTLIST List);
BOOLEAN VOID
GetSelectedPartition(PPARTLIST List,
PPARTDATA Data);
BOOLEAN
GetActiveBootPartition(PPARTLIST List, GetActiveBootPartition(PPARTLIST List,
PPARTDATA Data); PDISKENTRY *DiskEntry,
PPARTENTRY *PartEntry);
BOOLEAN BOOLEAN
CreateSelectedPartition(PPARTLIST List, CreateSelectedPartition(PPARTLIST List,
ULONG PartType, ULONG PartType,
ULONGLONG NewPartSize); ULONGLONG NewPartSize);
BOOLEAN BOOLEAN
DeleteSelectedPartition(PPARTLIST List); DeleteSelectedPartition(PPARTLIST List);
#if 0
BOOLEAN
MarkPartitionActive(ULONG DiskNumber,
ULONG PartitionNumber,
PPARTDATA ActivePartition);
#endif
#endif /* __PARTLIST_H__ */ #endif /* __PARTLIST_H__ */
/* EOF */ /* EOF */

File diff suppressed because it is too large Load diff