Skip to content

Commit

Permalink
改进修复VAC验证问题,传参调用批处理脚本,这次应该好使了
Browse files Browse the repository at this point in the history
  • Loading branch information
Purple-CSGO committed Feb 4, 2020
1 parent c99d4b8 commit 71c960f
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CSGO-Toolbox.pro
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ QMAKE_CXXFLAGS+=/execution-charset:utf-8

RC_CODEPAGE = 65001

VERSION = 1.0.2b
VERSION = 1.0.2c

DEFINES += APP_VERSION=\\\"$$VERSION\\\"

Expand Down
4 changes: 2 additions & 2 deletions CSGO-Toolbox.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2020-02-04T17:07:13. -->
<!-- Written by QtCreator 4.11.0, 2020-02-04T20:10:19. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -327,7 +327,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.0 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5140.win64_msvc2017_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
Expand Down
135 changes: 135 additions & 0 deletions dll/SolveVAC.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
::========================= 说明 ==========================
:: 制作:Purp1e bilibili@Purple-CSGO
:: 参考:@狙击手Ricky 和 @B5官方 提供的批处理脚本
:: 使用:调用控制台指令 "..../SolveVAC.bat" "路径"
:: 注意:1. 系统盘必须为C盘 2. 路径带/不含xxx.exe
:: 3.兼容国服 4. 可处理带空格路径
::===================== 获取管理员权限 ======================
@echo off
CLS
SETLOCAL ENABLEDELAYEDEXPANSION
title VAC验证修复 - Purp1e

:init
setlocal DisableDelayedExpansion
set cmdInvoke=1
set winSysFolder=System32
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)

ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"

if '%cmdInvoke%'=='1' goto InvokeCmd

ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
goto ExecElevation

:InvokeCmd
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"

:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /B

:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)

::=================== 读取传过来的路径参数 ====================
mode con cols=80 lines=30
taskkill /F /IM csgo.exe
taskkill /F /IM Steam.exe
taskkill /F /IM csgolauncher.exe
CLS

set path=%1 %2 %3 %4 %5 %6 %7 %8 %9

:delright
if "%path:~-1%"==" " set path=%path:~0,-1%&&goto delright
echo 获得路径:%path%

if "%path%" == "" (
title 错误
echo 路径为空!
goto end
)
::else (goto debug)


::======================= 解决VAC屏蔽 ========================
:start
echo 开始解决VAC屏蔽

echo 开启 Network Connections
c:\windows\system32\ac config Netman start= AUTO
c:\windows\system32\sc start Netman

echo 开启 Remote Access Connection Manager
c:\windows\system32\sc config RasMan start= AUTO
c:\windows\system32\sc start RasMan

echo 开启 Telephony
c:\windows\system32\sc config TapiSrv start= AUTO
c:\windows\system32\sc start TapiSrv

echo 开启 Windows Firewall
c:\windows\system32\sc config MpsSvc start= AUTO
c:\windows\system32\sc start MpsSvc
c:\windows\system32\netsh advfirewall set allprofiles state on

echo 恢复 Data Execution Prevention 启动设置为默认值
c:\windows\system32\bcdedit /deletevalue nointegritychecks
c:\windows\system32\bcdedit /deletevalue loadoptions
c:\windows\system32\bcdedit /debug off
c:\windows\system32\bcdedit /deletevalue nx

:: ==================== 重装Steam Services ====================
CLS
echo ═══════════════════════════════════════════════════════
echo ^>^>^>^>^>^>^>^>^>^> 开始重装Steam Services ^<^<^<^<^<^<^<^<^<^<
echo ═══════════════════════════════════════════════════════

cd /d "%path%/bin"
steamservice /uninstall
c:\windows\system32\ping -n 3 127.0.0.1>nul
steamservice /install
echo .

echo ═══════════════════════════════════════════════════════
echo ^>^>^>^>^>^>^>^>^>^> 重装Steam Services完毕 ^<^<^<^<^<^<^<^<^<^<
echo ═══════════════════════════════════════════════════════
echo # 出现"Steam client service install completed.."
echo # 且无任何"Fail"字样才可以结束
echo # 否则请检查您的防火墙设置(关闭“不允许例外”选项)

start steam -cafeapplaunch -forceservice

echo ═══════════════════════════════════════════════════════
echo ^>^>^>^>^>^>^>^>^>^> 启动Steam Services服务 ^<^<^<^<^<^<^<^<^<^<
echo ═══════════════════════════════════════════════════════
c:\windows\system32\sc config "Steam Client Service" start= AUTO
c:\windows\system32\sc start "Steam Client Service"

:debug
title VAC验证修复 - Purp1e
echo ═══════════════════════════════════════════════════════
echo ^>^>^>^>^>^>^>^>^>^> 完毕!按任意键结束窗口! ^<^<^<^<^<^<^<^<^<^<
echo ═══════════════════════════════════════════════════════

