This is because ImageSectionHeaders is the third field in OVERALL_FILE and the preceding fields are of dynamic size, so the position of ImageSectionHeaders adapts accordingly. But in such a way that it depends on the two dynamic declarations before (their size and position, that depends on sibling/previous fields). ImageSectionHeaders is defined dynamically, as well. The result can be seen in the second picture in the post above.
Hxd binary editor code#
The position of ImageNtHeaders32 is dependent on ImageDosHeader._lfanew, which is a file-dependent offset/pointer and would also require imperative code in traditional languages. While with traditional programming language you would need additional code to handle the dynamic nature of the data structure, you can do it declaratively in HSD. What is special (besides being able to define dynamic structures and automatically parsing files accordingly), are expressions like this:Īs you can see in the fourth picture in the post above, the array size of DataDirectory dynamically depends on the field NumberOfRvaAndSize, which was defined earlier in the file, and is displayed accordingly. The attached pictures show how this is parsed/visualized for my PropEdit.exe (but the solution is generic and works with any 32-bit PE file). ImageSectionHeaders: IMAGE_SECTION_HEADER
ImageNtHeaders32: IMAGE_NT_HEADERS32 :ImageDosHeader._lfanew OriginalFirstThunk_ImportLookupTable_RVA: UInt32 įirstThunk_ImportAddressTable_RVA: UInt32 Misc_PhysicalAddressOrVirtualSize: UInt32
For PE files this allows mapping RVA (relative virtual addresses) to absolute file offsets.Īll of the file structure is given in a declarative language, called HxD structure definition (HSD).Ī functional example for parsing PE headers is given below:ĭataDirectory: IMAGE_DATA_DIRECTORY There is also a feature to map pointers using a function (currently only built-in ones). PE (portable executable) files are currently the template to determine the necessary functionality (but other file formats like PNG-files and matching features will be added).Ĭurrently, you can define dynamic arrays and structures with dynamic size, where other parts/fields in the file define the size, and pointers are dereferenced automatically.
Hxd binary editor download#
P.S.: If you like it, please star the code on GitHub or give it a (good 😉) rating on download sites.Ĭurrently, I am working again (as mentioned above) on a feature for creating a structure viewer/editor. Importing and exporting of Intel Hex, Motorola S-RecordsĮxporting to Pascal, C, Java, C#, VB.NET, PureBasic, but also HTML, RTF, and TeXĬhecksum and hash generation and validationĬurrently, available in version 2.4 and 17 languages: HxD download. Search and replace with support for various data types Open source plugin-framework to extend with new, custom type converters.Memory editor (full support for 64 and 32-bit)ĭata folding, for easier overview and hiding inaccessible regionsĬonverts current data into many types, for editing and viewing HxD is a Freeware hex, disk and memory editor, that is fast and can handle files of arbitrary size (up to 8 EiB).ĭisk editor (automatically unmounts drives as necessary when saving changes)