change to xbpartitioner 1.1 code. It reads the cluster size from the FATX superblock of the extended partitions and displays it on-screen. When formatting 32K and 64K clustered large partitions, this will confirm the actual cluster size used since the value is read from the hdd
the formatting has been completed. I've only managed to test 16K and 32K by rotating among the existing supported partition schemes for F and G, ie F takes all, F and G splits equally and so on. 64K is untested since I don't have a hdd of that size.
I will only release the relevant changes in patch to the source code and not the binary for obvious reasons. I added one method and modified another method. And modified one struct.
wchar_t buf1[200], buf2[200], buf3[200], buf4[200],buf5[200];
unsigned int
get_clustersize(ANSI_STRING part)
{
HANDLE hDisk;
NTSTATUS status;
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
BYTE PartSector[XBOX_HD_SECTOR_SIZE*8];
LARGE_INTEGER RWOffset;
FATX_SUPERBLOCK fsb;
InitializeObjectAttributes(&ObjectAttributes, &part, OBJ_CASE_INSENSITIVE, NULL);
RWOffset.QuadPart = 0;
memset(PartSector, 0, sizeof(PartSector));
status = NtOpenFile(&hDisk, SYNCHRONIZE | GENERIC_ALL, &ObjectAttributes, &IoStatusBlock, 0, FILE_SYNCHRONOUS_IO_ALERT);
if (NT_SUCCESS(status))
status = NtReadFile(hDisk, NULL, NULL, NULL, &IoStatusBlock, (PVOID) PartSector, sizeof(PartSector), &RWOffset);
else
return 0;
NtClose(hDisk);
memcpy (&fsb,PartSector,sizeof(PartSector));
return fsb.ClusterSize/2;
}
void DrawTable(XboxPartitionTable *PartTbl, ULONG TotalSectors, int g_iCurrentPart)
{
ULONG FreeSectors = part_get_free_sectors(PartTbl, TotalSectors);
int i, offset = 8;
unsigned int cluster_size;
LARGE_INTEGER sz, free_sz;
sz.QuadPart = (ULONGLONG) TotalSectors * 512UL;
sz.QuadPart /= 1048576;
free_sz.QuadPart = (ULONGLONG) FreeSectors * 512UL;
free_sz.QuadPart /= 1048576;
// swprintf(buf1, L"Disk Size: %I64uMB - %I64uMB Free", sz, free_sz);//((ULONGLONG) TotalSectors * 512UL)) / 1000000000000UL;
// DisplayText(buf1, 50, 20 * g_ypos++, 2);
g_ypos = 4;
for (i = 0; i < 5; i++)
{
swprintf(buf1, L"%d", i+1);
swprintf(buf2, L"start %.08x", PartTbl->TableEntries
.LBAStart);
swprintf(buf3, L" size %.08x", PartTbl->TableEntries.LBASize);
swprintf(buf4, L"%.2f MB", (double) ((ULONGLONG) PartTbl->TableEntries.LBASize * 512) / 1048576);
if (g_iCurrentPart == i /*&& PartTbl->TableEntries.Flags*/)
{
DrawRect(48, (float) (20 * g_ypos + offset - 4), 596, (float) (20 * g_ypos + offset + 20), 0xa0404040, 0xa0000000);
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 4 :
;
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 0 : 4) : (g_iMovePart ? 0 :
);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 4 : 0) : (g_iMovePart ? 8 : 0));
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8, XFONT_RIGHT);
}
else
{
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7, XFONT_RIGHT);
}
}
g_ypos += 2;
offset = 13;
for (; i < 14; i++)
{
swprintf(buf1, L"%d", i+1);
swprintf(buf2, L"start %.08x", PartTbl->TableEntries.LBAStart);
swprintf(buf3, L" size %.08x", PartTbl->TableEntries.LBASize);
swprintf(buf4, L"%.2f GB", (double) ((ULONGLONG) PartTbl->TableEntries.LBASize * 512) / 1073741824);
cluster_size = get_clustersize(partition_str);
if (cluster_size !=0)
{
swprintf(buf5, L"%dK", cluster_size);
}
else
{
swprintf(buf5, L"");
}
if (g_iCurrentPart == i /*&& PartTbl->TableEntries.Flags*/)
{
DrawRect(48, (float) (20 * g_ypos + offset - 4), 596, (float) (20 * g_ypos + offset + 20), 0xa0404040, 0xa0000000);
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 4 :
;
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 0 : 4) : (g_iMovePart ? 0 :
);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 4 : 0) : (g_iMovePart ? 8 : 0));
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8, XFONT_RIGHT);
}
else
{
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
if(cluster_size!=0 && PartTbl->TableEntries.LBASize>0)
DisplayTableText(buf5, 438, 20 * g_ypos + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries.Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7, XFONT_RIGHT);
}
}
}