flat assembler
Message board for the users of flat assembler.
Index
> Windows > [fasm2] Selective modification of headers |
| Author |
|
|
Tomasz Grysztar 13 Dec 2025, 20:26
First, if you include "pe.inc" directly instead of using the "format PE" wrapper, you can set up some of the header fields with "PE.Settings" symbols, like in the fasmg's examples:
Code: PE.Settings.Machine = IMAGE_FILE_MACHINE_AMD64 PE.Settings.Stub = 'nul' PE.Settings.Magic = 0x20B PE.Settings.ImageBase = 0x140000000 PE.Settings.Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE + IMAGE_FILE_LARGE_ADDRESS_AWARE PE.Settings.DllCharacteristics = IMAGE_DLLCHARACTERISTICS_NX_COMPAT + IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI include 'format/pe.inc' Second, if you need to alter header fields not covered by "PE.Settings", you can still rewrite any of the output values with STORE directive. There is a STORE variant that allow to write at any offset in the output: Code: store "ZM":word at :0 ; change the "MZ" signature to "ZM" (a trick to force stub execution) Code: store -1 at PE : PE.OptionalHeader.MajorLinkerVersion The STORE method works when you use "format PE" wrapper, too. |
|||
|
|
AE 14 Dec 2025, 07:45
Tomasz Grysztar, 🙏 Thank you very much!
|
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.