Hi Brucey,
I also had a look at this mod and I found out that your windows routines to get the volumes are not perfect meaning that they don't get every volume connected to the pc.
If you go to your Control Panel and then to "Administration Tools" (provided that you have the classical control panel style) and then to "Computer Management". An if you go there to the option "Disk Management" there you can remove the device letter and just mount the device in an empty folder (eg. on your desktop) like on linux (or mac?). And if this is the case your volume routines do not find this device.
So I made a little research an quickly found a way to get this too. Besides my little demo shows that it can also handle mutiple mount points like to folders or a letter and a folder.
I made a little demo to show you how it works. Maybe you can implement it in your module.
Before I forget to mention it it uses the unicode winapi functions (ending with W) for all string things.
SuperStrict
Framework brl.linkedlist
Import brl.standardio
Import "-lkernel32"
Extern "win32"
' volumes
Function FindFirstVolume:Int(volumeName:Short Ptr, bufferSize:Int) = "FindFirstVolumeW@8"
Function FindNextVolume:Int(handle:Int, volumeName:Short Ptr, bufferSize:Int) = "FindNextVolumeW@12"
Function FindVolumeClose:Int(handle:Int) = "FindVolumeClose@4"
' volume paths
Function GetVolumePathNamesForVolumeName:Int(volumeName:Short Ptr, volumePaths:Short Ptr, bufferSize:Int, copiedSize:Int Ptr) = "GetVolumePathNamesForVolumeNameW@16"
EndExtern
For Local volume:TVolume = EachIn TVolume.Scan()
Print volume.guid + "~n~t" + "~n~t".join(volume.paths)
Next
Type TVolume
' maximum length of a path
Const PATH_MAX:Int = $104
' all volumes
Global list:TList
' scans for volumes
Function Scan:TList()
Self.list = New TList
' create buffer
Local nameBuffer:Short[] = New Short[Self.PATH_MAX]
' get the first volume
Local handle:Int = FindFirstVolume(nameBuffer, Self.PATH_MAX)
' if this is the case an error has occured or there are no volumes
If handle < 1 Then Return Self.list
While True
' create new volume
Local volume:TVolume = New TVolume
volume.guid = String.FromWString(nameBuffer)
' retrieve the paths
Local pathsBuffer:Short[] = New Short[Self.PATH_MAX]
Local bufferSize:Int
' It has worked, let us save it
If GetVolumePathNamesForVolumeName(nameBuffer, pathsBuffer, Self.PATH_MAX, Varptr bufferSize) Then
volume.paths = String.FromShorts(pathsBuffer, bufferSize).Trim().split("~0")
' Some error occured – if the buffer was too small we will set it to the
' right size and try it again
ElseIf bufferSize > Self.PATH_MAX
If GetVolumePathNamesForVolumeName(nameBuffer, pathsBuffer, bufferSize, Varptr bufferSize) Then
volume.paths = String.FromShorts(pathsBuffer, bufferSize).Trim().split("~0")
EndIf
EndIf
' add volume to list
Self.list.addLast(volume)
' get the next volume or quit the loop if there is none
If Not FindNextVolume(handle, nameBuffer, Self.PATH_MAX) Then Exit
Wend
' end the volumes search
FindVolumeClose(handle)
Return Self.list
EndFunction
' contains the guid of the volume
Field guid:String
' contains the paths from which the volume is accessible / which the volume is mounted in
Field paths:String[]
EndType