Author: fireball Date: Mon Jan 26 14:00:59 2009 New Revision: 39116
URL: http://svn.reactos.org/svn/reactos?rev=39116&view=rev Log: Giannis Adamopoulos johnyadams@hotmail.com - Correctly assign NtSystemRoot and remove assumption that number of partitions equals number of harddisks. - Remove a hack from IopApplyRosCdromArcHack. Fixes LiveCD issues. See issue #3170 for more details.
Modified: trunk/reactos/ntoskrnl/fstub/disksup.c trunk/reactos/ntoskrnl/io/iomgr/arcname.c
Modified: trunk/reactos/ntoskrnl/fstub/disksup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Mon Jan 26 14:00:59 2009 @@ -47,7 +47,9 @@ IN UCHAR DriveType, IN ULONG Signature, IN LARGE_INTEGER StartingOffset, - IN HANDLE hKey) + IN HANDLE hKey, + IN PUNICODE_STRING BootDevice, + OUT PUCHAR NtSystemPath) { WCHAR DriveNameBuffer[16]; UNICODE_STRING DriveName; @@ -128,6 +130,14 @@ DPRINT1("ZwCreateValueKey failed for %wZ, status=%x\n", &DriveName, Status); } } + + /* Check if this is a boot partition */ + if (RtlCompareUnicodeString(PartitionName, BootDevice, FALSE) == 0) + { + /* Set NtSystemPath to that partition's disk letter */ + *NtSystemPath = 'A' + DriveNumber; + } + return TRUE; }
@@ -420,6 +430,11 @@ PKEY_VALUE_PARTIAL_INFORMATION PartialInformation; PREG_DISK_MOUNT_INFO DiskMountInfo; ULONG RDiskCount; + UNICODE_STRING BootDevice; + + Status = RtlAnsiStringToUnicodeString(&BootDevice, + NtDeviceName, + TRUE);
DPRINT("xHalIoAssignDriveLetters()\n");
@@ -612,7 +627,9 @@ DOSDEVICE_DRIVE_FIXED, DiskMountInfo->Signature, DiskMountInfo->StartingOffset, - NULL); + NULL, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[i]->PartitionEntry[j].RewritePartition = TRUE; } @@ -662,7 +679,9 @@ DOSDEVICE_DRIVE_FIXED, LayoutArray[DiskNumber]->Signature, LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, - hKey); + hKey, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } @@ -702,7 +721,9 @@ DOSDEVICE_DRIVE_FIXED, LayoutArray[DiskNumber]->Signature, LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, - hKey); + hKey, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } @@ -741,7 +762,9 @@ DOSDEVICE_DRIVE_FIXED, LayoutArray[DiskNumber]->Signature, LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, - hKey); + hKey, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } @@ -776,7 +799,9 @@ DOSDEVICE_DRIVE_FIXED, LayoutArray[DiskNumber]->Signature, LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, - hKey); + hKey, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } @@ -812,7 +837,9 @@ DOSDEVICE_DRIVE_FIXED, LayoutArray[DiskNumber]->Signature, LayoutArray[DiskNumber]->PartitionEntry[j].StartingOffset, - hKey); + hKey, + &BootDevice, + NtSystemPath); /* Mark the partition as assigned */ LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition = TRUE; } @@ -844,7 +871,9 @@ DOSDEVICE_DRIVE_REMOVABLE, 0, RtlConvertLongToLargeInteger(0), - hKey); + hKey, + &BootDevice, + NtSystemPath); } } } @@ -875,7 +904,9 @@ DOSDEVICE_DRIVE_REMOVABLE, 0, RtlConvertLongToLargeInteger(0), - hKey); + hKey, + &BootDevice, + NtSystemPath); }
/* Assign cdrom drives */ @@ -895,7 +926,9 @@ DOSDEVICE_DRIVE_CDROM, 0, RtlConvertLongToLargeInteger(0), - hKey); + hKey, + &BootDevice, + NtSystemPath); }
/* Anything else to do? */
Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] Mon Jan 26 14:00:59 2009 @@ -114,8 +114,6 @@ /* Return whether this is the CD or not */ if ((InitIsWinPEMode) || (ExpInTextModeSetup)) { - /* Hack until IoAssignDriveLetters is fixed */ - swprintf(SharedUserData->NtSystemRoot, L"%c:\%hs", 'C' + DeviceNumber, RosSysPath); return TRUE; }