Skip to content

Commit 10e3391

Browse files
author
deadwood
committed
Fix: extLowBlock and extHighBlock must be relative to start of EBR
They cannot be assigned from rootLowBlock/rootHighBlock because these are relative to start of disk. This was causing child partitions in EBR to get de_LowCyl and de_HighCyl values which are relative to start of disk, while these must be relative to start of EBR or writes will happen "after end of disk". Problem visible when there are MBR partitions covering at least half of disk before EBR partition.
1 parent b85ad8c commit 10e3391

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

workbench/c/Partition/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
#define MAX_SFS_SIZE (124L * 1024)
122122
#define MAX_SIZE(A) (((A) == &sfs0) ? MAX_SFS_SIZE : MAX_FFS_SIZE)
123123

124-
const TEXT version_string[] = "$VER: Partition 42.0 (18.05.2023)";
124+
const TEXT version_string[] = "$VER: Partition 42.1 (17.04.2025)";
125125

126126
static const struct PartitionType fat32 = { "FAT\2", 4 };
127127
static const struct PartitionType dos3 = { "DOS\3", 4 };
@@ -161,8 +161,8 @@ int main(void)
161161
const struct PartitionType *sysType = NULL, *workType = NULL;
162162
LONG error = 0, sysSize = 0, workSize = 0, sysHighCyl, lowCyl, highCyl,
163163
reqHighCyl, unit, hasActive = FALSE;
164-
QUAD rootLowBlock = 1, rootHighBlock = 0, extLowBlock = 1,
165-
extHighBlock = 0, lowBlock, highBlock, rootBlocks, extBlocks;
164+
QUAD rootLowBlock = 1, rootHighBlock = 0; /* Blocks relative to disk start */
165+
QUAD lowBlock, highBlock, rootBlocks, extBlocks;
166166
ULONG scheme = PHPTT_MBR;
167167
UWORD partCount = 0;
168168

@@ -428,8 +428,6 @@ int main(void)
428428
}
429429
if (extPartition && !activePart)
430430
activePart = extPartition;
431-
extLowBlock = rootLowBlock;
432-
extHighBlock = rootHighBlock;
433431
rootLowBlock = 1;
434432
rootHighBlock = 0;
435433
partCount++;
@@ -444,6 +442,8 @@ int main(void)
444442

445443
if (error == 0)
446444
{
445+
QUAD extLowBlock = 1, extHighBlock = 0; /* Block relative to EBR start */
446+
447447
/* Find largest gap in extended partition */
448448
if (extPartition != NULL)
449449
{

0 commit comments

Comments
 (0)