⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opthdr.html

📁 我在网上下的
💻 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">&nbsp;
<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">&nbsp;
<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 {
&nbsp; unsigned short <b>magic</b>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* type of file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned short vstamp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* version stamp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; tsize;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* text size in bytes, padded to FW bdry*/
&nbsp; unsigned long&nbsp; dsize;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* initialized data&nbsp;&nbsp;&nbsp; "&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; bsize;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* uninitialized data&nbsp; "&nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>entry</b>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* entry pt.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; text_start;&nbsp;&nbsp;&nbsp;&nbsp; /* base of text used for this file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; data_start;&nbsp;&nbsp;&nbsp;&nbsp; /* base of data used for this file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
} <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">&nbsp;
<a href="/users/dj/" target="_top">webmaster</a>&nbsp;
<a href="/donations.html" target="_top">donations</a>&nbsp; <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">&nbsp;
<a href="/" target="_top">delorie
software</a>&nbsp; <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">&nbsp;
<a href="/copyright.html" target="_top">Copyright

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -