Solved

How to get BytesPerCluster?

Posted on 1998-08-06
8
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

635 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