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

Discussion in 'Python' started by Sylwia, Apr 14, 2004.

  1. Sylwia

    Sylwia Guest

    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
     
    Sylwia, Apr 14, 2004
    #1
    1. Advertising

  2. Sylwia

    Peter Hansen Guest

    Re: [Win32] HEEEEEEELLLLPPPP! I need to determine the cluster sizeon WinXP/NT/2k

    Sylwia wrote:

    > 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
     
    Peter Hansen, Apr 14, 2004
    #2
    1. Advertising

  3. On 14 Apr 2004 08:37:41 -0700, (Sylwia) declaimed the
    following in comp.lang.python:

    > 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.

    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
     
    Dennis Lee Bieber, Apr 14, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sylwia
    Replies:
    6
    Views:
    2,402
    Josiah Carlson
    Apr 21, 2004
  2. Tim Golden
    Replies:
    1
    Views:
    832
    Josiah Carlson
    Apr 21, 2004
  3. sunny
    Replies:
    5
    Views:
    2,115
    CBFalconer
    Aug 17, 2006
  4. Jeff
    Replies:
    12
    Views:
    219
  5. Timo
    Replies:
    1
    Views:
    195
    Vincent van Beveren
    Jun 14, 2004
Loading...

Share This Page