The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: sinsi on December 31, 2008, 04:50:04 AM

Title: Detecting an NTFS volume
Post by: sinsi on December 31, 2008, 04:50:04 AM
I've been playing around with checking fragmentation of a file using FSCTL_GET_RETRIEVAL_POINTERS, but this only works on NTFS volumes.
Is there an easy and approved way to check for NTFS? I can think of a few (GetVolumeInformation, reading the boot sector, opening $MFT) but there
seem to be workarounds.
Title: Re: Detecting an NTFS volume
Post by: donkey on December 31, 2008, 06:01:32 AM
GetVolumeInformation does the trick...

invoke GetVolumeInformation,offset DriveName,0,0,0,0,0,offset szFSName,64
invoke szCmpi,offset szFSName,"NTFS"


Pass the volume name for example "C:" in DriveName and the filesystem will be returned in szFSName. FSCTL_FILESYSTEM_GET_STATISTICS should also work.
Title: Re: Detecting an NTFS volume
Post by: sinsi on December 31, 2008, 06:16:47 AM
Yeah, but I seem to remember reading that you can't rely on it (ralph?old msdn?).

Heh, the current MSDN info is really helpful...
Quote
lpFileSystemNameBuffer [out]
A pointer to a buffer that receives the name of the file system, for example, the FAT file system or the NTFS file system. The maximum buffer size is MAX_PATH+1.
I know it will be "FAT32" or "FAT16" or "NTFS", but good feckin explanation.  ::)