Author: pschweitzer
Date: Wed Sep 21 09:11:42 2011
New Revision: 53784
URL:
http://svn.reactos.org/svn/reactos?rev=53784&view=rev
Log:
[NTOSKRNL]
Fix FstubFixupEfiPartition()
Add helper macro SET_PARTITION_LENGTH()
Modified:
trunk/reactos/ntoskrnl/fstub/disksup.c
trunk/reactos/ntoskrnl/include/internal/hal.h
Modified: trunk/reactos/ntoskrnl/fstub/disksup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Wed Sep 21 09:11:42 2011
@@ -1365,18 +1365,17 @@
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);
}
}
Modified: trunk/reactos/ntoskrnl/include/internal/hal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/hal.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/hal.h [iso-8859-1] Wed Sep 21 09:11:42 2011
@@ -263,6 +263,12 @@
(ULONG)(p->PartitionLengthLsb1 << 8) + \
(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