mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 04:45:45 +00:00
- Do only create a registry entry for partitions if the signature of the disk is non zero.
- Do only mount partitions from a registry key if the signature is non zero. - Do delete all registry keys for non existing partitions. svn path=/trunk/; revision=17975
This commit is contained in:
parent
14d1c2cc63
commit
080f8f4a31
1 changed files with 42 additions and 30 deletions
|
@ -377,7 +377,7 @@ HalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static BOOLEAN
|
||||||
HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
IN ULONG DriveNumber,
|
IN ULONG DriveNumber,
|
||||||
IN UCHAR DriveType,
|
IN UCHAR DriveType,
|
||||||
|
@ -399,7 +399,7 @@ HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
if ((ObSystemDeviceMap->DriveMap & (1 << DriveNumber)) != 0)
|
if ((ObSystemDeviceMap->DriveMap & (1 << DriveNumber)) != 0)
|
||||||
{
|
{
|
||||||
DbgPrint("Drive letter already used!\n");
|
DbgPrint("Drive letter already used!\n");
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -419,7 +419,7 @@ HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
if (DriveNumber == AUTO_DRIVE)
|
if (DriveNumber == AUTO_DRIVE)
|
||||||
{
|
{
|
||||||
DbgPrint("No drive letter available!\n");
|
DbgPrint("No drive letter available!\n");
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,9 @@ HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
Status = IoCreateSymbolicLink(&DriveName,
|
Status = IoCreateSymbolicLink(&DriveName,
|
||||||
PartitionName);
|
PartitionName);
|
||||||
|
|
||||||
if (DriveType == DOSDEVICE_DRIVE_FIXED && hKey)
|
if (hKey &&
|
||||||
|
DriveType == DOSDEVICE_DRIVE_FIXED &&
|
||||||
|
Signature)
|
||||||
{
|
{
|
||||||
DiskMountInfo.Signature = Signature;
|
DiskMountInfo.Signature = Signature;
|
||||||
DiskMountInfo.StartingOffset = StartingOffset;
|
DiskMountInfo.StartingOffset = StartingOffset;
|
||||||
|
@ -462,6 +464,7 @@ HalpAssignDrive(IN PUNICODE_STRING PartitionName,
|
||||||
DPRINT1("ZwCreateValueKey failed for %wZ, status=%x\n", &DriveName, Status);
|
DPRINT1("ZwCreateValueKey failed for %wZ, status=%x\n", &DriveName, Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -806,40 +809,49 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
{
|
{
|
||||||
DPRINT("%wZ => %08x:%08x%08x\n", &UnicodeString1, DiskMountInfo->Signature,
|
DPRINT("%wZ => %08x:%08x%08x\n", &UnicodeString1, DiskMountInfo->Signature,
|
||||||
DiskMountInfo->StartingOffset.u.HighPart, DiskMountInfo->StartingOffset.u.LowPart);
|
DiskMountInfo->StartingOffset.u.HighPart, DiskMountInfo->StartingOffset.u.LowPart);
|
||||||
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
|
||||||
{
|
{
|
||||||
DPRINT("%x\n", LayoutArray[i]->Signature);
|
BOOLEAN Found = FALSE;
|
||||||
if (LayoutArray[i] &&
|
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
||||||
LayoutArray[i]->Signature == DiskMountInfo->Signature)
|
|
||||||
{
|
{
|
||||||
for (j = 0; j < LayoutArray[i]->PartitionCount; j++)
|
DPRINT("%x\n", LayoutArray[i]->Signature);
|
||||||
|
if (LayoutArray[i] &&
|
||||||
|
LayoutArray[i]->Signature &&
|
||||||
|
LayoutArray[i]->Signature == DiskMountInfo->Signature)
|
||||||
{
|
{
|
||||||
if (LayoutArray[i]->PartitionEntry[j].StartingOffset.QuadPart == DiskMountInfo->StartingOffset.QuadPart)
|
for (j = 0; j < LayoutArray[i]->PartitionCount; j++)
|
||||||
{
|
{
|
||||||
if (IsRecognizedPartition(LayoutArray[i]->PartitionEntry[j].PartitionType))
|
if (LayoutArray[i]->PartitionEntry[j].StartingOffset.QuadPart == DiskMountInfo->StartingOffset.QuadPart)
|
||||||
{
|
{
|
||||||
swprintf(Buffer2,
|
if (IsRecognizedPartition(LayoutArray[i]->PartitionEntry[j].PartitionType) &&
|
||||||
L"\\Device\\Harddisk%d\\Partition%d",
|
LayoutArray[i]->PartitionEntry[j].RewritePartition == FALSE)
|
||||||
i,
|
{
|
||||||
LayoutArray[i]->PartitionEntry[j].PartitionNumber);
|
swprintf(Buffer2,
|
||||||
RtlInitUnicodeString(&UnicodeString2,
|
L"\\Device\\Harddisk%d\\Partition%d",
|
||||||
Buffer2);
|
i,
|
||||||
|
LayoutArray[i]->PartitionEntry[j].PartitionNumber);
|
||||||
|
RtlInitUnicodeString(&UnicodeString2,
|
||||||
|
Buffer2);
|
||||||
|
|
||||||
/* Assign drive */
|
/* Assign drive */
|
||||||
DPRINT(" %wZ\n", &UnicodeString2);
|
DPRINT(" %wZ\n", &UnicodeString2);
|
||||||
HalpAssignDrive(&UnicodeString2,
|
Found = HalpAssignDrive(&UnicodeString2,
|
||||||
k,
|
k,
|
||||||
DOSDEVICE_DRIVE_FIXED,
|
DOSDEVICE_DRIVE_FIXED,
|
||||||
DiskMountInfo->Signature,
|
DiskMountInfo->Signature,
|
||||||
DiskMountInfo->StartingOffset,
|
DiskMountInfo->StartingOffset,
|
||||||
NULL);
|
NULL);
|
||||||
/* Mark the partition as assigned */
|
/* Mark the partition as assigned */
|
||||||
LayoutArray[i]->PartitionEntry[j].RewritePartition = TRUE;
|
LayoutArray[i]->PartitionEntry[j].RewritePartition = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
if (Found == FALSE)
|
||||||
|
{
|
||||||
|
/* We didn't find a partition for this entry, remove them. */
|
||||||
|
Status = ZwDeleteValueKey(hKey, &UnicodeString1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -871,7 +883,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
Buffer2);
|
Buffer2);
|
||||||
|
|
||||||
/* Assign drive */
|
/* Assign drive */
|
||||||
DPRINT1(" %wZ\n", &UnicodeString2);
|
DPRINT(" %wZ\n", &UnicodeString2);
|
||||||
HalpAssignDrive(&UnicodeString2,
|
HalpAssignDrive(&UnicodeString2,
|
||||||
AUTO_DRIVE,
|
AUTO_DRIVE,
|
||||||
DOSDEVICE_DRIVE_FIXED,
|
DOSDEVICE_DRIVE_FIXED,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue