Jump to content

Mount True Crypt Device


Recommended Posts

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

Link to comment
Share on other sites

Try a full device path, more like: "\\.\Device\Harddisk1\Partition1"

:idea:

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 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
Link to comment
Share on other sites

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 by grasshopper3
Link to comment
Share on other sites

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

;_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 by grasshopper3
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...