Dec 052017
 
Compiler utility that lets you examine the file headers of Windows .exe and .dll files. A freeby from Microsoft (originally for win 3.0, but works with 3.1). Helpful for Non-Microsoft Compiler Windows programmers.
File EXEHDR.ZIP from The Programmer’s Corner in
Category Windows 3.X Files
Compiler utility that lets you examine the file headers of Windows .exe and .dll files. A freeby from Microsoft (originally for win 3.0, but works with 3.1). Helpful for Non-Microsoft Compiler Windows programmers.
File Name File Size Zip Size Zip Type
EXEHDR.EXE 46277 26946 deflated
EXEHDR.WRI 13824 4807 deflated

Download File EXEHDR.ZIP Here

Contents of the EXEHDR.WRI file


1$YhhijklExamining and Changing Executable-File Headers: EXEHDR

Examining and Changing Executable-File Headers: EXEHDR


The Microsoft Segmented-EXE Header Utility (EXEHDR) displays and modifies the contents of an executable-file header. EXEHDR generates a listing showing the contents of the file header and information about each segment in the file. Options are provided that let you change the file header.

You can use EXEHDR with DOS, OS/2, or Microsoft WindowsTM applications and dynamic-link libraries. With a Windows application, some of the meanings of the executable-file-header fields change; see Windows documentation for more information.


EXEHDR Command-Line Syntax

The following illustrates the command-line syntax of EXEHDR:

EXEHDR [options] filename

The following list describes the EXEHDR parameters and options:

ParameterDescription

options Options used to modify EXEHDR output or change the file header

filename Name of a program or dynamic-link library file

EXEHDR always outputs a listing of the header.


EXEHDR Options

Options are not case sensitive and can be shortened to the smallest unique prefix. For example, /HEA, /HEAP, /hea, and /heap are equivalent.

Set Heap Allocation (/HEAP)

Syntax: /HEAP:nnnn

This option sets the size of the local heap and applies to OS/2 and Windows programs only. The nnnn field specifies the heap size in bytes.

You can specify nnnn in decimal, octal, or hexadecimal using C-language notation.

Display Help (/HELP)

Syntax: /HELP

This option displays a brief summary of EXEHDR syntax.

Set Maximum Allocation (/MAX)

Syntax: /MAX:nnnn

This option sets the maximum memory allocation for DOS programs. The nnnn field contains the maximum number of 16-byte paragraphs required to load and run the program. This value must be greater than or equal to the minimum allocation.

The Maximum Allocation option is equivalent to the LINK /CP option.

You can specify nnnn in decimal, octal, or hexadecimal using C-language notation.

Set Minimum Allocation (/MIN)

Syntax: /MIN:nnnn

This option sets the minimum memory allocation for DOS programs. The field nnnn contains the minimum number of 16-byte paragraphs required to load and run the program.

You can specify nnnn in decimal, octal, or hexadecimal using C-language notation.

Set Long File-Name Support (/NEWFILES)

Syntax: /NEWFILES

This option sets a bit telling OS/2 versions 1.2 and later that the executable file supports long file names.

Suppress Sign-On Banner (/NOLOGO)

Syntax: /NOLOGO

This option suppresses the EXEHDR sign-on banner.

Set Application Type (/PMTYPE)

Syntax: /PMTYPE:type

This option specifies the type of application. It pertains only to OS/2 and Windows programs. The /PMTYPE option is equivalent to the NAME statement in a LINK module-definition file or the LINK /PM option.

The type field is equivalent to a keyword in a NAME statement:

type Field Equivalent Keyword
Keywordin NAME Statement

PM WINDOWAPI

VIO WINDOWCOPAT

NOVIO NOTWINDOWCOMPAT

The NAME keyword is accepted as well.

Reset LINK Error (/RESETERROR)

Syntax: /RESETERROR

This option clears the error flag in OS/2 and Windows program. The error flag is set by LINK when the link has unresolved external references or duplicate symbol definitions.

OS/2 and Windows do not load the program if the error flag is set. This option allows you to run a program with LINK errors and is useful during application development.

EXEHEDR displays the message "Error in image" when you use this option.

Set Stack Allocation (/STACK)

Syntax: /STACK:nnnn

This option sets the size of the stack. The nnnn field contains the stack size in bytes. This option is equivalent to the LINK /ST option.

You can specify nnnn in decimal, octal, or hexadecimal using C-language notation.

Display in Verbose Mode (/VERBOSE)

Syntax: /VERBOSE

This option displays the executable-file header in verbose mode.


EXEHDR Output

EXEHDR lists the file header and information about each segment in the file. To redirect this output to a printer or disk file, use the operating system redirection operator.

The output is in two parts: a header listing with the contents of the file header; and a segment listing with the attributes of all segments in the file. If the /VERBOSE option is specified, extra information is included.


Header Listing

FieldPurpose

Module This field lists the name of the application as specified in the NAME statement of the module-definition file.

If no module definition file was used to create the executable file, this field displays the default name.

