Identify Networked CD Drives

Identify Networked CD Drives

The 32-bit API is much richer than the 16-bit API. However, theGetDriveType still reports networked CD drives as just a DRIVE_REMOTE(i.e., a networked drive). While true, it is not particularlyhelpful. Combine the GetDriveType call with the GetVolumeInformationcall to determine that it is both a network drive and a CD drive.

The next-to-last parameter of this call returns a string thatgives the type of file system on that volume: FAT, NTFS, HPFS,CDFS (CD File System):

 Declare Function GetVolumeInformation _        Lib "kernel32" Alias _        "GetVolumeInformationA" (ByVal _        lpRootPathName As String, ByVal _        lpVolumeNameBuffer As String,_        ByVal nVolumeNameSize As Long, _        lpVolumeSerialNumber As Long, _        lpMaximumComponentLength As Long, _        lpFileSystemFlags As Long, ByVal _        lpFileSystemNameBuffer As String, _        ByVal nFileSystemNameSize As _        Long) As Long        pstrRootPath = "E:"        pstrVolName = Space$(256)        pstrSystemType = Space$(32)        plngSysTypeSize = CLng(Len(pstrSystemType))        plngVolNameSize =       CLng(Len(pstrVolName))        plngRtn = GetVolumeInformation_                (pstrRootPath, pstrVolName, _                plngVolNameSize, plngVolSerialNum, _                plngMaxFilenameLen, plngSysFlags, _                pstrSystemType, plngSysTypeSize)


Share the Post: