As you know the Name property on Windows returns the drive letter, not the “volume name” which is more properly understood on Windows as a “drive label”. This is important because the Name on the Mac is directly involved in the Path, whereas on Windows it’s pretty much for the users convenience.
The Windows Functionality Suite is your friend here, this code is from it, it’s in the FileProcessing module.
Protected Function GetVolumeName(root as FolderItem) As String
#if TargetWin32
Soft Declare Function GetVolumeInformationA Lib “Kernel32” ( root as CString, _
volName as Ptr, volNameSize as Integer, ByRef volSer as Integer, ByRef _
maxCompLength as Integer, ByRef sysFlags as Integer, sysName as Ptr, _
sysNameSize as Integer ) as Boolean
Soft Declare Function GetVolumeInformationW Lib “Kernel32” ( root as WString, _
volName as Ptr, volNameSize as Integer, ByRef volSer as Integer, ByRef _
maxCompLength as Integer, ByRef sysFlags as Integer, sysName as Ptr, _
sysNameSize as Integer ) as Boolean
dim volName as new MemoryBlock( 256 )
dim sysName as new MemoryBlock( 256 )
dim volSerial, maxCompLength, sysFlags as Integer
if System.IsFunctionAvailable( "GetVolumeInformationW", "Kernel32" ) then
Call GetVolumeInformationW( left( root.AbsolutePath, 3 ), volName, 256, volSerial, maxCompLength, _
sysFlags, sysName, 256 )
return volName.WString( 0 )
else
Call GetVolumeInformationA( left( root.AbsolutePath, 3 ), volName, 256, volSerial, maxCompLength, _
sysFlags, sysName, 256 )
return volName.CString( 0 )
end if
#endif
End Function