.TH LFANEW "1" "20230825" .SH NAME lfanew \- manipulate fat binary programs wrapped in MZ files .SH SYNOPSIS .B lfanew .RB [ \-k ] .B \-o .RI < out-stub-file "> <" in-stub-file > .br .B lfanew \-S .RB [ \-k "] [" \-p ] .B \-o .RI < out-fat-file "> <" in-payload-file "> <" in-stub-file > .br .B lfanew \-U .RB [ \-k ] .B \-o .RI < out-payload-file "> <" in-fat-file > .SH DESCRIPTION By default, .B lfanew adds a .B .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. .PP With .B \-S ("stubify"), .B lfanew creates a "fat" binary by combining an MZ stub with a NE/PE payload. .PP With .B \-U ("unstubify"), .B lfanew extracts a NE/PE payload from a "fat" binary, removing any MZ stub. .SH OPTIONS .TP 8 .B \-k Keeps the output if an error is encountered, instead of deleting it. .TP 8 .B \-p Derives the stub size from .B .e_cp and .BR .e_cblp , rather than from .BR .e_lfanew . .SH NOTES .B 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. .SH AUTHORS .B lfanew was written by TK Chia. .PP This manual page was formatted by Stephen Kitt for the Debian GNU/Linux system (but may be used by others).