mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[NTOSKRNL]
Fix FstubFixupEfiPartition() Add helper macro SET_PARTITION_LENGTH() svn path=/trunk/; revision=53784
This commit is contained in:
parent
2454366c35
commit
1f95a6dd13
2 changed files with 11 additions and 6 deletions
|
@ -1365,18 +1365,17 @@ NTAPI
|
|||
FstubFixupEfiPartition(IN PPARTITION_DESCRIPTOR PartitionDescriptor,
|
||||
IN ULONGLONG MaxOffset)
|
||||
{
|
||||
ULONG PartitionLength;
|
||||
ULONG PartitionMaxOffset, PartitionLength;
|
||||
PAGED_CODE();
|
||||
|
||||
/* Compute partition length (according to MBR entry) */
|
||||
PartitionLength = PartitionDescriptor->StartingSectorLsb0 + PartitionDescriptor->PartitionLengthLsb0;
|
||||
PartitionMaxOffset = GET_STARTING_SECTOR(PartitionDescriptor) + GET_PARTITION_LENGTH(PartitionDescriptor);
|
||||
/* In case the partition length goes beyond disk size... */
|
||||
if (PartitionLength > MaxOffset)
|
||||
if (PartitionMaxOffset > MaxOffset)
|
||||
{
|
||||
/* Resize partition to its maximum real length */
|
||||
#pragma message("--> FIXME: FstubFixupEfiPartition is most likeley broken!")
|
||||
PartitionDescriptor->PartitionLengthLsb0 =
|
||||
(UCHAR)(MaxOffset - PartitionDescriptor->StartingSectorLsb0);
|
||||
PartitionLength = (ULONG)(PartitionMaxOffset - GET_STARTING_SECTOR(PartitionDescriptor));
|
||||
SET_PARTITION_LENGTH(PartitionDescriptor, PartitionLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -264,6 +264,12 @@ xKdUnmapVirtualAddress(
|
|||
(ULONG)(p->PartitionLengthMsb0 << 16) + \
|
||||
(ULONG)(p->PartitionLengthMsb1 << 24))
|
||||
|
||||
#define SET_PARTITION_LENGTH(p, l) \
|
||||
p->PartitionLengthLsb0 = l & 0xFF; \
|
||||
p->PartitionLengthLsb1 = (l >> 8) & 0xFF; \
|
||||
p->PartitionLengthMsb0 = (l >> 16) & 0xFF; \
|
||||
p->PartitionLengthMsb1 = (l >> 24) & 0xFF
|
||||
|
||||
//
|
||||
// Structure describing a partition
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue