Home > database >  Get maximum file size for specific drive
Get maximum file size for specific drive

Time:11-05

Is there some WinAPI way to get maximum file size for specific drive?

For example, I know that in FAT32 maximum file size is 4GB. Should I find out that file system on a drive is FAT32 and then use my previous knowledge about FAT32 or there is a way in Windows to get the max file size directly?

What I already do:

I determine file system type using GetVolumeInformation and then use a mapping table that maps file system type to its known maximum file size.

What I want:

I would like to know whether Microsoft has provided a way to get directly the maximum file size in bytes for an arbitrary file system type, even the one that do not exist yet and about which I cannot have knowledge by definition now.

CodePudding user response:

Is there some WinAPI way to get maximum file size for specific drive?

No. Microsoft does not provide an API for that particular piece of information.

Should I find out that file system on a drive is FAT32 and then use my previous knowledge about FAT32

Yes.

or there is a way in Windows to get the max file size directly?

There is no way provided.

I determine file system type using GetVolumeInformation and then use a mapping table that maps file system type to its known maximum file size.

That is what you have to do.

  • Related