[NTOS:MM] Fix ViewSize parameter passed to MiInsertVadEx() from MiCreatePebOrTeb()
[reactos.git] / ntoskrnl / fstub / disksup.c
index 9008f81..ef5630d 100644 (file)
@@ -173,7 +173,7 @@ xHalpGetRDiskCount(VOID)
         NULL);
 
     Status = ZwOpenDirectoryObject (&DirectoryHandle,
-        SYMBOLIC_LINK_ALL_ACCESS,
+        DIRECTORY_ALL_ACCESS,
         &ObjectAttributes);
     if (!NT_SUCCESS(Status))
     {
@@ -186,7 +186,7 @@ xHalpGetRDiskCount(VOID)
     Skip = 0;
     while (NT_SUCCESS(Status))
     {
-        Status = NtQueryDirectoryObject (DirectoryHandle,
+        Status = ZwQueryDirectoryObject (DirectoryHandle,
             DirectoryInfo,
             2 * PAGE_SIZE,
             FALSE,
@@ -223,6 +223,9 @@ xHalpGetRDiskCount(VOID)
             }
         }
     }
+
+    ZwClose(DirectoryHandle);
+
     ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
     return RDiskCount;
 }
@@ -1010,6 +1013,9 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
             return STATUS_INSUFFICIENT_RESOURCES;
         }
 
+        /* Reset event */
+        KeClearEvent(Event);
+
         /* Call the driver and check if it's pending */
         Status = IoCallDriver(DeviceObject, Irp);
         if (Status == STATUS_PENDING)
@@ -1655,9 +1661,8 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
                     UInt32x32To64(GET_PARTITION_LENGTH(PartitionDescriptor),
                                   SectorSize);
 
-                // BUGBUGBUG: The correct partition numbers seem to cause boot failures!!!
-//                PartitionInfo->PartitionNumber = (!IsContainerPartition(PartitionType)) ? i : 0;
-                PartitionInfo->PartitionNumber = i + 1;
+                /* Get the partition number */
+                PartitionInfo->PartitionNumber = (!IsContainerPartition(PartitionType)) ? i + 1 : 0;
             }
             else
             {
@@ -1842,7 +1847,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
     do
     {
         /* Reset the event since we reuse it */
-        KeResetEvent(&Event);
+        KeClearEvent(&Event);
 
         /* Build the read IRP */
         Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
@@ -1907,7 +1912,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
                 PartitionDescriptor->PartitionType = (UCHAR)PartitionType;
 
                 /* Reset the reusable event */
-                KeResetEvent(&Event);
+                KeClearEvent(&Event);
 
                 /* Build the write IRP */
                 Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,