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.
Will attach the code in another post.
partition.h
CODE
typedef struct _FATX_SUPERBLOCK
{
char Tag[4];
unsigned int VolumeID;
unsigned int ClusterSize;
USHORT FatCopies;
int Resvd;
char Unused[4078];
} FATX_SUPERBLOCK;
PartInfo.cpp
CODE
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[i].LBAStart);
swprintf(buf3, L" size %.08x", PartTbl->TableEntries[i].LBASize);
swprintf(buf4, L"%.2f MB", (double) ((ULONGLONG) PartTbl->TableEntries[i].LBASize * 512) / 1048576);
if (g_iCurrentPart == i /*&& PartTbl->TableEntries[i].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[i].Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 0 : 4) : (g_iMovePart ? 0 : 8));
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 4 : 0) : (g_iMovePart ? 8 : 0));
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8, XFONT_RIGHT);
}
else
{
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries[i].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[i].LBAStart);
swprintf(buf3, L" size %.08x", PartTbl->TableEntries[i].LBASize);
swprintf(buf4, L"%.2f GB", (double) ((ULONGLONG) PartTbl->TableEntries[i].LBASize * 512) / 1073741824);
cluster_size = get_clustersize(partition_str[i]);
if (cluster_size !=0)
{
swprintf(buf5, L"%dK", cluster_size);
}
else
{
swprintf(buf5, L"");
}
if (g_iCurrentPart == i /*&& PartTbl->TableEntries[i].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[i].Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 0 : 4) : (g_iMovePart ? 0 : 8));
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? (g_iMovePart ? 4 : 0) : (g_iMovePart ? 8 : 0));
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 4 : 8, XFONT_RIGHT);
}
else
{
DisplayTableText(buf1, 50, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf2, 84, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf3, 258, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
if(cluster_size!=0 && PartTbl->TableEntries[i].LBASize>0)
DisplayTableText(buf5, 438, 20 * g_ypos + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7);
DisplayTableText(buf4, 592, 20 * g_ypos++ + offset, (PartTbl->TableEntries[i].Flags & PE_PARTFLAGS_IN_USE) ? 2 : 7, XFONT_RIGHT);
}
}
}