If a module definition file was used to create the program, but the LIBRARY statement appeared instead of the NAME statement (thus specifying a dynamic-link library), the name of the library is given and EXEHDR uses the word 'Library' instead of 'Module'.


Description This field gives the contents of the DESCRIPTION statement of the module-definition file used to create the program.

Data This field indicates the type of the automatic data segment: SHARED, NONSHARED, or NONE. This type can be specified in a module-definition file. The defaults are NONSHARED for applications and SHARED for dynamic-link libraries.

Initial CS:IP This field gives the program starting address (if an application is being examined) or address of the initialization routine (if a dynamic-link library is being examined).

Initial SS:SP This field gives the value of the initial stack pointer.

DGROUPThis field gives the segment number of the automatic data segment. This segment corresponds to the group named DGROUP in the program's object modules. Note that segment numbers start with the number 1.


Segment Listing

ColumnMeaning

no. Decimal Segment index number, starting with 1.

type Identification of the segment as a code or data segment. A code segment is any segment with a class name ending in 'CODE'. All other segments are data segments.

address Location within the file of the contents of the segment.

file Size of the segment in bytes, as contained in the file.

mem Size of the segment in bytes, as it is in memory. If the value is greater than the value of the file field, the operating system pads the additional space with zero values at load time.

flags Segment attributes. If the /VERBOSE option is not used, only nondefault attributes are listed. Attributes are given in the form specified in the module-definition file. Attributes meaningful to Windows but not to OS/2 are displayed in lowercase and in parentheses, for example, (movable).


EXEHDR Output: Example

The following output is generated by EXEHDR for the file LINK.EXE:

Microsoft(R) EXE File Header Utility Version 2.00
Copyright(C) Microsoft Corp 1985-1989. All rights reserved.

Module: LINK
Description: Microsoft Segmented-Executable Linker
Data: NONSHARED
Initial CS:IP: seg 2 offset 6188
Initial SS:SP: seg 4 offset 0000
Extra stack allocation: 3100 bytes
DGROUP: seg 4

no. type address file mem flags
1 CODE 00003800 0f6c0 0f6c0
2 CODE 00013200 0890a 0890c
3 DATA 0001be00 021d8 021d8
4 DATA 0001e000 01db4 05ea0


Output Using Verbose Option

When you specify the /VERBOSE option, EXEHDR generates additional output:

1. DOS-specific header information. All OS/2 executable files have a DOS header, whether bound or not. If the program is not bound, the DOS portion typically consists of a stub that simply terminates the program.

2. OS/2-specific header information. The segment-table display in verbose mode is described below.

3. File addresses and lengths of the tables in the executable file. For each table, the following are generated:

* Name of the table

* Address of the table within the file

* Length of the table in hexadecimal radix

* Length of the table in decimal radix

4. Segment table with all attributes, not just the nondefault attributes. The /VERBOSE option displays two additional attributes:

* The RELOCS attribute is displayed for each segment that has address relocations. Relocations occur in each segment that references objects in other segments or makes dynamic-link references.

* The ITERATED attribute is displayed for each segment that has iterated data. Iterated data consist of a special code that packs repeated bytes.

5. Run-time relocations and fix-ups.

6. All exported entry points.


Verbose Option Output: Example

Resource Table: 00003273 length 0000 (0)
Resident Names Table: 00003273 length 0008 (8)
Module Reference Table: 0000327b length 0006 (6)
Imported Names Table: 00003281 length 0033 (51)
Entry Table: 000032b4 length 0002 (2)
Non-resident Names Table: 000032b6 length 0029 (41)
Movable entry points: 0
Segment sector size: 512
e. The defaults are NONSHARED for applications and SHARED for dynamic-link libraries.

Initial CS:IP This field gives thwrnj'f-bp^vZ,[email protected]]|YUQMIwsnjfb^:ZBVxR~NJws"o$k)g+c/_5[:WNSlOvKv}wsok%g)ck_[WSOKwsokgLcP_N[RWSOKwsokgc_[W
S~
O
K

w
s
o
k
g
c_ [$WSOKwsokgc_)[-W=SAOCKCHwMs_oak|fb^
Z)
V4
RA
N
J

wesiokgc
_[W#SSOWKWwsokg1c<_F[WTPLws4oGkIgYb^$ZVRNIRwZs[ovlhd`\XU,Q4M4=wCs o!k"g"c"_$[XU,Q4MiWUULL LLLJ2J4M<<<rrrrrrrurwrrrr
r|
r~
r
r
r
r
r
r
r
rr&r(rrr:r<:r
r)
r+
rA
rC
r
r
r<
rrrr
rr%r'rrr
rr1r3rFrHrrr
r<8L<<< p p+ e- eU eW e e e e Z2!Z4!Z!O
<8L
<8L
!!p"p"e"e"e"e"\"Z"Z"Q2#Qh#Q#Q
<<<<
<8L
##r$rB$ra$r$r$r"\"Z"Z"Q2#Qh#Q#Q
<<<<
<8L
<0LinePrinterc/_5[:WNSlOvK


 December 5, 2017  Add comments

Leave a Reply