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

📄 scnhdr.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: Section 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>/scnhdr.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: Section Header</font></b></center>

<pre>typedef struct {
&nbsp; char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>s_name</b>[8];&nbsp; /* section name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>s_paddr</b>;&nbsp;&nbsp;&nbsp; /* physical address, aliased s_nlib */
&nbsp; unsigned long&nbsp; <b>s_vaddr</b>;&nbsp;&nbsp;&nbsp; /* virtual address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>s_size</b>;&nbsp;&nbsp;&nbsp;&nbsp; /* section size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>s_scnptr</b>;&nbsp;&nbsp; /* file ptr to raw data for section */
&nbsp; unsigned long&nbsp; <b>s_relptr</b>;&nbsp;&nbsp; /* file ptr to relocation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>s_lnnoptr</b>;&nbsp; /* file ptr to line numbers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned short <b>s_nreloc</b>;&nbsp;&nbsp; /* number of relocation entries&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned short <b>s_nlnno</b>;&nbsp;&nbsp;&nbsp; /* number of line number entries&nbsp;&nbsp;&nbsp; */
&nbsp; unsigned long&nbsp; <b>s_flags</b>;&nbsp;&nbsp;&nbsp; /* flags&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; */
} <b>SCNHDR</b>;</pre>
This structure always exists immediately following any optional header
in the COFF file (or following the file header, if
<tt>f_opthdr</tt> is
zero). When reading this header, you should read
<b><tt>SCNHSZ</tt></b>
bytes, and not rely on <tt>sizeof(SCNHDR)</tt> to give the correct size.
The number of section headers present is given in the <tt>f_nscns</tt>
field of <a href="filhdr.html">the file header</a>.
<dl>
<dt>
<tt>s_name</tt> - section name</dt>

<dd>
The name of the section. The section name will never be more than eight
characters, but be careful to handle the case where it's exactly eight
characters - there will be no trailing null in the file! For shorter names,
there field is padded with null bytes.</dd>

<dt>
<tt>s_paddr</tt> - physical address of section data</dt>

<dd>
This is the address at which the section data should be loaded into memory.
For linked executables, this is the absolute address within the program
space. For unlinked objects, this address is relative to the object's address
space (i.e. the first section is always at offset zero).</dd>

<dt>
<tt>s_vaddr</tt> - virtual address of section data</dt>

<dd>
Always the same value as <tt>s_paddr</tt> in DJGPP.</dd>

<dt>
<tt>s_size</tt> - section data size</dt>

<dd>
The number of bytes of data stored in the file for this section. You should
always read this many bytes from the file, beginning
<tt>s_scnptr</tt>
bytes from the beginning of the object.</dd>

<dt>
<tt>s_scnptr</tt> - section data pointer</dt>

<dd>
This contains the file offset of the section data.</dd>

<dt>
<tt>s_relptr</tt> - relocation data pointer</dt>

<dd>
The file offset of <a href="reloc.html">the relocation entries</a> for
this section.</dd>

<dt>
<tt>s_lnnoptr</tt> - line number table pointer</dt>

<dd>
The file offset of <a href="lineno.html">the line number entries</a> for
this section.</dd>

<dt>
<tt>s_nreloc</tt> - number of relocation entries</dt>

<dd>
The number of relocation entries for this section. Beware files with more
than 65535 entries; this field truncates the value with no other way to
get the "real" value.</dd>

<dt>
<tt>s_nlnno</tt> - number of line number entries</dt>

<dd>
The number of line number entries for this section. Beware files with more
than 65535 entries; this field truncates the value with no other way to
get the "real" value.</dd>

<dt>
<tt>s_flags</tt> - flag bits</dt>

<dd>
These flags provide additional information for each section. Flags other
than those set below may be set, but are of no use aside from what these
three provide.</dd>

<center><table>
<tr>
<th>Bit
<hr noshade size=1></th>

<th>Symbol
<hr noshade size=1></th>

<th>Meaning
<hr noshade size=1></th>
</tr>

<tr VALIGN=TOP>
<td><tt>0x0020</tt></td>

<td><tt>STYP_TEXT</tt></td>

<td>If set, indicates that this section contains only executable code.</td>
</tr>

<tr VALIGN=TOP>
<td><tt>0x0040</tt></td>

<td><tt>STYP_DATA</tt></td>

<td>If set, indicates that this section contains only initialized data.</td>
</tr>

<tr VALIGN=TOP>
<td><tt>0x0080</tt></td>

<td><tt>STYP_BSS</tt></td>

<td>If set, indicates that this section defines uninitialized data, and
has no data stored in the coff file for it.</td>
</tr>
</table></center>
</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 + -