Usage:
-
lfanew
[-k
]-o
out-stub-file in-stub-file -
lfanew -S
[-kp
]-o
out-fat-file in-payload-file in-stub-file -
lfanew -U
[-kp
]-o
out-payload-file in-fat-file
Operating modes:
-
On default,
lfanew
adds a.e_lfanew
header field[1] to an old-styleMZ
executable program, so that the program can potentially be used as an MS-DOS loader stub for a modern "new executable" format. -
-S
("stubify"): tellslfanew
to create a fat binary by combining anMZ
stub with a "new executable" payload. -
-U
("unstubify"): tellslfanew
to extract the "new executable" payload contained inside a fat binary, removing anyMZ
stub.
Options:
-
-k
("keep"): says to keep the output file in case of an error, rather than delete it. -
-p
("pages"): for-S
or-U
, says to derive the stub size from.e_cp
and.e_cblp
, rather than from.e_lfanew
.
lfanew
can add a stub to a Microsoft Portable Executable (PE
)[2] payload, if there is enough RVA space before the PE
sections to accommodate the stub (and PE
headers). You will likely need to unstubify a PE
program before attaching it to a different stub.
Compat. | Meaning |
---|---|
P08 |
Part of the POSIX.1-2008[3] standard. |
X |
|
Avail. | Meaning |
---|---|
= |
Facility is available for all host platforms. |
(=) |
Facility is available if the host platform does not already define this facility itself. |
64 |
Facility is available only if the host C compiler directly support 64-bit integers ( |
Compat. | Avail. | Type | Notes |
---|---|---|---|
|
|||
X |
= |
|
Unaligned 16-, 32-, or 64-bit little endian binary numeral. These types can be used directly inside a |
X |
= |
|
|
X |
= |
|
|
|
|||
X |
= |
|
|
Compat. | Avail. | Function | Notes |
---|---|---|---|
|
|||
P08 |
(=) |
|
|
|
|||
X |
= |
|
|
|
|||
X |
= |
|
Converts x from host byte order to little endian. |
X |
= |
|
|
X |
64 |
|
|
X |
= |
|
Converts x from little endian to host byte order. |
X |
= |
|
|
X |
= |
|
Converts x from little endian to host byte order, and returns the high or low 16-bit half respectively. |
X |
= |
|
|
X |
64 |
|
Converts x from little endian to host byte order. |
X |
= |
|
Converts x from little endian to host byte order, and returns the high or low 32-bit half respectively. |
X |
= |
|