Added driver name to the partition list

svn path=/trunk/; revision=3806
This commit is contained in:
Eric Kohl 2002-11-28 19:20:38 +00:00
parent 4603c2ef5a
commit 5f25774f6e
3 changed files with 125 additions and 41 deletions

View file

@ -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.4 2002/11/13 18:25:18 ekohl Exp $ /* $Id: partlist.c,v 1.5 2002/11/28 19:20:37 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
@ -121,6 +121,39 @@ AddPartitionList(ULONG DiskNumber,
} }
static VOID
GetDriverName(PDISKENTRY DiskEntry)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR KeyName[32];
NTSTATUS Status;
RtlInitUnicodeString(&DiskEntry->DriverName,
NULL);
swprintf(KeyName,
L"\\Scsi\\Scsi Port %lu",
DiskEntry->Port);
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))
{
DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status);
}
}
PPARTLIST PPARTLIST
CreatePartitionList(SHORT Left, CreatePartitionList(SHORT Left,
SHORT Top, SHORT Top,
@ -237,6 +270,7 @@ CreatePartitionList(SHORT Left,
List->DiskArray[DiskNumber].FixedDisk = TRUE; List->DiskArray[DiskNumber].FixedDisk = TRUE;
GetDriverName(&List->DiskArray[DiskNumber]);
LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap(ProcessHeap, 0, 8192); LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap(ProcessHeap, 0, 8192);
@ -310,12 +344,15 @@ DestroyPartitionList(PPARTLIST List)
} }
#endif #endif
/* free disk and partition info */ /* Release disk and partition info */
if (List->DiskArray != NULL) if (List->DiskArray != NULL)
{ {
/* free partition arrays */
for (i = 0; i < List->DiskCount; i++) for (i = 0; i < List->DiskCount; i++)
{ {
/* Release driver name */
RtlFreeUnicodeString(&List->DiskArray[i].DriverName);
/* Release partition array */
if (List->DiskArray[i].PartArray != NULL) if (List->DiskArray[i].PartArray != NULL)
{ {
RtlFreeHeap(ProcessHeap, 0, List->DiskArray[i].PartArray); RtlFreeHeap(ProcessHeap, 0, List->DiskArray[i].PartArray);
@ -324,13 +361,13 @@ DestroyPartitionList(PPARTLIST List)
} }
} }
/* free disk array */ /* Release disk array */
RtlFreeHeap(ProcessHeap, 0, List->DiskArray); RtlFreeHeap(ProcessHeap, 0, List->DiskArray);
List->DiskCount = 0; List->DiskCount = 0;
List->DiskArray = NULL; List->DiskArray = NULL;
} }
/* free list head */ /* Release list head */
RtlFreeHeap(ProcessHeap, 0, List); RtlFreeHeap(ProcessHeap, 0, List);
} }
@ -554,14 +591,29 @@ PrintDiskData(PPARTLIST List,
Unit = "MB"; Unit = "MB";
} }
sprintf(LineBuffer, if (DiskEntry->DriverName.Length > 0)
"%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)", {
DiskSize, sprintf(LineBuffer,
Unit, "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ",
DiskEntry->DiskNumber, DiskSize,
DiskEntry->Port, Unit,
DiskEntry->Bus, DiskEntry->DiskNumber,
DiskEntry->Id); DiskEntry->Port,
DiskEntry->Bus,
DiskEntry->Id,
&DiskEntry->DriverName);
}
else
{
sprintf(LineBuffer,
"%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
DiskSize,
Unit,
DiskEntry->DiskNumber,
DiskEntry->Port,
DiskEntry->Bus,
DiskEntry->Id);
}
FillConsoleOutputAttribute(0x17, FillConsoleOutputAttribute(0x17,
Width, Width,
@ -768,29 +820,55 @@ BOOL
GetPartitionData(PPARTLIST List, GetPartitionData(PPARTLIST List,
PPARTDATA Data) PPARTDATA Data)
{ {
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
if (List->CurrentDisk >= List->DiskCount) if (List->CurrentDisk >= List->DiskCount)
return(FALSE); return(FALSE);
if (List->DiskArray[List->CurrentDisk].FixedDisk == FALSE) DiskEntry = &List->DiskArray[List->CurrentDisk];
if (DiskEntry->FixedDisk == FALSE)
return(FALSE); return(FALSE);
if (List->CurrentPartition >= List->DiskArray[List->CurrentDisk].PartCount) if (List->CurrentPartition >= DiskEntry->PartCount)
return(FALSE); return(FALSE);
if (List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].Used == FALSE) PartEntry = &DiskEntry->PartArray[List->CurrentPartition];
if (PartEntry->Used == FALSE)
return(FALSE); return(FALSE);
Data->DiskSize = List->DiskArray[List->CurrentDisk].DiskSize; /* Copy disk-specific data */
Data->DiskNumber = List->DiskArray[List->CurrentDisk].DiskNumber; Data->DiskSize = DiskEntry->DiskSize;
Data->Port = List->DiskArray[List->CurrentDisk].Port; Data->DiskNumber = DiskEntry->DiskNumber;
Data->Bus = List->DiskArray[List->CurrentDisk].Bus; Data->Port = DiskEntry->Port;
Data->Id = List->DiskArray[List->CurrentDisk].Id; Data->Bus = DiskEntry->Bus;
Data->Id = DiskEntry->Id;
Data->PartSize = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartSize; /* Copy driver name */
Data->PartNumber = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartNumber; RtlInitUnicodeString(&Data->DriverName,
Data->PartType = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartType; 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);
}
}
Data->DriveLetter = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].DriveLetter; /* Copy partition-specific data */
Data->PartSize = PartEntry->PartSize;
Data->PartNumber = PartEntry->PartNumber;
Data->PartType = PartEntry->PartType;
Data->DriveLetter = PartEntry->DriveLetter;
return(TRUE); return(TRUE);
} }

