mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Enabled driver letter assignment for removable drives.
svn path=/trunk/; revision=2981
This commit is contained in:
parent
9ca6cf1169
commit
32e8099716
1 changed files with 104 additions and 100 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xhaldrv.c,v 1.21 2002/05/25 13:32:25 ekohl Exp $
|
||||
/* $Id: xhaldrv.c,v 1.22 2002/05/26 20:18:18 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -84,7 +84,7 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Status %x\n",Status);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
KeInitializeEvent(&Event,
|
||||
|
@ -103,7 +103,7 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
|||
if (Irp == NULL)
|
||||
{
|
||||
ObDereferenceObject(FileObject);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
}
|
||||
|
||||
Status = IoCallDriver(DeviceObject,
|
||||
|
@ -118,9 +118,16 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
|||
Status = StatusBlock.Status;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA)
|
||||
{
|
||||
DiskGeometry.BytesPerSector = 512;
|
||||
}
|
||||
else
|
||||
{
|
||||
ObDereferenceObject(FileObject);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("DiskGeometry.BytesPerSector: %d\n",
|
||||
|
@ -158,7 +165,7 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
|||
|
||||
ObDereferenceObject(FileObject);
|
||||
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -390,7 +397,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
&LayoutArray[i]);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n",
|
||||
DbgPrint("xHalQueryDriveLayout() failed (Status = 0x%lx)\n",
|
||||
Status);
|
||||
LayoutArray[i] = NULL;
|
||||
continue;
|
||||
|
@ -430,7 +437,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
DPRINT("Assigning bootable primary partition on first harddisk:\n");
|
||||
if (ConfigInfo->DiskCount > 0)
|
||||
{
|
||||
/* search for bootable partition */
|
||||
/* Search for bootable partition */
|
||||
for (j = 0; j < LayoutArray[0]->PartitionCount; j++)
|
||||
{
|
||||
if ((LayoutArray[0]->PartitionEntry[j].BootIndicator == TRUE) &&
|
||||
|
@ -442,7 +449,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString2,
|
||||
Buffer2);
|
||||
|
||||
/* assign it */
|
||||
/* Assign drive */
|
||||
DPRINT(" %wZ\n", &UnicodeString2);
|
||||
HalpAssignDrive(&UnicodeString2,
|
||||
AUTO_DRIVE,
|
||||
|
@ -455,12 +462,13 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
DPRINT("Assigning remaining primary partitions:\n");
|
||||
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
||||
{
|
||||
/* search for primary partitions */
|
||||
for (j = 0; j < PARTITION_TBL_SIZE; j++)
|
||||
/* Search for primary partitions */
|
||||
for (j = 0; (j < PARTITION_TBL_SIZE) && (j < LayoutArray[i]->PartitionCount); j++)
|
||||
{
|
||||
if (!(i == 0 &&
|
||||
LayoutArray[i]->PartitionEntry[j].BootIndicator == TRUE) &&
|
||||
IsUsablePartition(LayoutArray[i]->PartitionEntry[j].PartitionType))
|
||||
if ((i == 0) && (LayoutArray[i]->PartitionEntry[j].BootIndicator == TRUE))
|
||||
continue;
|
||||
|
||||
if (IsUsablePartition(LayoutArray[i]->PartitionEntry[j].PartitionType))
|
||||
{
|
||||
swprintf(Buffer2,
|
||||
L"\\Device\\Harddisk%d\\Partition%d",
|
||||
|
@ -469,7 +477,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString2,
|
||||
Buffer2);
|
||||
|
||||
/* assign it */
|
||||
/* Assign drive */
|
||||
DPRINT(" %wZ\n",
|
||||
&UnicodeString2);
|
||||
HalpAssignDrive(&UnicodeString2,
|
||||
|
@ -485,7 +493,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
{
|
||||
if (LayoutArray[i])
|
||||
{
|
||||
/* search for extended partitions */
|
||||
/* Search for extended partitions */
|
||||
for (j = PARTITION_TBL_SIZE; j < LayoutArray[i]->PartitionCount; j++)
|
||||
{
|
||||
if (IsUsablePartition(LayoutArray[i]->PartitionEntry[j].PartitionType) &&
|
||||
|
@ -498,7 +506,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString2,
|
||||
Buffer2);
|
||||
|
||||
/* assign it */
|
||||
/* Assign drive */
|
||||
DPRINT(" %wZ\n",
|
||||
&UnicodeString2);
|
||||
HalpAssignDrive(&UnicodeString2,
|
||||
|
@ -509,10 +517,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* TEST */
|
||||
/* Assign removable disk drives */
|
||||
DPRINT("Assigning extended (logical) partitions:\n");
|
||||
DPRINT("Assigning removable disk drives:\n");
|
||||
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
||||
{
|
||||
/* Search for virtual partitions */
|
||||
|
@ -525,7 +531,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString2,
|
||||
Buffer2);
|
||||
|
||||
/* assign it */
|
||||
/* Assign drive */
|
||||
DPRINT(" %wZ\n",
|
||||
&UnicodeString2);
|
||||
HalpAssignDrive(&UnicodeString2,
|
||||
|
@ -533,8 +539,6 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
DOSDEVICE_DRIVE_REMOVABLE);
|
||||
}
|
||||
}
|
||||
/* TEST END */
|
||||
#endif
|
||||
|
||||
/* Free layout array */
|
||||
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
||||
|
@ -554,7 +558,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString1,
|
||||
Buffer1);
|
||||
|
||||
/* assign drive letters A: or B: or first free drive letter */
|
||||
/* Assign drive letters A: or B: or first free drive letter */
|
||||
DPRINT(" %wZ\n",
|
||||
&UnicodeString1);
|
||||
HalpAssignDrive(&UnicodeString1,
|
||||
|
@ -572,7 +576,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlInitUnicodeString(&UnicodeString1,
|
||||
Buffer1);
|
||||
|
||||
/* assign first free drive letter */
|
||||
/* Assign first free drive letter */
|
||||
DPRINT(" %wZ\n", &UnicodeString1);
|
||||
HalpAssignDrive(&UnicodeString1,
|
||||
AUTO_DRIVE,
|
||||
|
@ -581,7 +585,6 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
/* Anything else ?? */
|
||||
|
||||
|
||||
ExFreePool(Buffer2);
|
||||
ExFreePool(Buffer1);
|
||||
}
|
||||
|
@ -666,11 +669,11 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("xHalIoReadPartitonTable failed (Status = 0x%08lx)\n",
|
||||
DPRINT("Failed to read partition table sector (Status = 0x%08lx)\n",
|
||||
Status);
|
||||
ExFreePool(SectorBuffer);
|
||||
ExFreePool(LayoutBuffer);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
PartitionTable = (PPARTITION_TABLE)(SectorBuffer+PARTITION_OFFSET);
|
||||
|
@ -800,6 +803,7 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG SectorSize,
|
||||
|
|
Loading…
Reference in a new issue