captionx Posted September 13, 2013 Share Posted September 13, 2013 ;Question 01: Why does this not return the data? $myStruct = DllStructCreate('unit, Tempstruc[8]') DllStructSetData($myStruct,"Tempstruc",Binary("0x90217F0B00000000000000000000000000000000000000000000000000000000")) ConsoleWrite(Binary(DllStructGetData($myStruct,"Tempstruc"))&@CRLF) ;Question 02: How do i get the size of a struc item ; ie: itemsize("var4") == 128 Local $str = "int var1;byte var2;uint var3;char var4[128]" Local $a = DllStructCreate($str) DllStructSetData($a, "var1", -1) DllStructSetData($a, "var2", 255) DllStructSetData($a, "var3", -1) DllStructSetData($a, "var4", "Hello") ;Question 03: Can you read a binary file using a DLL struc? $File = FileOpenDialog("Select file to patch","C:\","bin (*.bin)") $BinaryStruc = DllStructCreate ( _ "dword Headername;" & _ "dword Filetype;" & _ "dword Fileversion;" ) Link to comment Share on other sites More sharing options...
Yashied Posted September 13, 2013 Share Posted September 13, 2013 (edited) 1.$tByte = DllStructCreate('byte Tempstruc[32]') DllStructSetData($tByte, 'Tempstruc', Binary('0x90217F0B00000000000000000000000000000000000000000000000000000000')) ConsoleWrite(DllStructGetData($tByte, 'Tempstruc') & @CRLF) $tUInt = DllStructCreate('uint Tempstruc[8]', DllStructGetPtr($tByte)) For $i = 1 To 8 ConsoleWrite('0x' & Hex(DllStructGetData($tUInt, 1, $i)) & @CR) Next2. You can't but this is not necessary because the size is known in advance.3.#Include <WinAPI.au3> Global $Bytes $tStruct = DllStructCreate('dword Headername;dword Filetype;dword Fileversion') $hFile = _WinAPI_CreateFile($File, 2, 2) _WinAPI_ReadFile($hFile, DllStructGetPtr($tStruct), DllStructGetSize($tStruct), $Bytes) _WinAPI_CloseHandle($hFile) ConsoleWrite('Headername: ' & DllStructGetData($tStruct, 'Headername') & @CR) ConsoleWrite('Filetype: ' & DllStructGetData($tStruct, 'Filetype') & @CR) ConsoleWrite('Fileversion: ' & DllStructGetData($tStruct, 'Fileversion') & @CR) Edited September 13, 2013 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
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