;此源码是本人用AutoIt(一种批处理制作工具,语言类似于VB)编辑制作(可转为VB),欢迎交流改进,并及时发布!
;经试验在kis6/kav6 300-671升级基本都能成功(未完全测试:)主要是很少安装kav)
; 请置于脚本顶部
dim $kb_name,$kb_ver,$kb_cname ;声明
$g_szVersion = "卡巴KIS/KAV离线升级包制作1.03 曾大虾"
If WinExists($g_szVersion) Then
MsgBox(16,"提示","重复的程序运行!")
Exit ; 此脚本已经运行了
endif
AutoItWinSetTitle($g_szVersion)
$kb_name=RegRead("HKLM\SOFTWARE\KasperskyLab\AVP6\environment", "ProductType") ;读取注册表
if @error=1 or @error=-1 or @error=-2 Then
MsgBox(4096, "失败", "没有发现安装的卡巴!")
Exit
endif
$kb_ver=RegRead("HKLM\SOFTWARE\KasperskyLab\AVP6\environment", "ProductVersion") ;读取注册表
$kb_cname=RegRead("HKLM\SOFTWARE\KasperskyLab\AVP6\environment", "ProductName") ;读取注册表
;界面部分
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($g_szVersion, 400, 300, 303, 219)
$LAB=GUICtrlCreateLabel("你安装的卡巴是:" & $kb_cname & @LF & "版本" & $kb_name & $kb_ver & " OS:" & @OSVersion,8,20,380,30,$SS_CENTER)
GUICtrlSetFont(-1, 11, 800, 0, "宋体")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
$ABt = GUICtrlCreateButton("生成离线升级备份", 90, 60, 200, 33, 0)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
GUISetState(@SW_SHOW)
$Edit1 = GUICtrlCreateEdit("", 40, 120, 300, 160,BitOR($ES_CENTER,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "状态监视器")
GUICtrlSetFont(-1, 11, 400, 0, "宋体")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Func TestFunc($as)
if $as=1 then
$as=StringFormat("\r\n成功")
else
$as=StringFormat("\r\n失败")
endif
Return $as
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ABt
GUICtrlSetCursor($ABt,15)
$LAB1=GUICtrlCreateLabel("请等待!…………",100,100,150,20,$SS_CENTER)
GUICtrlSetFont(-1, 11, 800, 0, "宋体")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
GUICtrlSetData($Edit1,"")
GUICtrlSetData($Edit1,"状态监视器" & @CRLF & $kb_name & $kb_ver & " OS:" & @OSVersion)
ControlDisable($g_szVersion, "生成离线升级备份", $ABt)
dim $kb_ml,$XX=0,$new_ml,$kb_dat,$xh=0 ;$kb_ml卡巴安装目录
$new_ml=".\" & $kb_name & $kb_ver & "离线升级备份包" & @YEAR & @MON & @MDAY ;在程序当前目录下创建备份目录
$kb_ml=RegRead("HKLM\SOFTWARE\KasperskyLab\AVP6\environment", "ProductRoot") ;读取注册表
if StringRight($kb_ml,1)<>"\" then $kb_ml=$kb_ml & "\"
$kb_dat=RegRead("HKLM\SOFTWARE\KasperskyLab\AVP6\environment", "DataRoot") ;读取注册表
if StringRight($kb_dat,1)<>"\" then $kb_dat=$kb_dat & "\"
DirCreate($new_ml) ;在程序当前目录下创建备份目录
;需要拷贝的文件
$kb_fstr="Bases\*.*|" & _
"Data\*.*|" & _
"Dskm\*.*|" & _
"\system32\drivers\klif.sys|" & _
"bl.ppl|" & _
"pop3protocoller.ppl|" & _
"imapprotocoller.ppl|" & _
"updater2005.ppl|" & _
"avpgui.ppl|" & _
"mdb.ppl|" & _
"crpthlpr.ppl|" & _
"fssync.dll|" & _
"httpanlz.ppl|" & _
"ichk2.ppl|" & _
"lic60.ppl|" & _
"oas.ppl|" & _
"prloader.dll|" & _
"trainsupport.ppl|" & _
"execinstaller.ppl|" & _
"baseinstaller.ppl"
$kb_file=StringSplit($kb_fstr,"|") ;字符串转数组
for $xh=1 to 3 ;所有6版本都要拷贝的文件
$XX=FileCopy($kb_dat & $kb_file[$xh], $new_ml,1)
GUICtrlSetData($Edit1,TestFunc($XX ) & "A" & $xh,"状态监视器")
next
$XX=FileCopy(@WindowsDir & $kb_file[4], $new_ml,1)
GUICtrlSetData($Edit1,TestFunc($XX ) & "A4","状态监视器")
;根据版本不同拷贝文件
if $kb_ver="6.0.2.546" then
$ed=18
Else
$ed=20
endif
for $xh=5 to $ed
$XX=FileCopy ($kb_ml & $kb_file[$xh],$new_ml,1)
GUICtrlSetData($Edit1,TestFunc($XX ) & "A" & $xh,"状态监视器")
next
if $kb_ver="6.0.0.300" then
$XX=FileCopy ($kb_ml & "avp.RPT",$new_ml,1)
GUICtrlSetData($Edit1,TestFunc($XX ) & "B1","状态监视器")
endif
MsgBox(64,"提示21","离线升级备份制作完成!" & @LF & "请在本程序目录下查看“" & $kb_name & $kb_ver & "离线升级备份包" & "”目录")
ControlEnable($g_szVersion, "生成离线升级备份", $ABt)
GUICtrlSetData ($LAB1, "" )
GUICtrlSetCursor ($ABt,2)
EndSwitch
WEnd
关于Autoit技术及下载:
1、Autoit 技术交流论坛
2、一大步
[ 本帖最后由 曾大虾 于 2007-7-13 13:21 编辑 ] |