lfanew1
Manipulate fat binary programs wrapped in mz files
Usage
lfanew [-k]
-o
<out-stub-file>
<in-stub-file>
lfanew -S
[-k]
[-p]
-o
<out-fat-file>
<in-payload-file>
<in-stub-file>
lfanew -U
[-k]
-o
<out-payload-file>
<in-fat-file>
Overview
By default, lfanew adds a .e_lfanew header field to an old-style MZ executable, so that the program can be used as an MS-DOS loader stub for a NE/PE executable.
With -S ("stubify"), lfanew creates a "fat" binary by combining an MZ stub with a NE/PE payload.
With -U ("unstubify"), lfanew extracts a NE/PE payload from a "fat" binary, removing any MZ stub.
Options
-
-k -
Keeps the output if an error is encountered, instead of deleting it.
-
-p -
Derives the stub size from
.e_cpand.e_cblp, rather than from.e_lfanew.
Notes
lfanew can add a stub to a Portable Executable payload if there is enough RVA space before the PE sections to accommodate the stub and PE headers. PE executables generally need to be unstubified before a different stub can be attached.