|
普通 Windows 2000/XP/2003 包括 WinPE(仅限 老九 WinPE 老毛桃修改之撒手不管版 Build 070911)。
如果部分用户反映在某 PC 上初次安装会出现病毒库丢失的出错提示的话,请将代码中加上以下红色的那一行。原来我放在 FTP2 中的卡巴 6、7 中 AvpGreen.exe 并没有这一句,导致部分 WMI 服务属于首次部署运行的机器上安装后会出现“病毒库丢失”的提示!同样的,Setup.exe 中也需要做同样的修改。(Key 被封了,也懒得再重新发一个未封的版本,再发还会被封;P ;P )
事实上因为 WinPE 没有了 WMI 服务,我是根据文件字节数来判断卡巴版本的,反而不会出现这样的问题。
相关帖:http://bbs.wuyou.net/forum.php?mod=viewthread&tid=113271@Echo Off
PUSHD %Cd%
Set AVP=avp.exe
If Not Exist %AVP% Exit
Set WMIC=%WinDir%\system32\wbem\wmic.exe
If Not Exist %WMIC% Goto NoWMI
Set TP=%Cd%
Set TP=%TP:\=\\%
Set CHK=%TEMP%\CHK_%Random%.TMP
wmic quit
>%CHK% wmic datafile where name="%TP%\\%AVP%" get Version
If Not "%Errorlevel%"=="0" Goto NoWMI
For /F "delims=. tokens=1" %%i In ('TYPE "%CHK%"^|FIND "."') DO SET AVPVer=%%i
Del %CHK% /F /Q>NUL 2>NUL
Goto Next
:NoWMI
Set AVPVer=6
For %%i In (%AVP%) Do If %%~zi GTR 180000 Set AVPVer=7
Goto Next
:Next
regedit /s Set.reg
regsvr32 /s shellex.dll
Set AVP6=HKLM\SOFTWARE\KasperskyLab\AVP6&&Set AVP7=HKLM\SOFTWARE\KasperskyLab\protected\AVP7
REG ADD %AVP7%\environment /v DataRoot /t REG_SZ /d "%CD%" /f>NUL
REG ADD %AVP7%\environment /v ProductRoot /t REG_SZ /d "%CD%" /f>NUL
REG ADD %AVP7%\settings /v LoginImage /t REG_SZ /d "%CD%\Skin\images\lgnkav.png" /f>NUL
REG ADD %AVP7%\settings /v Ins_ProductPath /t REG_SZ /d "%CD%\\" /f>NUL
REG ADD HKLM\SOFTWARE\KasperskyLab\SetupFolders /v KAV7 /t REG_SZ /d "%CD%\\" /f>NUL
REG ADD %AVP6%\environment /v DataRoot /t REG_SZ /d "%CD%" /f>NUL
REG ADD %AVP6%\settings /v LoginImage /t REG_SZ /d "%CD%\Skin\images\kav_en.gif" /f>NUL
If Exist B: If Exist %Windir%\System32\PECMD.EXE Goto Set_KAVBase
:RunAVP
PECMD ENVI $TARGET_ROOT
start /wait avp.exe
regedit /s delavp.reg >nul 2>nul
If "%NoPJ%"=="Yes" Del "%BP%\Bases\peace.lst" /F /Q >NUL
Set Sys32=%WinDir%\System32
REG ADD HKCR\CLSID\{989D1DC0-B162-11D1-B6EC-D27DDCF9A923}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\msxml3.dll" /f>NUL
REG ADD HKCR\CLSID\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\InprocServer32 /ve /t REG_SZ /d "%Sys32%\vbscript.dll" /f>NUL
REG ADD HKCR\CLSID\{B54F3742-5B07-11cf-A4B0-00AA004A55E8}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\vbscript.dll" /f>NUL
REG ADD HKCR\CLSID\{B54F3743-5B07-11cf-A4B0-00AA004A55E8}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\vbscript.dll" /f>NUL
REG ADD HKCR\CLSID\{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\jscript.dll" /f>NUL
REG ADD HKCR\CLSID\{f414c261-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\jscript.dll" /f>NUL
REG ADD HKCR\CLSID\{f414c262-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /ve /t REG_SZ /d "%Sys32%\jscript.dll" /f>NUL
REG DELETE HKCR\CLSID\{989D1DC0-B162-11D1-B6EC-D27DDCF9A923}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{B54F3742-5B07-11cf-A4B0-00AA004A55E8}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{B54F3743-5B07-11cf-A4B0-00AA004A55E8}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{f414c260-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{f414c261-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
REG DELETE HKCR\CLSID\{f414c262-6ac0-11cf-b6d1-00aa00bbbb58}\InProcServer32 /v OriginalDll /f>NUL 2>NUL
Exit
:Set_KAVBase
Set CHKBP=%TEMP%\CHK_%Random%.TMP
PECMD BROW $您可以选用硬盘上安装的卡巴斯基 6.0 版本病毒库,以便 WinPE 的卡巴使用最新病毒库。请选路径例如:C:\Program Files\AVP6,点取消则使用默认病毒库。
For /F "skip=2 tokens=2*" %%i In ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v TARGET_ROOT') DO SET BP=%%j
Set BPC=%BP:\=\\%
If Not Exist "%BP%\Bases\avp_x.set" (
PECMD MESS 未设置或没有找到您选择的病毒库路径!\n \n将使用默认的 WinPE 自带病毒库。@使用默认病毒库#OK
Goto RunAVP
)
If Not Exist %WMIC% Goto NoWMIC
>%CHKBP% wmic datafile where name="%BPC%\\%AVP%" get Version
If Not "%Errorlevel%"=="0" Goto NoWMIC
For /F "delims=. tokens=1" %%i In ('TYPE "%CHKBP%"^|FIND "."') DO SET BPVer=%%i
Del %CHKBP% /F /Q>NUL 2>NUL
Goto CompVer
:NoWMIC
Set BPVer=6
For %%i In ("%BP%\%AVP%") Do If %%~zi GTR 180000 Set BPVer=7
:CompVer
If "%BPVer%"=="%AVPVer%" (
PECMD REGI HKLM\SOFTWARE\KasperskyLab\AVP6\environment\Bases=%BP%\Bases
PECMD REGI HKLM\SOFTWARE\KasperskyLab\protected\AVP7\environment\Bases=%BP%\Bases
PECMD MESS 成功寻找到您选择的病毒库!\n \n@使用外挂病毒库#OK
If Exist "%CD%\Bases\peace.lst" If Not Exist "%BP%\Bases\peace.lst" Set NoPJ=Yes&&Copy .\Bases\peace.lst "%BP%\Bases" /Y >NUL
) Else (
PECMD MESS 您选择的卡巴斯基病毒库跟当前版本不一致!\n \n将使用默认的 WinPE 自带病毒库。@使用默认病毒库#OK
)
Goto RunAVP |
|