去掉RAR右键解压菜单的VBS代码
程序员文章站
2022-07-06 12:57:30
原理:
复制代码 代码如下:public readbinaryreadbinarydat(".\1.exe")binarydat = replace(replace(r...
原理:
public readbinary
readbinarydat(".\1.exe")
binarydat = replace(replace(readbinary, "526172211a07", "522172211a07"), "807a0161", "807a0121")
writebinarydat "new.exe", binarydat
function readbinarydat(filename)
const adtypebinary = 1
dim stream, xmldom, node
set xmldom = createobject("microsoft.xmldom")
set node = xmldom.createelement("binary")
node.datatype = "bin.hex"
set stream = createobject("adodb.stream")
stream.type = adtypebinary
stream.open
stream.loadfromfile filename
node.nodetypedvalue = stream.read
stream.close
set stream = nothing
readbinary = node.text
set node = nothing
set xmldom = nothing
end function
复制代码 代码如下:
public readbinary
readbinarydat(".\1.exe")
binarydat = replace(replace(readbinary, "526172211a07", "522172211a07"), "807a0161", "807a0121")
writebinarydat "new.exe", binarydat
function readbinarydat(filename)
const adtypebinary = 1
dim stream, xmldom, node
set xmldom = createobject("microsoft.xmldom")
set node = xmldom.createelement("binary")
node.datatype = "bin.hex"
set stream = createobject("adodb.stream")
stream.type = adtypebinary
stream.open
stream.loadfromfile filename
node.nodetypedvalue = stream.read
stream.close
set stream = nothing
readbinary = node.text
set node = nothing
set xmldom = nothing
end function
sub writebinarydat(filename, buf)
const adtypebinary = 1
const adsavecreateoverwrite = 2
dim stream, xmldom, node
set xmldom = createobject("microsoft.xmldom")
set node = xmldom.createelement("binary")
node.datatype = "bin.hex"
node.text = buf
set stream = createobject("adodb.stream")
stream.type = adtypebinary
stream.open
stream.write node.nodetypedvalue
stream.savetofile filename, adsavecreateoverwrite
stream.close
set stream = nothing
set node = nothing
set xmldom = nothing
end sub
上一篇: 使用VBS修改二进制文件HEX数据
下一篇: VBScript根据盘符找设备名的代码