NULL);
Status = ZwOpenDirectoryObject (&DirectoryHandle,
- SYMBOLIC_LINK_ALL_ACCESS,
+ DIRECTORY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
Skip = 0;
while (NT_SUCCESS(Status))
{
- Status = NtQueryDirectoryObject (DirectoryHandle,
+ Status = ZwQueryDirectoryObject (DirectoryHandle,
DirectoryInfo,
2 * PAGE_SIZE,
FALSE,
}
}
}
+
+ ZwClose(DirectoryHandle);
+
ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
return RDiskCount;
}
/* Search for bootable partition */
for (j = 0; j < NUM_PARTITION_TABLE_ENTRIES && j < LayoutArray[DiskNumber]->PartitionCount; j++)
{
- if ((LayoutArray[DiskNumber]->PartitionEntry[j].BootIndicator == TRUE) &&
+ if ((LayoutArray[DiskNumber]->PartitionEntry[j].BootIndicator != FALSE) &&
IsRecognizedPartition(LayoutArray[DiskNumber]->PartitionEntry[j].PartitionType))
{
if (LayoutArray[DiskNumber]->PartitionEntry[j].RewritePartition == FALSE)
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)
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
{
do
{
/* Reset the event since we reuse it */
- KeResetEvent(&Event);
+ KeClearEvent(&Event);
/* Build the read IRP */
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
PartitionDescriptor->PartitionType = (UCHAR)PartitionType;
/* Reset the reusable event */
- KeResetEvent(&Event);
+ KeClearEvent(&Event);
/* Build the write IRP */
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,