[Win32] HEEEEEEELLLLPPPP! I need to determine the cluster size on WinXP/NT/2k

Sylwia lubowiecka at go2.pl
Wed Apr 14 11:37:41 EDT 2004


Hi!

I need Your help. I implement a Python NT service and I need to
determine (on WinXP/2k/XP) a cluster size of the particular partition
(to find out how much space a file will occupy on that partition).

Till now I faced the following problems:

- The GetDiskFreeSpace() function is reliable in deriving cluster size
if it is a FAT16 drive. If it is a FAT32 drive, the Win32
GetDiskFreeSpace  call is lying about cluster size.

-The newer GetDiskFreeSpaceEx call returns total and free space on the
drive, but does not provide a cluster size parameter at all!!!

-There's a small table that summarizes the default cluster size for 
every range of FAT32 volume sizes, but there's no guarantee that the 
user accepted the default when creating the partition :((((

- There is a DOS function, Int 21h Function 7303h Get_ExtFreeSpace
(FAT32),
but it exists only in Windows 95 SR 2 and later. This can be called 
through VWIN32.VXD using DeviceIoControl (unfortunately VWIN32 is
Win9x/Me specific driver and it's not available on Win2K/XP).

So is there any API that gets the FAT32 cluster size correctly in
WinNT/2k/XP?
Does anyone know of an API function that can tell me how much space a
file will occupy on the disk? It'll need to work with FAT, FAT32, and
NTFS.

Thank You in advance!

Farraige



More information about the Python-list mailing list