rootx Posted June 1, 2017 Posted June 1, 2017 (edited) I need help to read one file in a HEX mode and go to one offset and than read the value. THX Edited June 1, 2017 by rootx
mikell Posted June 1, 2017 Posted June 1, 2017 (edited) ? Func _Offset2String($my_file, $start, $end) Local $file = FileOpen($my_file, 16) ;$FO_BINARY Local $chars = StringRegExp(FileRead($file), '[[:xdigit:]]{2}', 3) FileClose($file) Local $txt = "offset " & $start & "-" & $end & " :" &@crlf&@crlf For $i = $start to $end $txt &= Chr("0x" & $chars[$i]) Next Return $txt EndFunc Edit Certainly much easier using FileSetPos Edited June 1, 2017 by mikell rootx 1
Danyfirex Posted June 1, 2017 Posted June 1, 2017 Alternative. #include <FileConstants.au3> ConsoleWrite(_ReadOffSet("1.txt",0,3) & @CRLF) Func _ReadOffSet($sFilePath,$iOffset,$iLen=1) Local $sRet="" Local $hFile=FileOpen($sFilePath,$FO_BINARY) FileSetPos($hFile,$iOffset,$FILE_BEGIN) $sRet=FileRead($hFile,$iLen) FileClose($hFile) Return $sRet EndFunc Saludos rootx 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
rootx Posted June 1, 2017 Author Posted June 1, 2017 Thx. Best way 4me FileSetPos. And ConsoleWrite(BinaryToString(_ReadOffSet(@ScriptDir&"\FontAwesome.otf",0x000000,16),1) & @CRLF)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now