---
name: "lfanew"
section: "1"
platform: "linux"
package: "lfanew"
version: "0~20230825+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/lfanew"
---

# lfanew(1)

manipulate fat binary programs wrapped in MZ files

## 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

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\_cp** and **.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.

## 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).
