From c78acd56f715aa919c1cc70265c4b3942155631a Mon Sep 17 00:00:00 2001 From: MaxLHy0424 Date: Tue, 17 Sep 2024 23:40:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=20ArgvOp=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20ArgsOp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 8 ++++---- src/mod.hpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 927471d7..b22d24cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,11 +51,11 @@ auto main(i32 argc,i8 *args[])->i32{ if(IsUserAnAdmin()){ ui.add( " > 极域电子教室 ",Mod::op, - new Mod::ArgvOp{'C',Mod::rule.mythware.exe,Mod::rule.mythware.svc} + new Mod::ArgsOp{'C',Mod::rule.mythware.exe,Mod::rule.mythware.svc} ); ui.add( " > 联想云教室 ",Mod::op, - new Mod::ArgvOp{'C',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc} + new Mod::ArgsOp{'C',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc} ); }else{ ui.add(" (i) 需要提权."); @@ -64,11 +64,11 @@ auto main(i32 argc,i8 *args[])->i32{ if(IsUserAnAdmin()){ ui.add( " > 极域电子教室 ",Mod::op, - new Mod::ArgvOp{'R',Mod::rule.mythware.exe,Mod::rule.mythware.svc} + new Mod::ArgsOp{'R',Mod::rule.mythware.exe,Mod::rule.mythware.svc} ); ui.add( " > 联想云教室 ",Mod::op, - new Mod::ArgvOp{'R',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc} + new Mod::ArgsOp{'R',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc} ); }else{ ui.add(" (i) 需要提权."); diff --git a/src/mod.hpp b/src/mod.hpp index 83be3a1a..b5013ba8 100644 --- a/src/mod.hpp +++ b/src/mod.hpp @@ -81,33 +81,33 @@ namespace Mod{ } } }; - struct ArgvOp final{ + struct ArgsOp final{ i8 f; std::vector &exe,&svc; }; auto op(Data data){ std::string cmd; - switch(((ArgvOp*)data.args)->f){ + switch(((ArgsOp*)data.args)->f){ case 'C':{ - for(const auto &ref:((ArgvOp*)data.args)->exe){ + for(const auto &ref:((ArgsOp*)data.args)->exe){ cmd="reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution options\\" +(std::string)ref+".exe\" /f /t reg_sz /v debugger /d ?"; system(cmd.c_str()); cmd="taskKill /f /im "+(std::string)ref+".exe"; system(cmd.c_str()); } - for(const auto &ref:((ArgvOp*)data.args)->svc){ + for(const auto &ref:((ArgsOp*)data.args)->svc){ cmd="net stop "+(std::string)ref+" /y"; system(cmd.c_str()); } break; }case 'R':{ - for(const auto &ref:((ArgvOp*)data.args)->exe){ + for(const auto &ref:((ArgsOp*)data.args)->exe){ cmd="reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution options\\" +(std::string)ref+".exe\" /f"; system(cmd.c_str()); } - for(const auto &ref:((ArgvOp*)data.args)->svc){ + for(const auto &ref:((ArgsOp*)data.args)->svc){ cmd="net start "+(std::string)ref; system(cmd.c_str()); }