grasshopper3 Posted May 14, 2010 Posted May 14, 2010 I am trying to mount a True Crypt device. I have used the _TC.au3 include (found in the forums) to mount a True Crypt volume, but it doesn't seem to work for a device (\Device\Harddisk1\Partition1). Does anyone know how to mount a True Crypt device. Thanks
PsaltyDS Posted May 14, 2010 Posted May 14, 2010 (edited) Try a full device path, more like: "\\.\Device\Harddisk1\Partition1"Edit: The docs say that's only required for a volume name: "\\?\Volume{5cceb196-48bf-46ab-ad00-70965512253a}""/v \Device\Harddisk1\Partition3" is explicitly used as and example, so that syntax should work. They are case sensitive, though. Edited May 14, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
grasshopper3 Posted May 14, 2010 Author Posted May 14, 2010 (edited) I tried that method. It works in command line, but when I add it in the AutoIt script it doesn't work. Can someone else test it on their True Crypt and tell me if it has some thing to do with my Device or setup? Edited May 16, 2010 by grasshopper3
grasshopper3 Posted May 18, 2010 Author Posted May 18, 2010 (edited) Can someone please help. I am still trying to mount a True Crypt device instead of a container. I have tried the following methods without success. FileWrite(@Scriptdir & "\Mount.bat",'"C:\Program Files\TrueCrypt\TrueCrypt.exe" /volume ' & $Volume & ' /letter ' & $DrLetter & ' /auto /p "' & $Pass & '" /q') RUn(@Scriptdir & "\Mount.bat", "", @SW_MAXIMIZE) I couldn't get the RUN command to run the batch file RunWait(@ComSpec & " /c " & '"C:\Program Files\TrueCrypt\TrueCrypt.exe" /volume ' & $Volume & ' /letter ' & $DrLetter & ' /auto /p "' & $Pass & '" /q',"", @SW_HIDE) _TC.au3 expandcollapse popup;_TC.au3 V0.1.2A #include-Once ;Gets or sets the path of the TrueCrypt executable (only needed if truecrypt is installed to a different path) Func _TC_Path($sPath = "") Static $sTCPath = @ProgramFilesDir & "\TrueCrypt\TrueCrypt.exe" Switch $sPath Case "" Return $sTCPath Case Else $sTCPath = $sPath EndSwitch EndFunc ;==>_TC_Path ;Mounts a TrueCrypt volume ;@Error=1: $sVol does not exist or is a directory ;@Error=2: $cLetter was not valid (must be in the format "E" not "E:" or "E:\") ;Return 1:Success ;Return 0:Failure Func _TC_Mount($sVol, $cLetter, $sPassword = "") If Not FileExists($sVol) Then Return SetError(1, 0, 0) If StringInStr(FileGetAttrib($sVol), "D") Then Return SetError(1, 0, 0) If StringLen($cLetter) <> 1 Then Return SetError(2, 0, 0) If Not StringIsAlpha($cLetter) Then Return SetError(2, 0, 0) Switch $sPassword Case "" Return Not RunWait('"' & _TC_Path() & '" /q /v "' & $sVol & '" /l' & $cLetter) Case Else Return Not RunWait('"' & _TC_Path() & '" /q /s /p "' & $sPassword & '" /v "' & $sVol & '" /l' & $cLetter) EndSwitch EndFunc ;==>_TC_Mount ;Unmounts a TrueCrypt Volume ;@Error=1: $cLetter was not valid (must be in the format "E" not "E:" or "E:\") ;@Error=2: $iForce was not valid (must be 0 or "1) ;Return 1:Success ;Return 0:Failure Func _TC_UnMount($cLetter, $iForce = 0) If StringLen($cLetter) <> 1 Then Return SetError(1, 0, 0) If Not StringIsAlpha($cLetter) Then Return SetError(1, 0, 0) If Not ($iForce = 0 Or $iForce = 1) Then Return SetError(2, 0, 0) Switch $iForce Case 1 Return Not RunWait('"' & _TC_Path() & '" /s /q /f /d' & $cLetter) Case 0 Return Not RunWait('"' & _TC_Path() & '" /s /q /d' & $cLetter) EndSwitch EndFunc ;==>_TC_UnMount Edited May 18, 2010 by grasshopper3
KaFu Posted May 18, 2010 Posted May 18, 2010 Try it step by step via cmd.exe, most likly it's the faulty command-line support for passwords on Windows (not all charachters are supported, if I remember right a space in the PW also busts the automount process)... Open a cmd.exe window and start with "C:\Program Files\TrueCrypt\TrueCrypt.exe" /volume \Device\Harddisk1\Partition1 /letter Z /q if this works, advance step by step. Â OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13)Â BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16)Â ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
grasshopper3 Posted May 18, 2010 Author Posted May 18, 2010 Try it step by step via cmd.exe, most likly it's the faulty command-line support for passwords on Windows (not all charachters are supported, if I remember right a space in the PW also busts the automount process)...Open a cmd.exe window and start with"C:\Program Files\TrueCrypt\TrueCrypt.exe" /volume \Device\Harddisk1\Partition1 /letter Z /qif this works, advance step by step.I can get it to work in command line fine. I have been doing it in command line for a year. I just can't get it to work from Autoit.
SkinnyWhiteGuy Posted May 18, 2010 Posted May 18, 2010 Why are you using "" for Working Directory? Try putting either @ScriptDir for it, or the location of the file you are trying to run.
grasshopper3 Posted May 18, 2010 Author Posted May 18, 2010 Why are you using "" for Working Directory? Try putting either @ScriptDir for it, or the location of the file you are trying to run.RUn(@Scriptdir & "\Mount.bat", @Scriptdir, @SW_MAXIMIZE)RUn(@Scriptdir & "\Mount.bat", @Scriptdir & "\Mount.bat", @SW_MAXIMIZE)both didn't work
GEOSoft Posted May 18, 2010 Posted May 18, 2010 ShellExecute(@ScriptDir & "\mount.bat") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
grasshopper3 Posted May 18, 2010 Author Posted May 18, 2010 (edited) ShellExecute(@ScriptDir & "\mount.bat") Worked! Thanks! But ultimately I would like to be able to do from within Autoit (without the batch file). Does anyone have any ideas on how? Edited May 18, 2010 by grasshopper3
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