posted by 범벙이 2012. 9. 5. 10:49
#NoTrayIcon
#RequireAdmin

Switch @OSArch
    Case "X86"
        $sOS_Arch = "wrar411kr.exe"
    Case "X64"
        $sOS_Arch = "winrar-x64-411kr.exe"
EndSwitch

Global $url_rar = "http://www.rarlab.com/rar/" & $sOS_Arch
Global $file_path = @TempDir & "\" & $sOS_Arch
Global $info_setup = "한글 WinRAR archiver 4.11 (" & @OSArch & ")"
Global $program_dir = "C:\Program Files\WinRAR"

If FileExists($program_dir & "\WinRAR.exe") Then
    Local $fileversion1 = FileGetVersion($program_dir & "\WinRAR.exe")
    Local $fileversion2 = "4.11.0.0"
    If $fileversion1 <> $fileversion2 Then
        RunWait($program_dir & "\Uninstall.exe /s")
        _Execute()
    Else
        MsgBox(0, "WinRAR", "최신 버전을 사용중입니다.")
        Exit
    EndIf
Else
    _Execute()
EndIf

Func _Execute()
    DownSplash($url_rar, $file_path, $info_setup)
    RunWait($file_path & " /s")
    make_rarkey()
    MsgBox(0 + 64 + 4096, "한글 WinRAR v4.11 Setup", $info_setup & " 설치가 완료되었습니다.", 2)
    Run($program_dir & "\WinRAR.exe")
    FileDelete($file_path)
EndFunc

Func DownSplash($sFileURL, $sFileSave, $sFileInfo)
    $iTotalSize = InetGetSize($sFileURL)
    ProgressOn($sFileInfo & " 다운로드", "다운로드 진행 상황", "0% 다운로드 중...")
    $sDownload = InetGet($sFileURL, $sFileSave, 1, 1)
    Do
        Sleep(200)
        $iGetDownSize = InetGetInfo($sDownload, 0)
        $iPercent = Ceiling(($iGetDownSize / $iTotalSize) * 100)
        ProgressSet($iPercent, $iPercent & "% 다운로드 중...")
    Until InetGetInfo($sDownload, 2)
    ProgressSet(100, "다운로드를 완료하였습니다.", "완료")
    InetClose($sDownload)
    Sleep(200)
    ProgressOff()
EndFunc

Func make_rarkey()
    Local $key
    If FileExists($program_dir & "\rarreg.key") Then FileDelete($program_dir & "\rarreg.key")
    $key = "RAR registration data" & @CRLF
    $key &= "Administrator" & @CRLF
    $key &= "Enhanced Corporate" & @CRLF
    $key &= "UID=ffd17c293f42b94c3b28" & @CRLF
    $key &= "64122122503b281646f59a96b629958adcc52afe077f0682246ae5" & @CRLF
    $key &= "54958b9c467ab240e5a9608a7f3372a80923a74c55e23fa85f410f" & @CRLF
    $key &= "986b55ba1f344cb54742558c4674bec2f3f44597a594b865433801" & @CRLF
    $key &= "d13141516c4c47c869c2b76309785d3d05606909687ce7e79c91d7" & @CRLF
    $key &= "050a8254ed73508f5ca65007653492ae03ae96f7b77dafdce6140c" & @CRLF
    $key &= "bfebaaa0c3514f197a99b9c3590b2d0d110aa2ba37d8a72160ada7" & @CRLF
    $key &= "54fd3db8746dc7706cb36e57a5777074d497fa6d53592378887116" & @CRLF
    Local $regist = FileOpen($program_dir & "\rarreg.key", 2)
    FileWrite($regist, $key)
    FileClose($regist)
EndFunc


펌 // http://blog.naver.com/seongwk?Redirect=Log&logNo=70122793090