FuryCell Posted January 5, 2010 Share Posted January 5, 2010 (edited) These UDFs give the ability to mount and unmount truecrypt volumes from a script. They are simply wrappers for the command line interface of TrueCrypt.Download Edited January 22, 2010 by P5ych0Gigabyte HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
IchBistTod Posted June 7, 2010 Share Posted June 7, 2010 Modified to work with 64 bit expandcollapse popup;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 = "") if @OSArch = "X32" Then Static $sTCPath = @ProgramFilesDir & "\TrueCrypt\TrueCrypt.exe" Else Static $sTCPath = @HomeDrive&"\Program Files (x86)\TrueCrypt\TrueCrypt.exe" EndIf Switch $sPath Case "" Return $sTCPath Case Else $sTCPath = $sPath EndSwitch EndFunc ;==>_TC_Path ;Mounts a TrueCrypt volume ;@Error=1: $sVol POSSIBLY 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 SetError(1, 0, 0) If StringInStr(FileGetAttrib($sVol), "D") Then 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 ShellExecuteWait( _TC_Path() & '" /q /v "' & $sVol & '" /l' & $cLetter) Case Else Return ShellExecute(_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 [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
FuryCell Posted June 7, 2010 Author Share Posted June 7, 2010 @IchBistTod Cool. I usually compile to 32bit but this is useful. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
IchBistTod Posted June 7, 2010 Share Posted June 7, 2010 Well when running in script form when on 64 bit or compiled to 64 bit, it needs these modifications to work. I also changed run to shellexecute, to make sure the truecrypt exe exists. [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
FuryCell Posted June 8, 2010 Author Share Posted June 8, 2010 (edited) Well when running in script form when on 64 bit or compiled to 64 bit, it needs these modifications to work.I also changed run to shellexecute, to make sure the truecrypt exe exists.How does changing to shellexecute make a difference? Can't you just check the return value of run? Edited June 8, 2010 by FuryCell HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
IchBistTod Posted June 8, 2010 Share Posted June 8, 2010 It was using that method, but the function would successfully complete without any sign of error. Also, using shell execute with the parameters to pass cmdline params to the exe is more reliable. [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
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