#SingleInstance, Force
VarSetCapacity(Bin,30,0)
StrPut("ProductVersion", &Bin, 15, "UTF-16")
BinToHexSp(Bin,30,Needle)
MsgBox,,This is the needle to be searched, %Needle%

FileRead, Bin, *c %A_WinDir%\System32\firewall.cpl
BinToHexSp(Bin,,Hex)
Offset:=InHex(Hex,Needle) 
If ErrorLevel
  MsgBox,,ProductVersion, % StrGet(&Bin+Offset+30,"UTF-16")

; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=77819
BinToHexSp(ByRef B, NB:=0, ByRef H:="", F:=0x40000004) { ; By SKAN on D36P/D36P @ tiny.cc/bintohexsp
  Local BB:=NB ? NB : VarSetCapacity(B), HB:=(BB*(F?3:2))*(A_Isunicode?2:1), X:=VarSetCapacity(H,HB,0)
  Return DllCall("Crypt32.dll\CryptBinaryToString", "Ptr",&B,"Int",BB,"Int",F?F:12,"Str",H,"UIntP",HB)
}

InHex(Haystack, Needle, CS:=0, Pos:=1, Occur:=1) { ; InHex by SKAN on D36P/D36P @ tiny.cc/bintohexsp
  Return (ErrorLevel:=InStr(Haystack, Needle, CS, Pos, Occur)) ? ((ErrorLevel+2)//3)-1 : ""  
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。