Solved

How to get BytesPerCluster?

Posted on 1998-08-06
8
208 Views
Last Modified: 2013-12-03
Hi,

Here's the way I get the BytesPerCluster in my freeware to caculate disk allocation.

      if(GetDiskFreeSpace(szCurrDir,
            &dwSectorsPerCluster, &dwBytesPerSector,
            &dwFreeClusters, &dwClusters))
            dwBytesPerCluster = dwSectorsPerCluster*dwBytesPerSector;

One of my user, apparently knows better windows than me, point out that the figure I got (32k) is wrong:

> "On the latest Win95, OSR 2, and Win98 operating systems, FAT32 allows 4 KB clusters for large HD's between 2 GB to 2 TB size. "

I've notice that the figure I got is wired already, and it is not correct also on Novell. So I want to know, how to get it through VC? Thanks
0
Comment
Question by:tsun
  • 5
  • 3
8 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1413194
Windows 95 OSR 2: The GetDiskFreeSpaceEx function is available on Windows 95 systems beginning with OEM Service Release 2 (OSR 2). The GetDiskFreeSpaceEx function returns correct values for all volumes, including those that are greater than 2 gigabytes.

But it does not return the value you want.

You need to use Int 21h Function 7303h Get_ExtFreeSpace (FAT32). It returns the following structure implemented in Windows OEM Service Release 2 and later.

ExtGetDskFreSpcStruc STRUC
    ExtFree_Size                      DW    ?
    ExtFree_Level                     DW    ?
    ExtFree_SectorsPerCluster         DD    ?
    ExtFree_BytesPerSector            DD    ?
    ExtFree_AvailableClusters         DD    ?
    ExtFree_TotalClusters             DD    ?
    ExtFree_AvailablePhysSectors      DD    ?
    ExtFree_TotalPhysSectors          DD    ?
    ExtFree_AvailableAllocationUnits  DD    ?
    ExtFree_TotalAllocationUnits      DD    ?
    ExtFree_Rsvd                      DD    2 DUP (?)
ExtGetDskFreSpcStruc ENDS

See the Platform SDK documentation for how to call it.

Platform SDK\Windows Base Services\Windows 95 Features\Using Windows 95 Features\FAT32 File System

Platform SDK\Windows Base Services\Windows 95 Features\Using Windows 95 Features\Windows 95 Reference\FAT32 API Reference
0
 

Author Comment

by:tsun
ID: 1413195
Wow! You're really a genius.

I'd like to ask just one more question before I close my question: It seems I have to treate differently with different disks, at least Novell doesn't support Int 21h Function 7303h, right? Anything else should be take into account?

Any suggestions? (It doesn't affect how I grade your score if you don't, :-) )


0
 
LVL 23

Expert Comment

by:chensu
ID: 1413196
>It seems I have to treate differently with different disks, at least Novell doesn't support Int 21h Function 7303h, right?

Yes, you're right.

>Anything else should be take into account? Any suggestions?

If you are going to support NTFS in your Windows NT application, you can get more information about NTFS. See http://www.sysinternals.com/ntfsinfo.htm.

0
 

Author Comment

by:tsun
ID: 1413197
Wow! You're really a genius.

I'd like to ask just one more question before I close my question: It seems I have to treate differently with different disks, at least Novell doesn't support Int 21h Function 7303h, right? Anything else should be take into account?

Any suggestions? (It doesn't affect how I grade your score if you don't, :-) )


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 23

Expert Comment

by:chensu
ID: 1413198
>It seems I have to treate differently with different disks, at least Novell doesn't support Int 21h Function 7303h, right?

Yes, you're right.

>Anything else should be take into account? Any suggestions?

If you are going to support NTFS in your Windows NT application, you can get more information about NTFS. See http://www.sysinternals.com/ntfsinfo.htm.

0
 

Author Comment

by:tsun
ID: 1413199
Wow! You're really a genius.

I'd like to ask just one more question before I close my question: It seems I have to treate differently with different disks, at least Novell doesn't support Int 21h Function 7303h, right? Anything else should be take into account?

Any suggestions? (It doesn't affect how I grade your score if you don't, :-) )


0
 

Author Comment

by:tsun
ID: 1413200
OK, Thanks very much!
0
 

Author Comment

by:tsun
ID: 1413201
OK, Thanks very much!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now