DllStruct Dev
#61
Posted 12 May 2005 - 05:25 PM
#62
Posted 12 May 2005 - 06:25 PM
#63
Posted 12 May 2005 - 08:02 PM
#64
Posted 12 May 2005 - 09:08 PM
I'm 1/2 way done, I have the read working. So right now it will read the file and create a DllStruct that is:How would we modify binary data? I suppose creatively using DLLStructCreate to handle pointer info... hmmm
In particular, for example, I am wondering how we would edit the "exif" info of a JPEG file?
Lar.
DllStructCreate("byte[" & FileGetSize() & "];int"); where the int is the bytes read
So you could
1) Modify byte by byte with DllStructSetData($p,1,$newByte,$ByteNumber)
2) If you know a struct at a certain location in the file, ie there is a jpeg header you could after reading the file do a $header = DLLStructCreate("int;int",DllStructGetPtr($p) + $offsettoheader)
#65
Posted 12 May 2005 - 09:33 PM
_FileReadToDllStruct($szFileName)
_FileWriteFromDllStruct($p,$szFileName)
See post #1
An example:
#cs vi:ts=4 sw=4: Example, displays first 4k of a binary file in hex Ejoc #ce #include <GUIConstants.au3> #include <DllStruct.au3> GUICreate("HexView",400,400) $hBrowse = GUICtrlCreateButton("Browse",200,3) $hEdit = GUICtrlCreateEdit("",0,30,400,370) GUICtrlSetFont(-1,9,400,0,"Lucida Console") GUISetState() while 1 $msg = GUIGetMsg() Select case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $hBrowse $file = FileOpenDialog("Open File","","ALL (*.*)",1) If Not @Error Then $p = _FileReadToDllStruct($file) If @error Then MsgBox(0,"error","Read Failed") exit EndIf $s = "" $iLen = DllStructGetData($p,2) If $iLen > 4096 Then $iLen = 4096 for $i = 1 To $iLen $s &= HEX(DllStructGetData($p,1,$i),2) & " " If NOT MOD($i,8) Then $s &= " " If NOT MOD($i,16) Then $s &= @CRLF Next GUICtrlSetData($hEdit,$s) DllStructDelete($p) EndIf EndSelect wend
Edited by Ejoc, 12 May 2005 - 10:27 PM.
#66
Posted 12 May 2005 - 10:19 PM
Very goodAdded 2 new UDF's to DllStruct.au3
_FileReadToStruct($szFileName)
_StructWriteToFile($p,$szFileName)
See post #1
An example:
Plain Text#cs vi:ts=4 sw=4: Example, displays first 4k of a binary file in hex Ejoc #ce #include <GUIConstants.au3> #include <DllStruct.au3> GUICreate("HexView",400,400) $hBrowse = GUICtrlCreateButton("Browse",200,3) $hEdit = GUICtrlCreateEdit("",0,30,400,370) GUICtrlSetFont(-1,9,400,0,"Lucida Console") GUISetState() while 1 $msg = GUIGetMsg() Select case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $hBrowse $file = FileOpenDialog("Open File","","ALL (*.*)",1) If Not @Error Then $p = _FileReadToStruct($file) If @error Then MsgBox(0,"error","Read Failed") exit EndIf $s = "" $iLen = DllStructGetData($p,2) If $iLen > 4096 Then $iLen = 4096 for $i = 1 To $iLen $s &= HEX(DllStructGetData($p,1,$i),2) & " " If NOT MOD($i,8) Then $s &= " " If NOT MOD($i,16) Then $s &= @CRLF Next GUICtrlSetData($hEdit,$s) DllStructDelete($p) EndIf EndSelect wend
Better _FileReadToDLLStruct and _FileWriteFromDLLStruct
#67
Posted 12 May 2005 - 10:29 PM
#68
Posted 12 May 2005 - 10:30 PM
DoneVery good
Better _FileReadToDLLStruct and _FileWriteFromDLLStruct
#69
Posted 16 May 2005 - 08:45 PM
Added _DllStructCreateFromString() Creat a struct that is a copy of a string
Added _GetLastErrorMessage() String containing system error message
Edited by Ejoc, 16 May 2005 - 08:54 PM.
#71
Posted 16 January 2007 - 06:23 AM
Edited by SmOke_N, 16 January 2007 - 06:23 AM.
Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





