tkocsir Posted September 1, 2010 Posted September 1, 2010 Hi! I need to detect the drive letter from a string like \Device\HarddiskVolume2, but I don't know how to use the DllCall function with GetVolumeNameForVolumeMountPoint. For example I write something like this: $driveletter = DllCall("kernel32.dll","something","GetVolumeNameForVolumeMountPoint",...some stuff, and \Device\HarddiskVolume2\...) And then $driveletter would be "C:" or "D:\" or anything. Can someone write me the right syntax? Regards, Thomas
wakillon Posted September 1, 2010 Posted September 1, 2010 See this ProgAndy post, it can help you AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
tkocsir Posted September 1, 2010 Author Posted September 1, 2010 See this ProgAndy post, it can help you I found this post earlier and started to play around with those scripts, but I couldn't manage to create anything useful.
Yashied Posted September 1, 2010 Posted September 1, 2010 What you mean "\Device\HarddiskVolume2"? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
tkocsir Posted September 1, 2010 Author Posted September 1, 2010 (edited) What you mean "\Device\HarddiskVolume2"?I need to read paths from the registry and several values contain the path as:\Device\HarddiskVolume2\Program Files\SomeProgram\exe.exeAnd I need to do different hashes (MD5, SHA-1) for the file, but this is not an acceptable path form for the function. (I am using this: hash udf) Edited September 1, 2010 by tkocsir
UEZ Posted September 1, 2010 Posted September 1, 2010 You can use WMI and its class Win32_Volume to get the volumes and the appropriate drive letters but it displays only DeviceIDs and not e.g. \Device\HarddiskVolume2\.Maybe somebody knows how to get the desired name from the DeviceID...Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Yashied Posted September 1, 2010 Posted September 1, 2010 (edited) #Include <WinAPIEx.au3> ConsoleWrite(_DosPathNameToPathName('\Device\HarddiskVolume2\Program Files\SomeProgram\exe.exe') & @CR) Func _DosPathNameToPathName($sPath) Local $sName, $aDrive = DriveGetDrive('ALL') If Not IsArray($aDrive) Then Return SetError(1, 0, $sPath) EndIf For $i = 1 To $aDrive[0] $sName = _WinAPI_QueryDosDevice($aDrive[$i]) If StringInStr($sPath, $sName) = 1 Then Return StringReplace($sPath, $sName, StringUpper($aDrive[$i]), 1) EndIf Next Return SetError(2, 0, $sPath) EndFunc ;==>_DosPathNameToPathNameWinAPIEx.au3 Edited September 1, 2010 by Yashied VAN0 1 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
tkocsir Posted September 2, 2010 Author Posted September 2, 2010 #Include <WinAPIEx.au3> ConsoleWrite(_DosPathNameToPathName('\Device\HarddiskVolume2\Program Files\SomeProgram\exe.exe') & @CR) Func _DosPathNameToPathName($sPath) Local $sName, $aDrive = DriveGetDrive('ALL') If Not IsArray($aDrive) Then Return SetError(1, 0, $sPath) EndIf For $i = 1 To $aDrive[0] $sName = _WinAPI_QueryDosDevice($aDrive[$i]) If StringInStr($sPath, $sName) = 1 Then Return StringReplace($sPath, $sName, StringUpper($aDrive[$i]), 1) EndIf Next Return SetError(2, 0, $sPath) EndFunc ;==>_DosPathNameToPathName WinAPIEx.au3 Thank you very much Yashied, it works! *facepalm* that I didn't find this function in WinAPIEx...
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