Code : Tout sélectionner
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=tcloader.ico
#AutoIt3Wrapper_outfile=TC_Loader.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=Portable launcher file for Truecrypt
#AutoIt3Wrapper_Res_Description=Launcher file for Truecrypt
#AutoIt3Wrapper_Res_Fileversion=1.1.6.0
#AutoIt3Wrapper_Res_LegalCopyright=Published in http://www.usboffice.kr
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Allow_Decompile=n
#include <GUIConstants.au3>
Global const $Appdir = @ScriptDir &"\Program files\TrueCrypt"
Global const $DataDir = @ScriptDir&"\Data"
Global const $SettingFile = $DataDir &"\settings.ini"
Global const $settingsDir = $datadir &"\settings"
Global const $CurrentDriveLetter = StringLeft(@ScriptDir, 2)
Global Const $AppExe = $AppDir & '\TrueCrypt.exe' ; ½ÇÁ¦ ½ÇÇà½Ãų ÇÁ·Î±×·¥
Local $Process = StringSplit($AppExe, '\')
Global Const $ProcessName = $Process[$Process[0]]
Global $Imagepath = IniRead($settingfile, "Truecrypt settings", "Imagepath", "")
Global $ImageLetter = IniRead($settingfile, "Truecrypt settings", "Imageletter", "")
Global $Drivetype = IniRead($settingfile, "Truecrypt settings", "Removable", "")
Global $ImgExplorer = IniRead($settingfile, "Truecrypt settings", "Explorer", "")
_initialize()
IF ProcessExists ( "TrueCrypt.exe") then
IF not $cmdline[0] = 0 then
IF $cmdline[1] = "-q" then
ShellExecuteWait("TrueCrypt.exe", "/q /d", $AppDir)
Sleep(250)
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
While ProcessExists("TrueCrypt.exe")
ProcessClose("TrueCrypt.exe")
WEnd
Exit
EndIF
Else
If MsgBox(4 + 48 + 4096, "DisMount", "Dismount security volume")=6 then
ShellExecuteWait("TrueCrypt.exe", "/q /d", $AppDir)
Sleep(250)
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
While ProcessExists("TrueCrypt.exe")
ProcessClose("TrueCrypt.exe")
WEnd
Exit
Else
endIF
Endif
EndIF
_adjust()
If $ImgExplorer <> 1 Then
$ImgExplorer = ""
Else
$ImgExplorer = " /e"
EndIf
If $Drivetype <> 1 Then
$Drivetype = ""
Else
$Drivetype = "rm "
EndIf
If DriveStatus($ImageLetter) = "INVALID" Then
; MsgBox (0,"","/q background /l" & $ImageLetter & " /m" & $drivetype & $ImgExplorer &" /v " & '"' & $SecuArea&'"')
; MsgBox (0,"","/q background /l" & $ImageLetter & $ImgExplorer & " /m rm /v " & $SecuArea)
ShellExecute("TrueCrypt.exe", "/q background /l" & $ImageLetter & $ImgExplorer & " /m "& $Drivetype &"/v " & '"' & $CurrentDriveLetter & $Imagepath &'"', $AppDir )
;ShellExecute("TrueCrypt.exe", "/q background /l" & $ImageLetter & " /m" & $drivetype & $ImgExplorer &" /v " & '"' & $SecuArea&'"', $AppDir )
Else
if MsgBox(4 + 48 + 4096, "Drive letter conflict", "Drive letter is already occufied. "& @CRLF & @CRLF &" Edit imageletter value in settings.ini. ")=6 Then
ShellExecute ("settings.ini", "", $DataDir )
Else
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configurationlxml", 1 )
Exit
endif
EndIf
_ProcessWaitClose ( $processname)
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
ShellExecute("TrueCrypt.exe", "/q /d", $AppDir)
Exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func _Initialize()
If Not FileExists($DataDir) Then DirCreate($DataDir)
If Not FileExists($SettingsDir) Then DirCreate($SettingsDir)
If Not FileExists($settingfile) Then MakeINI()
EndFunc ;==>_Initialize
Func _adjust()
Filemove ( $settingsDir &"\configuration.xml", $appDir &"\configuration.xml", 0 )
EndFunc
Func MakeINI()
$AForm1 = GUICreate("TrueCrypt Config", 440, 110, (@DesktopWidth - 370) / 2, (@DesktopHeight - 390) / 2)
$Label2 = GUICtrlCreateLabel("Image", 8, 13, 65, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Input2 = GUICtrlCreateInput("Select encrypted image file", 65, 11, 250, 24)
$Label3 = GUICtrlCreateLabel("DRIVE", 8, 46, 65, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Combo1 = GUICtrlCreateCombo("", 65, 45, 45, 25)
$Letter = IniRead($settingfile, "Truecrypt settings", "Imageletter", "")
$Checkbox1 = GUICtrlCreateCheckbox("Removable disk", 150, 42, 135, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
If IniRead($settingfile, "Truecrypt settings", "Removable", "") = 1 Then
GUICtrlSetState(-1, $GUI_CHECKED)
Else
GUICtrlSetState(-1, $GUI_UNCHECKED)
EndIf
$Checkbox2 = GUICtrlCreateCheckbox("Open Explorer", 295, 42, 135, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
If IniRead($settingfile, "Truecrypt settings", "Explorer", "") = 1 Then
GUICtrlSetState(-1, $GUI_CHECKED)
Else
GUICtrlSetState(-1, $GUI_UNCHECKED)
EndIf
$Button2 = GUICtrlCreateButton("Create", 375, 11, 50, 25, 0)
$Button1 = GUICtrlCreateButton("Select", 320, 11, 50, 25, 0)
$j = ""
For $i = 65 To 90
$j = $j & "|" & Chr($i)
If $i = 90 Then GUICtrlSetData($Combo1, $j, $Letter)
Next
$Button3 = GUICtrlCreateButton("OK", 150, 80, 120, 25, 0)
GUISetState(@SW_SHOW)
IniWrite($settingfile, "Truecrypt settings", "Explorer", 0 )
IniWrite($settingfile, "Truecrypt settings", "Removable", 0 )
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
If FileExists($settingfile) Then
If $imagepath <> "" and $imageLetter <> "" Then
ExitLoop
Else
MsgBox(48, "Notice!!!", "Configration is not completed." & @CRLF & @CRLF & "Terminate process.")
If FileExists($settingfile) Then FileDelete($settingfile)
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
Exit
EndIf
Else
MsgBox(48, "Notice!!!", "Configration is not completed." & @CRLF & @CRLF & "Terminate process.")
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
exit
EndIf
Case $nMsg = $Combo1
$ComboCheck = GUICtrlRead($Combo1)
If @error = 0 Then
IniWrite($settingfile, "Truecrypt settings", "Imageletter", $ComboCheck&":")
$ImageLetter = $ComboCheck&":"
EndIf
Case $nMsg = $Checkbox1
$CheckCheck = GUICtrlRead($Checkbox1)
If $CheckCheck = 1 Then
$Check1 = 1
Else
$Check1 = 0
EndIf
If @error = 0 Then
IniWrite($settingfile, "Truecrypt settings", "Removable", $Check1)
$Drivetype = $check1
EndIf
Case $nMsg = $Checkbox2
$CheckCheck2 = GUICtrlRead($Checkbox2)
If $CheckCheck2 = 1 Then
$Check2 = 1
Else
$Check2 = 0
EndIf
If @error = 0 Then
IniWrite($settingfile, "Truecrypt settings", "Explorer", $Check2)
$Drivetype = $Check2
EndIf
Case $nMsg = $Button1
$file = FileOpenDialog("Select encrypted image file.", @ScriptDir, "All(*.*)", 1)
$Image = StringSplit($file,"\")
If @error = 0 Then
IniWrite($settingfile, "Truecrypt settings", "Imagepath", stringtrimleft($file,2))
GUICtrlSetData($Input2, $file)
$Imagepath = stringtrimleft($file,2)
EndIf
Case $nMsg = $Button2
ShellExecute ( "TrueCrypt Format.exe", "", $Appdir)
Case $nMsg = $Button3
If FileExists($settingfile) Then
If IniRead($settingfile, "Truecrypt settings", "Imagepath", "") <> "" And IniRead($settingfile, "Truecrypt settings", "Imageletter", "") <> "" Then
ExitLoop
Else
MsgBox(48, "Notice!!!", "Configration is not completed." & @CRLF & @CRLF & "Terminate process.")
If FileExists($settingfile) Then FileDelete($settingfile)
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
Exit
EndIf
Else
MsgBox(48, "Notice!!!", "Configration is not completed." & @CRLF & @CRLF & "Terminate process.")
Filemove ( $appDir &"\configuration.xml", $settingsDir &"\configuration.xml", 1 )
Exit
EndIf
EndSelect
WEnd
GUIDelete()
EndFunc
Func _processwaitclose ( $process )
while ProcessExists ( $process )
sleep (300)
WEnd
EndFunc