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
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论