@Echo Off&Title 迅雷9
cd /d %~dp0
mode con cols=42 lines=22
color 2F
>nul 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>nul
    Exit /b
)
:Menu
Cls
Echo.
Echo.&Echo     绿化 → 1
Echo.&Echo     卸载 → 2
Echo.&Echo     启用防踢补丁 → 3
Echo.&Echo     关闭防踢补丁 → 4
Echo.
:Menu
Set /p a=输入数字按回车：
If "%a%"=="1" Goto In
If "%a%"=="2" Goto Un
If "%a%"=="3" Goto Anti-kick
If "%a%"=="4" Goto Original
Echo.&Echo 输入无效，请重新输入！
pause >nul
Goto Menu
:In
taskkill /f /im Thunder.exe >nul 2>nul
Regsvr32 /s Program\np_tdieplat.dll 
Regsvr32 /s BHO\XunLeiBHO.dll
Regsvr32 /s BHO\ThunderAgent.dll
Regsvr32 /s BHO\UserAgent2.0.2.22.dll
if exist "%WinDir%\SysWOW64" Regsvr32 /s BHO\ThunderAgent64.dll
if exist "%WinDir%\SysWOW64" Regsvr32 /s BHO\XunLeiBHO64.dll
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载" /ve /d "%~dp0BHO\geturl.htm" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载" /v "Contexts" /t REG_DWORD /d "0x00000022" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载全部链接" /ve /d "%~dp0BHO\getAllurl.htm" /f >nul
Reg Add "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载全部链接" /v "Contexts" /t REG_DWORD /d "0x000000f3" /f >nul
Reg Add "HKCU\Software\MozillaPlugins\@xunlei.com/npxluser" /v "Path" /d "%~dp0BHO\npxluser2.0.2.3.dll" /f >nul
Reg Add "HKCU\Software\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /v "Path" /d "%~dp0Data\npxunlei1.0.0.2.dll" /f >nul
Reg Add "HKCR\Xunlei.Bittorrent.6\DefaultIcon" /ve /d "%~dp0Program\TorrentFile.ico" /f >nul
Reg Add "HKCR\Xunlei.Bittorrent.6\Shell\Open" /ve /d "使用迅雷下载这BT文件" /f >nul
Reg Add "HKCR\Xunlei.Bittorrent.6\Shell\Open\command" /ve /d "%~dp0Program\Thunder.exe %%1" /f >nul
Reg Add "HKCR\Xunlei.LSTFile.6\DefaultIcon" /ve /d "%~dp0Program\XLDownloadList.ico" /f >nul
Reg Add "HKCR\Xunlei.LSTFile.6\Shell\Open" /ve /d "使用迅雷下载这任务列表文件" /f >nul
Reg Add "HKCR\Xunlei.LSTFile.6\Shell\Open\command" /ve /d "%~dp0Program\Thunder.exe %%1" /f >nul
Reg Add "HKCR\Xunlei.TDFile.6\DefaultIcon" /ve /d "%~dp0Program\XLTempFile.ico" /f >nul
Reg Add "HKCR\Xunlei.TDFile.6\Shell\Open" /ve /d "使用迅雷下载未完成文件" /f >nul
Reg Add "HKCR\Xunlei.TDFile.6\Shell\Open\command" /ve /d "%~dp0Program\Thunder.exe %%1" /f >nul
Reg Add "HKLM\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.xunlei.thunder" /ve /d "%~dp0BHO\Chrome\com.xunlei.thunder.json" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" /v "dir" /d "%~dp0\" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" /v "Path" /d "%~dp0Program\Thunder.exe" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" /v "instdir" /d "%~dp0\" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" /v "Version" /d "9.1.25.640" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "dir" /d "%~dp0\" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "Path" /d "%~dp0Program\Thunder.exe" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "instdir" /d "%~dp0\" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\Thunder Network\ThunderOem\thunder_backwnd" /v "Version" /d "9.1.25.640" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxluser" /v "Path" /d "%~dp0BHO\npxluser2.0.2.3.dll" /f >nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" Reg Add "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /v "path" /d "%~dp0Data\npxunlei1.0.0.2.dll" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxluser" /v "Path" /d "%~dp0BHO\npxluser2.0.2.3.dll" /f >nul
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" Reg Add "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /v "Path" /d "%~dp0Data\npxunlei1.0.0.2.dll" /f >nul
Program\Thunder.exe -install -associate:all >nul 2>nul
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\迅雷9.lnk""):b.TargetPath=""%~dp0Program\Thunder.exe"":b.WorkingDirectory=""%~dp0Program\"":b.Save:close")
Goto fanhui
:Anti-kick
taskkill /f /im Thunder.exe >nul 2>nul
xcopy /i/y "Thunder\Patch\Anti-kick\zlib1.dll" "Program\" >nul 2>nul
Goto fanhui
:Original
taskkill /f /im Thunder.exe >nul 2>nul
xcopy /i/y "Thunder\Patch\Original\zlib1.dll" "Program\" >nul 2>nul
Goto fanhui
:Un
taskkill /f /im Thunder.exe >nul 2>nul
Regsvr32 /s /u Program\np_tdieplat.dll
Regsvr32 /s /u BHO\XunLeiBHO.dll
Regsvr32 /s /u BHO\ThunderAgent.dll
Regsvr32 /s /u BHO\UserAgent2.0.2.22.dll
if exist "%WinDir%\SysWOW64" Regsvr32 /s /u BHO\ThunderAgent64.dll
if exist "%WinDir%\SysWOW64" Regsvr32 /s /u BHO\XunLeiBHO64.dll
Program\Thunder.exe -unassociate:td -unassociate:torrent -unassociate:downlist -unassociate:thunderskin -unassociate:thunderaddin -unassociate:all -unregprotocol:ed2k -unregprotocol:magnet -unregprotocol:thunder -unregprotocol:xlapplink
Reg Delete "HKCR\Xunlei.Bittorrent.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.LSTFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.TDFile.6" /f >nul 2>nul
Reg Delete "HKCR\Xunlei.ThunderSkin.6" /f >nul 2>nul
Reg Delete "HKCR\Software\Thunder" /f >nul 2>nul
Reg Delete "HKCU\Software\Thunder Network" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载" /f >nul 2>nul
Reg Delete "HKCU\Software\Microsoft\Internet Explorer\MenuExt\&使用&迅雷下载全部链接" /f >nul 2>nul
Reg Delete "HKCU\Software\MozillaPlugins\@xunlei.com/npxluser" /f >nul 2>nul
Reg Delete "HKCU\Software\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\Wow6432Node\Thunder Network" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\Google\Chrome\NativeMessagingHosts" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxluser" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxluser" /f >nul 2>nul
Reg Delete "HKLM\SOFTWARE\Wow6432Node\MozillaPlugins\@xunlei.com/npxunlei;version=1.0.0.2" /f >nul 2>nul
Rd /s /q "%TMP%\XLLiveUD" >nul 2>nul
Rd /s /q "%TMP%\Thunder" >nul 2>nul
Rd /s /q "%TMP%\Thunder Network" >nul 2>nul
Rd /s /q "%TMP%\Xunlei" >nul 2>nul
Rd /s /q "%ProgramData%\Thunder Network" >nul 2>nul
Rd /s /q "%CommonProgramFiles%\Thunder Network" >nul 2>nul
Rd /s /q "%CommonProgramFiles(x86)%\Thunder Network" >nul 2>nul
Rd /s /q "%Public%\Thunder Network" >nul 2>nul
Rd /s /q "%AppData%\Thunder Network" >nul 2>nul
Rd /s /q "%AppData%\XLGameBox" >nul 2>nul
Rd /s /q "%UserProfile%\AppData\LocalLow\Thunder Network" >nul 2>nul
Rd /s /q "%UserProfile%\AppData\LocalLow\Pusher" >nul 2>nul
Rd /s /q "Data\AdPlatform" >nul 2>nul
Rd /s /q "Data\AdTaskList" >nul 2>nul
Rd /s /q "Data\ThunderPush" >nul 2>nul
Rd /s /q "Data\WindowedTips" >nul 2>nul
Rd /s /q "Data\ZipPasswordSharing" >nul 2>nul
Rd /s /q "Data\tasksign" >nul 2>nul
Rd /s /q "Data\XLLogInPrompt" >nul 2>nul
Rd /s /q "Program\miniXLGameCenter" >nul 2>nul
Rd /s /q "Program\XLGameCenter" >nul 2>nul
Rd /s /q "Program\pref_stat" >nul 2>nul
del /f /q "Program\debug.log" >nul 2>nul
del /f /q "Program\LiveUpdate_storage4.xml" >nul 2>nul
del /f /q "Program\XLGameCenterAddin.dll" >nul 2>nul
del /f /q "Program\XLGameLauncher.exe" >nul 2>nul
del /f /q "Thunder\Xar\ThunderApp\XLGameCenter.xar" >nul 2>nul
del /f /q "Data\latest_stat.xml" >nul 2>nul
del /f /q "Data\stat.dat" >nul 2>nul
del /f /q "Data\thunder_stat.xml" >nul 2>nul
del /q "%userprofile%\Desktop\迅雷9.lnk" >nul 2>nul
del /q "%userprofile%\桌面\迅雷9.lnk" >nul 2>nul
Goto fanhui
:fanhui
Echo.&Echo                完成...
ping -n 2 10>nul
goto menu


