Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get BytesPerCluster?

Posted on 1998-08-06
8
Medium Priority
?
229 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 200 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

877 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