Ashalshaikh Posted August 16, 2009 Share Posted August 16, 2009 (edited) HiFirst My English Is Very Bad ... So I'm Sorry >_< I Want TO Read Some File As Hex ::: Like (Hex Workshop)I Just Want To Read !!To search for the signature.Thanks !! Edited August 16, 2009 by Ashalshaikh Link to comment Share on other sites More sharing options...
Yashied Posted August 16, 2009 Share Posted August 16, 2009 (edited) HiFirst My English Is Very Bad ... So I'm Sorry >_< I Want Read Some File As Hex ::: Like (Hex Workshop)I Just Want To Read !!To search for the signature.Thanks !! Look at _WinAPI_ReadFile(). Edited August 16, 2009 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...
Ashalshaikh Posted August 16, 2009 Author Share Posted August 16, 2009 Look at _WinAPI_ReadFile(). Thank you very muchI am very sorryI did not understand the example in help bookCan you write a simple example of reading. >_< Link to comment Share on other sites More sharing options...
Yashied Posted August 16, 2009 Share Posted August 16, 2009 (edited) #Include <EditConstants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global $sFile, $hFile, $iSize, $sData, $tData, $iRead $sFile = @WindowsDir & '\regedit.exe' $iSize = FileGetSize($sFile) $tData = DllStructCreate('byte[' & $iSize & ']') $hFile = _WinAPI_CreateFile($sFile, 2, 2, 2) _WinAPI_ReadFile($hFile, DllStructGetPtr($tData), $iSize, $iRead) _WinAPI_CloseHandle($hFile) MsgBox(0, '', Hex(DllStructGetData($tData, 1, 1), 2) & Hex(DllStructGetData($tData, 1, 2), 2) & ' (' & Chr(DllStructGetData($tData, 1, 1)) & Chr(DllStructGetData($tData, 1, 2)) & ') - signature for EXE fies.') $sData = '' For $i = 1 To $iSize $sData &= Hex(DllStructGetData($tData, 1, $i), 2) If Mod($i, 16) = 0 Then $sData &= @CRLF Else $sData &= ' ' EndIf Next $sData = StringTrimRight($sData, 2) Global $Edit GUICreate('MyGUI', 422, 526) $Edit = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit, $sData) GUISetState() Do Until GUIGetMsg() = -3 Edited August 16, 2009 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...
Ashalshaikh Posted August 16, 2009 Author Share Posted August 16, 2009 #Include <EditConstants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global $sFile, $hFile, $iSize, $sData, $tData, $iRead $sFile = @WindowsDir & '\regedit.exe' $iSize = FileGetSize($sFile) $tData = DllStructCreate('byte[' & $iSize & ']') $hFile = _WinAPI_CreateFile($sFile, 2, 2, 2) _WinAPI_ReadFile($hFile, DllStructGetPtr($tData), $iSize, $iRead) _WinAPI_CloseHandle($hFile) MsgBox(0, '', Hex(DllStructGetData($tData, 1, 1), 2) & Hex(DllStructGetData($tData, 1, 2), 2) & ' (' & Chr(DllStructGetData($tData, 1, 1)) & Chr(DllStructGetData($tData, 1, 2)) & ') - signature for EXE fies.') $sData = '' For $i = 1 To $iSize $sData &= Hex(DllStructGetData($tData, 1, $i), 2) If Mod($i, 16) = 0 Then $sData &= @CRLF Else $sData &= ' ' EndIf Next $sData = StringTrimRight($sData, 2) Global $Edit GUICreate('MyGUI', 422, 526) $Edit = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit, $sData) GUISetState() Do Until GUIGetMsg() = -3 Thank you Very Much .. I Like It, It's very professional. >_< Link to comment Share on other sites More sharing options...
Rambo Posted August 17, 2009 Share Posted August 17, 2009 This is very interesting for me too, thanks Link to comment Share on other sites More sharing options...
Yashied Posted August 17, 2009 Share Posted August 17, 2009 By the way, if you need information on the ZIP archive only, it is not necessary to read the whole file. Just read the first 30 bytes of this file. Local file header signature (4 bytes) - 0x504B0304 Version needed to extract (2 bytes) General purpose bit flag (2 bytes) Compression method (2 bytes) Last mod file time (2 bytes) Last mod file date (2 bytes) CRC-32 (4 bytes) Compressed size (4 bytes) Uncompressed size (4 bytes) File name length (2 bytes) Extra field length (2 bytes) 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...
trancexx Posted August 17, 2009 Share Posted August 17, 2009 No Yashied, you are wrong about ZIP.There is no central header inside ZIP file. Thing is more complex there. This was discussed before on General help forum. The result was weaponx's script to read zip file (headers).Though I would prefer DllStruct() solution his script is great for the job.Search for it, you will see what I mean. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Ashalshaikh Posted August 17, 2009 Author Share Posted August 17, 2009 (edited) By the way, if you need information on the ZIP archive only, it is not necessary to read the whole file. Just read the first 30 bytes of this file.Local file header signature (4 bytes) - 0x504B0304Version needed to extract (2 bytes)General purpose bit flag (2 bytes)Compression method (2 bytes)Last mod file time (2 bytes)Last mod file date (2 bytes)CRC-32 (4 bytes)Compressed size (4 bytes)Uncompressed size (4 bytes)File name length (2 bytes)Extra field length (2 bytes)It's wonderful informations Thank you very much.No Yashied, you are wrong about ZIP.There is no central header inside ZIP file. Thing is more complex there. This was discussed before on General help forum. The result was weaponx's script to read zip file (headers).Though I would prefer DllStruct() solution his script is great for the job.Search for it, you will see what I mean.THanks !! >_< Edited August 17, 2009 by Ashalshaikh Link to comment Share on other sites More sharing options...
Yashied Posted August 17, 2009 Share Posted August 17, 2009 http://www.pkware.com/documents/casestudies/APPNOTE.TXT 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