LFANEW(1)

πŸ’– LFANEW(1) β€” like, the manual page, bestie πŸ’–

General Commands Manual ✨ lfanew ✨


🌸 NAME 🌸

lfanew β€” manipulate fat binary programs wrapped in MZ files 🫢


✨ SYNOPSIS ✨

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>

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so default behaviour, no flags, nothing: lfanew adds a .e_lfanew header field to an old-style MZ executable. Why tho? So the program can be used as an MS-DOS loader stub for a NE/PE executable. It's giving "glow-up for your stub" πŸ’…

With -S ("stubify"), lfanew creates a "fat" binary by combining an MZ stub with a NE/PE payload. Two things, one file. Iconic. πŸ”₯

With -U ("unstubify"), lfanew extracts a NE/PE payload from a "fat" binary, removing any MZ stub. Yeet the stub, keep the payload. 😭✨


πŸ’… OPTIONS πŸ’…

  • -k β€” Keeps the output if an error is encountered, instead of deleting it. Like, if things go sideways, your file stays. No take-backs, no auto-cleanup. πŸ™ˆ
  • -p β€” Derives the stub size from .e_cp and .e_cblp, rather than from .e_lfanew. Different source of truth, bestie. ⭐

πŸ‘‘ 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. That's the vibe check right there β€” no room, no stub. πŸ’€

PE executables generally need to be unstubified before a different stub can be attached. So like, un-stub first, then re-stub. No cap. πŸŽ€

🌈 AUTHORS 🌈

lfanew was written by TK Chia. πŸ‘‘

This manual page was formatted by Stephen Kitt <skitt@debian.org> for the Debian GNU/Linux system (but may be used by others). 🫢


okay that's the whole page, mwah πŸ’– this was the LFANEW(1) manual page, dated 20230825, and yes the footer really does say LFANEW(1) again because it's that girl. periodt. βœ¨πŸ’…

πŸ“¦ where this page comes from