|
本帖最后由 窄口牛 于 2025-7-17 07:14 编辑
On Error Resume Next
Dim objFSO, objShell, appDataPath, jjgamePath, scriptPath, mainProcessId, jjgameBackupPath
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Dim objWMIService
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
appDataPath = objShell.ExpandEnvironmentStrings("%APPDATA%")
jjgamePath = appDataPath & "\JJGame"
jjgameBackupPath = appDataPath & "\JJGame-back"
scriptPath = objFSO.GetParentFolderName(WScript.ScriptFullName)
HandleJJGamePath
RunModule
Sub HandleJJGamePath
Dim targetPath
targetPath = scriptPath & "\用户数据\Users\Administrator\AppData\Roaming\JJGame"
If Not objFSO.FolderExists(targetPath) Then
objFSO.CreateFolder(targetPath)
End If
If objFSO.FolderExists(jjgamePath) Then
Dim isLink, actualTarget
isLink = False
actualTarget = ""
Dim cmd, linkCheck, linkOutput
Set linkCheck = objShell.Exec("cmd /c dir /aL """ & appDataPath & """ | findstr /i ""JJGame""")
linkOutput = linkCheck.StdOut.ReadAll()
If InStr(linkOutput, "<SYMLINKD>") > 0 Then
isLink = True
Dim lines, i, parts
lines = Split(linkOutput, vbCrLf)
For i = 0 To UBound(lines)
If InStr(lines(i), "<SYMLINKD>") > 0 Then
parts = Split(lines(i), "[")
If UBound(parts) >= 1 Then
actualTarget = Trim(Replace(parts(1), "]""", ""))
Exit For
End If
End If
Next
End If
If isLink Then
If Not PathCompare(actualTarget, targetPath) Then
objShell.Run "cmd /c rmdir """ & jjgamePath & """", 0, True
CreateSymbolicLink targetPath, jjgamePath
End If
Else
If objFSO.FolderExists(jjgameBackupPath) Then
objFSO.DeleteFolder jjgameBackupPath, True
End If
objFSO.MoveFolder jjgamePath, jjgameBackupPath
CreateSymbolicLink targetPath, jjgamePath
End If
ElseIf Not objFSO.FolderExists(jjgamePath) Then
CreateSymbolicLink targetPath, jjgamePath
End If
End Sub
Function PathCompare(path1, path2)
PathCompare = (path1 = path2)
End Function
Sub CreateSymbolicLink(targetPath, linkPath)
Dim linkCommand, returnCode
linkCommand = "cmd /c mklink /d """ & linkPath & """ """ & targetPath & """"
returnCode = objShell.Run(linkCommand, 0, True)
If returnCode <> 0 Then
MsgBox "符号链接创建失败,请以管理员权限运行!" & Err.Description
WScript.Quit
End If
End Sub
Sub RunModule
Dim loaderDir
loaderDir = scriptPath & "\大家乐JJ游戏助手"
objShell.CurrentDirectory = loaderDir
Dim loaderPath
loaderPath = scriptPath & "\大家乐JJ游戏助手\DJL_Loader.exe"
If objFSO.FileExists(loaderPath) Then
objShell.Run "cmd /c start """" /D """ & loaderDir & """ """ & loaderPath & """", 0, False
WScript.Sleep 200
End If
Dim lobbyPath, objProcess
lobbyPath = scriptPath & "\TKLobby.exe"
If objFSO.FileExists(lobbyPath) Then
Set objProcess = objWMIService.Get("Win32_Process")
objProcess.Create lobbyPath, Null, Null, mainProcessId
WScript.Sleep 800
KillProcess "DJL_Auxiliary.exe"
KillProcess "AgentStarter.exe"
KillProcess "TKStatistics.exe"
KillProcess "TKAssistor.exe"
KillProcess "AgentStarter.exe"
WScript.Sleep 200
Dim sourceExe, destPath
sourceExe = scriptPath & "\打开.exe"
If objFSO.FileExists(sourceExe) Then
objFSO.CopyFile sourceExe, scriptPath & "\TKStatistics.exe", True
objFSO.CopyFile sourceExe, scriptPath & "\TKAssistor.exe", True
objFSO.CopyFile sourceExe, scriptPath & "\大家乐JJ游戏助手\DJL_Auxiliary.exe", True
End If
WaitForProcessExit mainProcessId
End If
RestoreJJGameBackup
KillProcess "DJL_Loader.exe"
KillProcess "TKCltNet.exe"
KillProcess "TKStatistics.exe"
KillProcess "TKAssistor.exe"
KillProcess "AgentStarter.exe"
KillProcess "qtcefwing.exe"
End Sub
Sub RestoreJJGameBackup()
Dim isLink, result, cmd
If objFSO.FolderExists(jjgamePath) Then
If objFSO.FolderExists(jjgamePath) Or objFSO.FileExists(jjgamePath) Then
Set cmd = objShell.Exec("cmd /c dir /aL """ & appDataPath & """ | findstr /i ""JJGame""")
result = cmd.StdOut.ReadAll()
isLink = (InStr(result, "<SYMLINKD>") > 0)
If isLink Then
On Error Resume Next
objShell.Run "cmd /c rmdir """ & jjgamePath & """", 0, True
End If
End If
On Error Resume Next
objFSO.MoveFolder jjgameBackupPath, jjgamePath
If Err.Number <> 0 Then
Err.Clear
End If
On Error GoTo 0
End If
End Sub
Sub WaitForProcessExit(processId)
Dim colProcesses
Set colProcesses = objWMIService.ExecNotificationQuery( _
"SELECT * FROM __InstanceDeletionEvent WITHIN 1 WHERE " & _
"TargetInstance ISA 'Win32_Process' AND " & _
"TargetInstance.ProcessID = " & processId)
colProcesses.NextEvent
End Sub
Sub KillProcess(processName)
Dim wmi, processes, result
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set processes = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE Name='" & processName & "'")
For Each p In processes
result = p.Terminate
If result = 0 Then
WScript.Sleep 500
End If
Next
End Sub 它会检测现在系统里的用户数据路径,关闭无用副进程,并修改副进程为无法执行的exe文件,最后无痕处理,对系统毫无改变。
附赠一个选择用户数据,拷贝到批处理所在文件夹(带完整目录结构)。
启动游戏.rar
(2.39 KB, 下载次数: 4)
|
|