@ECHO OFF&PUSHD %~DP0 &TITLE 绿化和选项
mode con cols=36 lines=20
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.
@ echo.     绿化[必须] → 请输入1
@ echo.
@ echo.     创建桌面图标 → 请输入2
@ echo.
@ echo.     卸载 → 请输入3
@ echo.
set /p xj= 输入数字按回车：
if /i "%xj%"=="1" Goto Install
if /i "%xj%"=="2" Goto Establish
if /i "%xj%"=="3" Goto Uninstall
@ echo.
echo      选择无效，请重新输入
ping -n 2 127.1>nul 
goto menu
:Install
@ echo.
ECHO 　　　正在安装中..请稍等..
taskkill /f /im ADSafe* >NUL 2>NUL
rd /s /q "%AppData%\ADSafe3"   2>NUL
if exist "%Windir%\SysWOW64" del "C:\Windows\System32\drivers\DMProtectEx64.sys"2>NUL
if not exist "%Windir%\SysWOW64" del "C:\Windows\System32\drivers\DMProtectEx.sys"2>NUL
start /wait /B "" "%cd%\ADSafeSvc.exe" -stop
start /wait /B "" "%cd%\ADSafeSvc.exe" -install
start /wait /B "" "%cd%\ADSafeSvc.exe" -manualstart
sc config ADSafeSvc start= AUTO >NUL 2>NUL
reg add HKCU\Software\ADSafe4 /v AutoStart /t REG_DWORD  /d "1" /F>NUL
if not exist "%AppData%\ADSafe3" md "%AppData%\ADSafe3"2>NUL
xcopy /e/i/y res\ADSafe3 "%AppData%\ADSafe3">NUL 2>NUL
goto Install2
:Establish
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\净网大师.lnk""):b.TargetPath=""%~dp0ADSafe.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
goto fanhui
:Uninstall
@ echo.
echo 　　　正在卸载中..请稍等..
taskkill /f /im ADSafe* >NUL 2>NUL
rd /s /q "%AppData%\ADSafe3"   2>NUL
sc config ADSafeSvc start= demand >NUL
start /wait /B "" "%cd%\ADSafeSvc.exe" -stop
start /wait /B "" "%cd%\ADSafeSvc.exe" -uninstall
start /wait /B "" "%cd%\ADSafeSvc.exe" -manualstart
sc delete ADSafeSvc >NUL 2>NUL
if exist "%Windir%\SysWOW64" del "C:\Windows\System32\drivers\DMProtectEx64.sys"2>NUL
if not exist "%Windir%\SysWOW64" del "C:\Windows\System32\drivers\DMProtectEx.sys"2>NUL
reg delete HKCU\Software\ADSafe /f>NUL 2>NUL
reg delete HKCU\Software\ADSafe4 /f>NUL 2>NUL
reg delete HKLM\SYSTEM\CurrentControlSet\services\ADSafeSvc /f>NUL 2>NUL
del /f /q "%userprofile%"\Desktop\净网大师.lnk /f>NUL 2>NUL
del /f /q "%userprofile%"\桌面\净网大师.lnk /f>NUL 2>NUL
goto Uninstall2
:fanhui
@ ECHO.
ECHO 　　　设置完成..
ping -n 2 127.8>nul
goto menu
:Install2
@ ECHO.
ECHO 　　　安装完成..
ping -n 2 127.8>nul
goto menu
:Uninstall2
@ ECHO.
ECHO 　　　卸载完成..
ping -n 2 127.8>nul
goto menu