:end
pause>nul
exit
81 changes: 22 additions & 59 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ MainWindow::MainWindow(QWidget *parent)
getCsgoPath();
getSteamID();
refreshBackup();
//ui->debug->setPlainText(QCoreApplication::applicationDirPath() + "/SolveVAC.bat");
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -396,7 +397,7 @@ void MainWindow::on_manualBtn_clicked()
void MainWindow::on_manualCsgoBtn_clicked()
{
QString tPath = "";
tPath = QFileDialog::getOpenFileName(this, "选择csgo.exe的位置", tPath, "csgo.exe");
tPath = QFileDialog::getOpenFileName(this, "选择csgo.exe的位置", tPath, "csgo.exe");
if( !isCsgoExisted(tPath) ){
return;
}
Expand Down Expand Up @@ -694,68 +695,30 @@ void MainWindow::on_dragArea_textChanged()
//修复VAC验证问题 TODO:
void MainWindow::solveVacIssue()
{

//思路:
// 1. 关闭steam或者国服启动器
// 2. 开启 Network Connections
// 开启 Remote Access Connection Manager
// 开启 Telephony
// 开启 Windows Firewall
// 3. 恢复 Data Execution Prevention 启动设置为默认值
// 4. 获取steam或国服启动器目录(Done)
// 5. 重装Steam Services
// steamservice /uninstall
// steamservice /install
// # 等待出现"Add firewall exception failed for steamservice.exe"
// 6. 启动Steam Services服务
// start "Steam Client Service"
// 7. 其他诸如设置快捷方式 打开网吧模式
// ? start /high steam -console -cafeapplaunch -forceservice

//1.
cmd("taskkill /f /t /im csgo.exe");
cmd("taskkill /f /t /im steam.exe");
cmd("taskkill /f /t /im csgolauncher.exe");
do{
stall(100);
}while( getProcessPath("csgo.exe").endsWith("exe") || getProcessPath("steam.exe").endsWith("exe") ||getProcessPath("csgolauncher.exe").endsWith("exe") );
//2.
cmd("sc config Netman start= AUTO");
cmd("sc start Netman");
cmd("sc config RasMan start= AUTO");
cmd("sc start RasMan");
cmd("sc config TapiSrv start= AUTO");
cmd("sc start TapiSrv");
cmd("sc config MpsSvc start= AUTO");
cmd("sc start MpsSvc");
cmd("netsh advfirewall set allprofiles state on");
//3.
cmd("bcdedit /deletevalue nointegritychecks");
cmd("bcdedit /deletevalue loadoptions");
cmd("bcdedit /debug off");
cmd("bcdedit /deletevalue nx");
//4.
//检查路径是否正确
QString tPath;
if( isSteamExisted() )
if( isSteamExisted() ){
tPath = steamPath;
else if( isLauncherExisted() )
tPath.replace("steam.exe", "", Qt::CaseInsensitive);
}
else if( isLauncherExisted() ){
tPath = launcherPath;
else
tPath.replace("csgolauncher.exe", "", Qt::CaseInsensitive);
}
else{
QMessageBox::warning(this, "提示", "未获得Steam或国服路径!");
return;
}
//检查用到的批处理脚本
if( !QFile::exists( QCoreApplication::applicationDirPath() + "/SolveVAC.bat" ) ){
QMessageBox::warning(this, "提示", "SolveVAC.bat文件丢失!");
return;
}

tPath.replace("steam.exe", "bin/", Qt::CaseInsensitive);
//5.
cmd_dir("steamservice /uninstall", tPath);
stall(100);
cmd("ping -n 3 127.0.0.1>nul");
stall(100);
cmd_dir("steamservice /install", tPath);
stall(100);
//6.
cmd("sc config \"Steam Client Service\" start= AUTO");
cmd("sc start \"Steam Client Service\"");
//debug测试
QMessageBox::warning(this, "提示", "指令已全部执行,如果不好使请到QQ群反馈,见'关于'");
QString command = "\"" + QCoreApplication::applicationDirPath() + "/SolveVAC.bat\" " + tPath;
QString output = cmd( command );
ui->debug->setPlainText( output );
QMessageBox::warning(this, "提示", "已调出批处理脚本,如果不好使请到QQ群反馈,见'关于'");
}

//槽函数
Expand Down Expand Up @@ -1184,7 +1147,7 @@ QString MainWindow::cmd(QString command)
p.waitForStarted();
p.closeWriteChannel(); //关闭写通道 ,解决未响应问题
p.waitForFinished();
temp = QString::fromLocal8Bit(p.readAll());
temp = QString::fromLocal8Bit(p.readAllStandardOutput());
p.close();
return temp;
}
Expand Down
14 changes: 7 additions & 7 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
Expand Down Expand Up @@ -556,9 +556,9 @@
</property>
<property name="geometry">
<rect>
<x>10</x>
<x>290</x>
<y>60</y>
<width>171</width>
<width>130</width>
<height>40</height>
</rect>
</property>
Expand All @@ -571,7 +571,7 @@
</font>
</property>
<property name="text">
<string>解决VAC验证(测试)</string>
<string>解决VAC验证</string>
</property>
</widget>
<widget class="QPushButton" name="reloadHarmony">
Expand Down Expand Up @@ -705,8 +705,8 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>171</width>
<y>60</y>
<width>170</width>
<height>40</height>
</rect>
</property>
Expand Down Expand Up @@ -998,7 +998,7 @@ border-radius:10px;</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'微软雅黑'; font-size:18pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'更纱黑体 SC';&quot;&gt;CSGO工具箱V1.0.2a&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'更纱黑体 SC';&quot;&gt;CSGO工具箱V1.0.2c&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;-----------------&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'更纱黑体 SC';&quot;&gt;@Purp1e&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'更纱黑体 SC';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
Expand Down

0 comments on commit 71c960f

Please sign in to comment.