BlueSkyMemory Posted April 13, 2020 Posted April 13, 2020 $RET = DllCall("Kernel32.dll", "int", "FindFirstVolume", "str", "", "str", 255) ConsoleWrite($RET[1] & @TAB & DriveGetLabel($RET[1]) & @TAB & DirGetSize($RET[1]) & @CRLF) ConsoleWrite(_GetVolumeMountPoint($RET[1])) $RET[1] = $RET[0] While 1 $RET = DllCall("Kernel32.dll", "int", "FindNextVolume", "int", $RET[1], "str", "", "str", 255) If Not $RET[0] Then ExitLoop ConsoleWrite(_GetVolumeMountPoint($RET[2])) ConsoleWrite($RET[2] & @TAB & DriveGetLabel($RET[2]) & @CRLF) WEnd Func _GetVolumeMountPoint($sGUID) Local $sResult = '' Local $tTag = DllStructCreate("char lpszVolumeMountPoint[256]") $aRet = DllCall("Kernel32.dll", "int", "FindFirstVolumeMountPoint", "str", $sGUID, "str", $tTag, 'int', DllStructGetSize($tTag)) $sResult &= $aRet[2] Return $sResult $aRet[1] = $aRet[0] While 1 $aRet = DllCall("Kernel32.dll", "int", "FindNextVolumeMountPoint", "int", $aRet[1], "str", $tTag, 'int', DllStructGetSize($tTag)) If Not $aRet[0] Then ExitLoop $sResult &= $aRet[2] WEnd Return $sResult EndFunc ;==>_GetVolumeMountPoint This is my code. The function is to get all GUIDs and then get the mountpoint of them. But the result is that it can only get which mountpoint I set to, not the drive letter. Do I misunderstand it? So why it cannot get the drive letter?
BlueSkyMemory Posted April 15, 2020 Author Posted April 15, 2020 I've found another function -- GetVolumePathNamesForVolumeName and it can detect the drive letter. Thank you!😊
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now