感谢P版的汇编代码,虽然不知道是什么意思,但是还是根据这机器码写出了au3的代码
以下就是应用的FUNC,不知道有没有同样需求的兄弟们需要使用。
最后,如果P版有空的话,能否解释一下汇编代码
我只知道shr 攀挀砀, 2这句是右移2位的意思,就是除以4的意思,因为是按照四个字节比较
如果是三个字节比较的话,应该就不能这么写了吧?,如果我要改成三个字节比较的话,要怎么修改呢?
$Data1 = "ff12345601020304ff12345605060708"
$Data2 = "ff12345605060708ff12345601020304"
$r = cmps($Data1, $Data2, "0x12345678")
MsgBox(0, "替换次数" & $r[0] & "次", $r[1])
Func cmps($dst, $src, $replace)
Local $r[2]
If StringLeft($replace, 2) = '0x' Then
$replace = StringRegExpReplace(StringTrimLeft($replace, 2), '(\w{2})(\w{2})(\w{2})(\w{2})', '0x$4$3$2$1')
Else
$replace = StringRegExpReplace($replace, '(\w{2})(\w{2})(\w{2})(\w{2})', '0x$4$3$2$1')
EndIf
$Opcode = Binary("0x558BEC56578B75088B7D0C8B4D108B551433C0C1E902FCF3A775065F5EC9C210008956FC403BC0EBEECCCC")
$CodeBufferPtr_return=DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", BinaryLen($Opcode), "dword", 0x00001000, "dword",0x00000040)
Local $CodeBufferPtr = $CodeBufferPtr_return[0]
Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]", $CodeBufferPtr)
DllStructSetData($CodeBuffer, 1, $Opcode)
If IsBinary($dst) = False Then $dst = Binary("0x" & $dst)
Local $dst_BufferLen = BinaryLen($dst)
Local $dst_Buffer = DllStructCreate("byte[" & $dst_BufferLen & "]")
DllStructSetData($dst_Buffer, 1, $dst)
If IsBinary($src) = False Then $src = Binary("0x" & $src)
Local $src_BufferLen = BinaryLen($src)
Local $src_Buffer = DllStructCreate("byte[" & $src_BufferLen & "]")
DllStructSetData($src_Buffer, 1, $src)
Local $Ret = DllCallAddress("uint", $CodeBufferPtr, "ptr", DllStructGetPtr($dst_Buffer), "ptr", DllStructGetPtr($src_Buffer), "uint", $dst_BufferLen, "uint", $replace)
DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $CodeBufferPtr, "ulong_ptr", 0, "dword", 0x00008000)
$r[0] = $Ret[0]
$r[1] = DllStructGetData($dst_Buffer, 1)
Return $r
EndFunc ;==>cmps
|