|
5#
楼主 |
发表于 2023-11-22 15:04:51
|
只看该作者
本帖最后由 nfans 于 2023-11-22 15:24 编辑
首楼代码测试结果参照: b.txt
多删了空行…… 需求简单实现不易
- Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
- Set colItems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
- For Each objItem in colItems
- OSA = objItem.OSArchitecture
- Next
- Const HKLM = &H80000002
- Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
- If OSA = "64-bit" Then
- oReg.GetStringValue HKLM,"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\XReplace","UninstallString",UninstallString
- If Not IsNull(UninstallString) Then InstallLocation = Replace(UninstallString,"uninstall","XReplace")
- Else
- oReg.GetStringValue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\XReplace","UninstallString",UninstallString
- If Not IsNull(UninstallString) Then InstallLocation = Replace(UninstallString,"uninstall","XReplace")
- End If
- Set WshShell = WScript.CreateObject("WScript.Shell")
- If IsNull(InstallLocation) Then
- WshShell.Popup "软件未安装!", 5, "错误", 0
- WScript.Quit
- End If
- Name = Array("XReplace.exe")
- Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Debug)}!\\.\root\cimv2")
- Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process")
- For Each objProcess In colProcessList
- For Each Process In Name
- If LCase(objProcess.Name) = LCase(Process) Then
- objProcess.Terminate()
- End If
- Next
- Next
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- If objFSO.FileExists(InstallLocation) Then
- Set ado_stream = CreateObject("ADODB.Stream")
- ado_stream.Type = 1
- ado_stream.open
- ado_stream.LoadFromFile InstallLocation
- ado_stream.position = 215133
- ado_stream.Write HexToByte("E9B701000090")
- ado_stream.position = 256771
- ado_stream.Write HexToByte("E9CE02000090")
- ado_stream.position = 277094
- ado_stream.Write HexToByte("01")
- ado_stream.position = 313599
- ado_stream.Write HexToByte("B80100")
- ado_stream.position = 313855
- ado_stream.Write HexToByte("B80100")
- ado_stream.position = 314442
- ado_stream.Write HexToByte("B80100")
- ado_stream.position = 314901
- ado_stream.Write HexToByte("B80100")
- ado_stream.SaveToFile InstallLocation, 2
- ado_stream.Close
- Set ado_stream = Nothing
- End If
- WshShell.Popup "超级字符串批量替换工具 v4.2.5 破解补丁" & vbnewline & vbnewline & "制作:ChiShingChan 编程语言:VBScript",10,"完成",0
- Function HexToByte(hexStr)
- Set xmldom = Wscript.CreateObject("Microsoft.XMLDOM")
- Set byteObj= xmldom.createElement("byteObj")
- byteObj.dataType = "bin.hex"
- byteObj.nodeTypedValue = hexStr
- HexToByte=byteObj.nodeTypedValue
- End Function
复制代码 |
|