* 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.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
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/partlist.c
}
+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
CreatePartitionList(SHORT Left,
SHORT Top,
List->DiskArray[DiskNumber].FixedDisk = TRUE;
+ GetDriverName(&List->DiskArray[DiskNumber]);
LayoutBuffer = (DRIVE_LAYOUT_INFORMATION*)RtlAllocateHeap(ProcessHeap, 0, 8192);
}
#endif
- /* free disk and partition info */
+ /* Release disk and partition info */
if (List->DiskArray != NULL)
{
- /* free partition arrays */
for (i = 0; i < List->DiskCount; i++)
{
+ /* Release driver name */
+ RtlFreeUnicodeString(&List->DiskArray[i].DriverName);
+
+ /* Release partition array */
if (List->DiskArray[i].PartArray != NULL)
{
RtlFreeHeap(ProcessHeap, 0, List->DiskArray[i].PartArray);
}
}
- /* free disk array */
+ /* Release disk array */
RtlFreeHeap(ProcessHeap, 0, List->DiskArray);
List->DiskCount = 0;
List->DiskArray = NULL;
}
- /* free list head */
+ /* Release list head */
RtlFreeHeap(ProcessHeap, 0, List);
}
Unit = "MB";
}
- sprintf(LineBuffer,
- "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
- DiskSize,
- Unit,
- DiskEntry->DiskNumber,
- DiskEntry->Port,
- DiskEntry->Bus,
- DiskEntry->Id);
+ if (DiskEntry->DriverName.Length > 0)
+ {
+ sprintf(LineBuffer,
+ "%I64u %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,
+ "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu)",
+ DiskSize,
+ Unit,
+ DiskEntry->DiskNumber,
+ DiskEntry->Port,
+ DiskEntry->Bus,
+ DiskEntry->Id);
+ }
FillConsoleOutputAttribute(0x17,
Width,
GetPartitionData(PPARTLIST List,
PPARTDATA Data)
{
+ PDISKENTRY DiskEntry;
+ PPARTENTRY PartEntry;
+
if (List->CurrentDisk >= List->DiskCount)
return(FALSE);
- if (List->DiskArray[List->CurrentDisk].FixedDisk == FALSE)
- return(FALSE);
+ DiskEntry = &List->DiskArray[List->CurrentDisk];
- if (List->CurrentPartition >= List->DiskArray[List->CurrentDisk].PartCount)
+ if (DiskEntry->FixedDisk == FALSE)
return(FALSE);
- if (List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].Used == FALSE)
+ if (List->CurrentPartition >= DiskEntry->PartCount)
return(FALSE);
- Data->DiskSize = List->DiskArray[List->CurrentDisk].DiskSize;
- Data->DiskNumber = List->DiskArray[List->CurrentDisk].DiskNumber;
- Data->Port = List->DiskArray[List->CurrentDisk].Port;
- Data->Bus = List->DiskArray[List->CurrentDisk].Bus;
- Data->Id = List->DiskArray[List->CurrentDisk].Id;
+ PartEntry = &DiskEntry->PartArray[List->CurrentPartition];
+
+ if (PartEntry->Used == FALSE)
+ return(FALSE);
- Data->PartSize = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartSize;
- Data->PartNumber = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartNumber;
- Data->PartType = List->DiskArray[List->CurrentDisk].PartArray[List->CurrentPartition].PartType;
+ /* 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);
+ }
+ }
- 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);
}
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.PartNumber,
+ PartSize,
+ PartUnit,
+ PartType);
+
+ 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.Id,
+ &PartData.DriverName);
- PrintTextXY(8, 10, "on Partition %lu (%I64u %s) %s",
- PartData.PartNumber,
- PartSize,
- PartUnit,
- PartType);
- SetTextXY(6, 13, "Select a file system for the partition from the list below.");
+ SetTextXY(6, 17, "Select a file system for the partition from the list below.");
- SetTextXY(8, 15, "\xf9 Press UP or DOWN to select a file system.");
- SetTextXY(8, 17, "\xf9 Press ENTER to format the partition.");
- 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 */
- 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");