📄 opthdr.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta name="GENERATOR" content="Mozilla/4.61 [en] (Win95; I) [Netscape]">
<title>COFF: Optional Header</title>
</head>
<body>
<center><table BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH="100%" >
<tr>
<td ALIGN=LEFT VALIGN=TOP BGCOLOR="#FFCC99"><b><font face="itc avant garde gothic,helvetica,arial">
<a href="/" target="_top">www.delorie.com</a>/<a href="/djgpp/" target="_top">djgpp</a>/<a href="/djgpp/doc/" target="_top">doc</a>/<a href="/djgpp/doc/coff/" target="_top">coff</a>/opthdr.html</font></b></td>
<td ALIGN=RIGHT VALIGN=TOP BGCOLOR="#FFCC99"><b><font face="itc avant garde gothic,helvetica,arial">
<a href="/search/">search</a></font></b></td>
</tr>
</table></center>
<center><b><font size=-1>COFF: Optional Header</font></b></center>
<p>The optional header immediately follows <a href="filhdr.html">the file
header</a> in the COFF file. The size of this header is stored in the <tt>f_opthdr</tt>
field of the file header. You must read that many bytes from the file regardless
of how big you expect the optional header to be.
<p>Two optional headers are defined for DJGPP objects:
<table>
<tr>
<th>Struct
<hr noshade size=1></th>
<th>Size
<hr noshade size=1></th>
<th>Purpose
<hr noshade size=1></th>
</tr>
<tr VALIGN=TOP>
<td><tt>AOUTHDR</tt></td>
<td ALIGN=CENTER>28</td>
<td>Added to executables to provide the entry point of the program</td>
</tr>
<tr VALIGN=TOP>
<td><tt>GNU_AOUT</tt></td>
<td ALIGN=CENTER>32</td>
<td>Unknown</td>
</tr>
</table>
<pre>typedef struct {
unsigned short <b>magic</b>; /* type of file */
unsigned short vstamp; /* version stamp */
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
unsigned long dsize; /* initialized data " " */
unsigned long bsize; /* uninitialized data " " */
unsigned long <b>entry</b>; /* entry pt. */
unsigned long text_start; /* base of text used for this file */
unsigned long data_start; /* base of data used for this file */
} <b>AOUTHDR</b>;</pre>
The only two fields you should rely on are described below.
<dl>
<dt>
<tt>magic</tt> - magic number</dt>
<dd>
Always the value <tt>ZMAGIC</tt> (<tt>0x010b</tt>).</dd>
<dt>
<tt>entry</tt> - entry point</dt>
<dd>
This should be used to provide the initial value of <tt>%eip</tt> when
the program is initialized.</dd>
</dl>
<table BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH="100%" >
<tr>
<td ALIGN=LEFT VALIGN=TOP BGCOLOR="#FFCC99"><b><font face="itc avant garde gothic,helvetica,arial">
<a href="/users/dj/" target="_top">webmaster</a>
<a href="/donations.html" target="_top">donations</a> <a href="/store/books/" target="_top">bookstore</a></font></b></td>
<td ALIGN=RIGHT VALIGN=TOP BGCOLOR="#FFCC99"><b><font face="itc avant garde gothic,helvetica,arial">
<a href="/" target="_top">delorie
software</a> <a href="/privacy.html" target="_top">privacy</a></font></b></td>
</tr>
<tr>
<td ALIGN=LEFT VALIGN=TOP BGCOLOR="#FFCC99"><b><font face="itc avant garde gothic,helvetica,arial">
<a href="/copyright.html" target="_top">Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -