+VOID
+NTAPI
+FstubFixupEfiPartition(IN PPARTITION_DESCRIPTOR PartitionDescriptor,
+ IN ULONGLONG MaxOffset)
+{
+ ULONG PartitionLength;
+ PAGED_CODE();
+
+ /* Compute partition length (according to MBR entry) */
+ PartitionLength = PartitionDescriptor->StartingSectorLsb0 + PartitionDescriptor->PartitionLengthLsb0;
+ /* In case the partition length goes beyond disk size... */
+ if (PartitionLength > MaxOffset)
+ {
+ /* Resize partition to its maximum real length */
+ PartitionDescriptor->PartitionLengthLsb0 = MaxOffset - PartitionDescriptor->StartingSectorLsb0;
+ }
+}
+