View file

@ -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.4 2002/11/13 18:25:18 ekohl Exp $ /* $Id: partlist.h,v 1.5 2002/11/28 19:20:37 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
@ -40,6 +40,8 @@ typedef struct _PARTDATA
ULONG PartType; ULONG PartType;
CHAR DriveLetter; CHAR DriveLetter;
UNICODE_STRING DriverName;
} PARTDATA, *PPARTDATA; } PARTDATA, *PPARTDATA;
@ -67,6 +69,8 @@ typedef struct _DISKENTRY
USHORT Id; USHORT Id;
BOOL FixedDisk; BOOL FixedDisk;
UNICODE_STRING DriverName;
ULONG PartCount; ULONG PartCount;
PPARTENTRY PartArray; PPARTENTRY PartArray;

View file

@ -753,30 +753,32 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
PartType = "Unknown"; PartType = "Unknown";
} }
SetTextXY(6, 8, "ReactOS will be installed"); SetTextXY(6, 8, "Setup will install ReactOS on");
PrintTextXY(8, 9, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu.", PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s on",
PartData.DiskNumber,
DiskSize,
DiskUnit,
PartData.Port,
PartData.Bus,
PartData.Id);
PrintTextXY(8, 10, "on Partition %lu (%I64u %s) %s",
PartData.PartNumber, PartData.PartNumber,
PartSize, PartSize,
PartUnit, PartUnit,
PartType); PartType);
SetTextXY(6, 13, "Select a file system for the partition from the list below."); PrintTextXY(8, 12, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).",
PartData.DiskNumber,
DiskSize,
DiskUnit,
PartData.Port,
PartData.Bus,
PartData.Id,
&PartData.DriverName);
SetTextXY(8, 15, "\xf9 Press UP or DOWN to select a file system.");
SetTextXY(8, 17, "\xf9 Press ENTER to format the partition."); SetTextXY(6, 17, "Select a file system for the partition from the list below.");
SetTextXY(8, 19, "\xf9 Press ESC to select another partition.");
SetTextXY(8, 19, "\xf9 Press UP or DOWN to select a file system.");
SetTextXY(8, 21, "\xf9 Press ENTER to format the partition.");
SetTextXY(8, 23, "\xf9 Press ESC to select another partition.");
/* FIXME: use a real list later */ /* FIXME: use a real list later */
SetInvertedTextXY(6, 22, " Keep current file system (no changes) "); SetInvertedTextXY(6, 26, " Keep current file system (no changes) ");
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");