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

S

Sylwia

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
 
P

Peter Hansen

Sylwia said:
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.

It appears you are quoting much of your information directly
from this page:

http://www.techweb.com/winmag/library/1998/0401/howto110.htm

The author appears to have reached the conclusion that there is
no workable solution for NT and friends...

-Peter
 
D

Dennis Lee Bieber

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.
And what is it supposed to report on a compressed partition?
Until you compress the file, you won't know how much space it needs...
So far as I know, compression is done in a stream fashion as you write
the file to the drive.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top