获得某个dll或exe文件用到的其他dll文件(200分)

  • 主题发起人 主题发起人 潇凡
  • 开始时间 开始时间

潇凡

Unregistered / Unconfirmed
GUEST, unregistred user!
如何象delphi 提供的tdump.exe 一样获得某个dll或exe文件用到的其他<br>dll文件.是否用GetModuleHandle();GetModuleFileName();Module32First(),如何使用?
 
如果只是想知道用了哪些DLL,可以查找该DLL或EXE文件中的'.dll'字符串,<br>一般出现在靠近文件末尾的地方。
 
是个办法,不过应该有个什么函数调用能实现该要求的,因为有不少软件可以做到.
 
VC里面的DEPENDENCE可以
 
我补充一点,晓峰说的工具只能找出静态调用的dll,如果是动态调用的,<br>例如通过LoadLibrary这样的API调用的Dll这些工具就无法得到。
 
问的是如何用程序实现? 不是现成的工具.
 
谢谢各位,我只需要静态调用的import dll文件.<br>比如:<br>tdump.exe tdump.exe -em. &gt; ImportDll.txt<br>的结果如下:<br>Turbo Dump &nbsp;Version 5.0.16.4 Copyright (c) 1988, 1998 Borland International<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Display of File TDUMP.EXE<br><br>IMPORT: &nbsp; &nbsp; KERNEL32.dll<br>IMPORT: &nbsp; &nbsp; &nbsp; USER32.dll<br><br><br>如果在程序中包含'.dll'字符串,ZRY的方法就会<br>有问题.唐晓锋的方法具体如何,请指教.<br>
 
快速查看可以。
 
快速查看TDump.exe<br>引入表中没有找到任何可疑的API,只有ReadFile<br>我估计TDump是打开文件后自己分析文件头信息之类来实现的,不知对否。<br><br>快速查看QuikView.exe本身<br>引入表中找到可疑API如下:<br>MapViewOfFile<br>CreateFileMapping<br>OpenFileMapping<br>UnmapViewOfFile<br>看来是将文件Mapping到内存区域中,然后再分析,<br>基本上和TDump一样,只不过没有直接读写文件而已。<br><br>我的结论:&lt;font color=red&gt;没有找到特别的API直接分析DLL/Exe,<br>好象都是已知PE文件结构,然后再自己分析。&lt;/font&gt;<br><br>&lt;B&gt;也许有遗漏,大家也看看??&lt;/B&gt;
 
我同意蚯蚓同志的分析,文件映射到内存后,分析它的.idata section断,取得<br>Import library directory's address,它包含指向所有静态倒入的dll的文件名的<br>字串的指针。<br>可惜我不懂exe文件的头格式,无法获得此段的具体位置,对file mapping的几个<br>函数也不大了解。<br><br>请各位指正.
 
在&lt;&lt;未公开的windows核心技术&gt;&gt;一书中,有示例程序,<br>用的就是ModuleFirst和ModuleNext(16位的windows3.2下).<br>但是,首先要把exe或dll文件调入,然后才能用以上函数.<br>c程序如下:<br>void ModuleWalk(void)<br>{ MODULEENTRY me;//me是一个包含了模块名,<br>//路径等信息的记录类型<br>BOOL ok;<br>printf("Module List :/n");<br>printf("Name Hmod Count Filename/n");<br>me.dwsize=sizeof(me);<br>ok=ModuleFirst(&amp;me);<br>while (ok)<br>{<br>printf("%-8s %04x %zu %s/n",<br>me.szModule,meHModule,me.wcUsage,me.szExePath);<br>ok=ModuleNext(&amp;me);<br>}<br>}<br>我也想过通过获得exe文件的结构,直接取出文件包含的信息,<br>不知那位能给出可执行文件的具体结构?<br><br>
 
我看了Win32 API Help,里面关于<br>Module32First和Module32Next可以看看,<br>好象可以实现你的目的哦!
 
&nbsp; &nbsp; &nbsp; 一些新的进展<br>我先用LoadLibrary()把模块(Exe或Dll文件)<br>载入,得到载入模块句柄.(可是奇怪,有时能<br>得到正确的handle,有时却为0).然后,再调用<br>CreateToolhelp32Snapshot(8,0)函数(第二个<br>参数表示进程的ID号,0代表当前进程,但是我<br>还不知如何得到载入模块的ID号),返回当前进程<br>的模块快照句柄.这时用Module32First和<br>Module32Next32函数抽取出模块名及路径.程序<br>概略如下:<br>interface <br>type<br>&nbsp; MODULEENTRY32=record<br>&nbsp; &nbsp; &nbsp; &nbsp;dwSize:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;th32ModuleID:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;th32ProcessID:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;GlblcntUsage:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;ProccntUsage:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;modBaseAddr:PBYTE;<br>&nbsp; &nbsp; &nbsp; &nbsp;modBaseSize:DWORD;<br>&nbsp; &nbsp; &nbsp; &nbsp;hModule:HMODULE;<br>&nbsp; &nbsp; &nbsp; &nbsp;szModule:array[0..255] of char;<br>&nbsp; &nbsp; &nbsp; &nbsp;szExePath:array[0..1023] of char;<br>&nbsp; &nbsp; end;<br>type<br>LOADPARMS32=record<br>&nbsp; &nbsp; &nbsp; lpEnvAddress:Pchar; &nbsp;// address of environment strings<br>&nbsp; &nbsp; &nbsp; lpCmdLine:Pchar; &nbsp; &nbsp; // address of command line<br>&nbsp; &nbsp; &nbsp; lpCmdShow:Pchar; &nbsp; &nbsp; // how to show new program<br>&nbsp; &nbsp; &nbsp; dwReserved:DWORD; &nbsp; &nbsp;// must be zero<br>&nbsp; &nbsp; &nbsp;end;<br>function Module32First(hSnapshot:HWnd;var me:MODULEENTRY32):boolean; stdcall;<br>function Module32Next(hSnapshot:HWnd;var me:MODULEENTRY32):boolean; stdcall;<br>function CreateToolhelp32Snapshot(dwFlags:DWORD;th32ProcessID:DWORD):Hwnd;stdcall;<br><br>implementation<br><br>function Module32First; external kernel32 name 'Module32First';<br>function Module32Next; external kernel32 name 'Module32Next';<br>function CreateToolhelp32Snapshot;external kernel32 name 'CreateToolhelp32Snapshot';<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var hmOpid,hm1:HWND;<br>&nbsp; &nbsp; me:MODULEENTRY32;<br>&nbsp; &nbsp; ok:boolean;<br>&nbsp; &nbsp; s:string;<br><br>begin<br>me.dwSize:=sizeof(MODULEENTRY32);//必须先赋值<br>s:='c:/opid.dll';<br>HmOpid:=LoadLibrary(pchar(s));<br>Hm1:=CreateToolhelp32Snapshot(8,0);<br>ok:=Module32First(hm1,me);<br>try<br>&nbsp;while ok do<br>&nbsp; begin<br>&nbsp; &nbsp;ListBox1.Items.add(me.szModule);<br>&nbsp; &nbsp;ListBox2.Items.add(me.szExePath);<br>&nbsp; &nbsp;ok:=Module32Next(hm1,me);<br>&nbsp; end;<br>finally<br>&nbsp;FreeLibrary(HmOpid);<br>end;<br>end;
 
结果如何??
 
各位大侠:<br>我通过分析可执行文件及动态链接库的pe及ne格式,<br>已经解决了这个问题,不知这两百分该送给谁?附文<br>件格式.<br>1.NE format<br><br>INF: Executable-File Header Format &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[P_WinSDK]<br><br>3.00<br>WINDOWS<br>PSSONLY | Windows 3 Developers Notes softlib ENDUSER<br><br>Summary:<br><br>Note: This article is part of a set of seven articles, collectively<br>called the "Windows 3.00 Developer's Notes." More information about<br>the contents of the other articles, and procedures for ordering a<br>hard-copy set, can be found in the knowledge base article titled "INF:<br>The Windows 3.00 Developer's Notes" (Q65260).<br><br>This article can be found in the Software/Data Library by searching on<br>the word EXEFMT or S12688. EXEFMT was archived using the PKware<br>file-compression utility.<br><br>More Information:<br><br>Microsoft defined the segmented executable file format for Windows<br>applications and dynamic-link libraries (DLLs). This file format is<br>also referred to as the New Executable Format. This new format is an<br>extension of the existing MS-DOS .EXE format (old-style format). The<br>purpose of the segmented executable format is to provide the<br>information needed to support the dynamic linking and segmentation<br>capabilities of the Windows environment.<br><br>An executable file contains Microsoft Windows code and data, or<br>Windows code, data, and resources. Specific fields have been added to<br>the old-style .EXE format header to indicate the existence of the<br>segmented file format. The old-style header may contain a valid<br>executable program, called a stub program, that will be executed if<br>the program is run on MS-DOS (without Windows). This stub program<br>usually prints a message indicating that Microsoft Windows is required<br>to run the program. The segmented executable format extensions also<br>begin with a header that describes the contents and location of the<br>executable image in the file. The loader uses this header information<br>when it loads the executable segments in memory.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OLD-STYLE HEADER EXTENSIONS<br>======================================================================<br><br>The old-style header contains information the loader expects for a DOS<br>executable file. It describes a stub program (WINSTUB) the loader can<br>place in memory when necessary, it points to the new-style header, and<br>it contains the stub programs relocation table.<br><br>The following illustrates the distinct parts of the old-style<br>executable format:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; +-------------------------+<br>&nbsp; &nbsp; 00h | &nbsp;Old-style header info &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-------------------------+<br>&nbsp; &nbsp; 20h | &nbsp; &nbsp; &nbsp; &nbsp;Reserved &nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-------------------------+<br>&nbsp; &nbsp; 3Ch | &nbsp; Offset to segmented &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; .EXE header &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-------------------------+<br>&nbsp; &nbsp; 40h | &nbsp;Relocation table and &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp;DOS stub program &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-------------------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;Segmented .EXE Header &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |<br><br>The word at offset 18h in the old-style .EXE header contains the<br>relative byte offset to the stub program's relocation table. If this<br>offset is 40h, then the double word at offset 3Ch is assumed to be the<br>relative byte offset from the beginning of the file to the beginning<br>of the segmented executable header. A new-format .EXE file is<br>identified if the segmented executable header contains a valid<br>signature. If the signature is not valid, the file is assumed to be an<br>old-style format .EXE file. The remainder of the old-style format<br>header will describe a DOS program, the stub. The stub may be any<br>valid program but will typically be a program that displays an error<br>message.<br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SEGMENTED EXE FORMAT<br>======================================================================<br><br>Because Windows executable files are often larger than one segment<br>(64K), additional information (that does not appear in the old-style<br>header) is required so that the loader can load each segment properly.<br>The segmented EXE format was developed to provide the loader with this<br>information.<br><br>The segmented .EXE file has the following format:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; 00h | &nbsp;Old-style EXE &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;Header &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; 20h | &nbsp; &nbsp;Reserved &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; 3Ch | &nbsp; &nbsp;Offset to &nbsp; &nbsp;| ---+<br>&nbsp; &nbsp; &nbsp; &nbsp; | Segmented Header| &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+ &nbsp; &nbsp;|<br>&nbsp; &nbsp; 40h | Relocation Table| &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;&amp; Stub Program | &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+ &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+ &nbsp; &nbsp;|<br>&nbsp; &nbsp; xxh | &nbsp;Segmented EXE &nbsp;| &lt;--+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;Header &nbsp; &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;Segment Table &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | Resource Table &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;Resident Name &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;Table &nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | Module Reference|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;Table &nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | Imported Names &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;Table &nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Entry Table &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;Non-Resident &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Name Table &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Seg #1 Data &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Seg #1 Info &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Seg #n Data &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; Seg #n Info &nbsp; |<br>&nbsp; &nbsp; &nbsp; &nbsp; +-----------------+<br><br><br>The following sections describe each of the components that make up<br>the segmented EXE format. Each section contains a description of the<br>component and the fields in the structures that make up that<br>component.<br><br>Note: All unused fields and flag bits are reserved for future use and<br>must contain 0 (zero) values.<br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SEGMENTED EXE HEADER<br>======================================================================<br><br>The segmented EXE header contains general information about the EXE<br>file and contains information on the location and size of the other<br>sections. The Windows loader copies this section, along with other<br>data, into the module table in the system data. The module table is<br>internal data used by the loader to manage the loaded executable<br>modules in the system and to support dynamic linking.<br><br>The following describes the format of the segmented executable header.<br>For each field, the offset is given relative to the beginning of the<br>segmented header, the size of the field is defined, and a description<br>is given.<br><br>&nbsp; &nbsp; Offset Size Description<br>&nbsp; &nbsp; ------ ---- -----------<br><br>&nbsp; &nbsp; 00h &nbsp; &nbsp; DW &nbsp;Signature word.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "N" is low-order byte.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "E" is high-order byte.<br><br>&nbsp; &nbsp; 02h &nbsp; &nbsp; DB &nbsp;Version number of the linker.<br><br>&nbsp; &nbsp; 03h &nbsp; &nbsp; DB &nbsp;Revision number of the linker.<br><br>&nbsp; &nbsp; 04h &nbsp; &nbsp; DW &nbsp;Entry Table file offset, relative to the beginning of<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the segmented EXE header.<br>&nbsp; &nbsp; 06h &nbsp; &nbsp; DW &nbsp;Number of bytes in the entry table.<br><br>&nbsp; &nbsp; 08h &nbsp; &nbsp; DD &nbsp;32-bit CRC of entire contents of file.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; These words are taken as 00 during the calculation.<br><br>&nbsp; &nbsp; 0Ch &nbsp; &nbsp; DW &nbsp;Flag word.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0000h = NOAUTODATA<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0001h = SINGLEDATA (Shared automatic data segment)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0002h = MULTIPLEDATA (Instanced automatic data<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segment)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2000h = Errors detected at link time, module will not<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; load.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8000h = Library module.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The SS:SP information is invalid, CS:IP points<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to an initialization procedure that is called<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with AX equal to the module handle. This<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initialization procedure must perform a far<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return to the caller, with AX not equal to<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zero to indicate success, or AX equal to zero<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to indicate failure to initialize. DS is set<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to the library's data segment if the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SINGLEDATA flag is set. Otherwise, DS is set<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to the caller's data segment.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A program or DLL can only contain dynamic<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; links to executable files that have this<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; library module flag set. One program cannot<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dynamic-link to another program.<br><br>&nbsp; &nbsp; 0Eh &nbsp; &nbsp; DW &nbsp;Segment number of automatic data segment.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This value is set to zero if SINGLEDATA and<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MULTIPLEDATA flag bits are clear, NOAUTODATA is<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; indicated in the flags word.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A Segment number is an index into the module's segment<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table. The first entry in the segment table is segment<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number 1.<br><br>&nbsp; &nbsp; 10h &nbsp; &nbsp; DW &nbsp;Initial size, in bytes, of dynamic heap added to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data segment. This value is zero if no initial local<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; heap is allocated.<br><br>&nbsp; &nbsp; 12h &nbsp; &nbsp; DW &nbsp;Initial size, in bytes, of stack added to the data<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segment. This value is zero to indicate no initial<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stack allocation, or when SS is not equal to DS.<br><br>&nbsp; &nbsp; 14h &nbsp; &nbsp; DD &nbsp;Segment number:offset of CS:IP.<br><br>&nbsp; &nbsp; 18h &nbsp; &nbsp; DD &nbsp;Segment number:offset of SS:SP.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If SS equals the automatic data segment and SP equals<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zero, the stack pointer is set to the top of the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; automatic data segment just below the additional heap<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; area.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +--------------------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | additional dynamic heap &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +--------------------------+ &lt;- SP<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp;additional stack &nbsp; &nbsp; &nbsp;|<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +--------------------------+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | loaded auto data segment |<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +--------------------------+ &lt;- DS, SS<br><br>&nbsp; &nbsp; 1Ch &nbsp; &nbsp; DW &nbsp;Number of entries in the Segment Table.<br><br>&nbsp; &nbsp; 1Eh &nbsp; &nbsp; DW &nbsp;Number of entries in the Module Reference Table.<br>&nbsp; &nbsp; 20h &nbsp; &nbsp; DW &nbsp;Number of bytes in the Non-Resident Name Table.<br><br>&nbsp; &nbsp; 22h &nbsp; &nbsp; DW &nbsp;Segment Table file offset, relative to the beginning<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of the segmented EXE header.<br><br>&nbsp; &nbsp; 24h &nbsp; &nbsp; DW &nbsp;Resource Table file offset, relative to the beginning<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of the segmented EXE header.<br><br>&nbsp; &nbsp; 26h &nbsp; &nbsp; DW &nbsp;Resident Name Table file offset, relative to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the segmented EXE header.<br><br>&nbsp; &nbsp; 28h &nbsp; &nbsp; DW &nbsp;Module Reference Table file offset, relative to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the segmented EXE header.<br><br>&nbsp; &nbsp; 2Ah &nbsp; &nbsp; DW &nbsp;Imported Names Table file offset, relative to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the segmented EXE header.<br><br>&nbsp; &nbsp; 2Ch &nbsp; &nbsp; DD &nbsp;Non-Resident Name Table offset, relative to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the file.<br><br>&nbsp; &nbsp; 30h &nbsp; &nbsp; DW &nbsp;Number of movable entries in the Entry Table.<br><br>&nbsp; &nbsp; 32h &nbsp; &nbsp; DW &nbsp;Logical sector alignment shift count, log(base 2) of<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the segment sector size (default 9).<br><br>&nbsp; &nbsp; 34h &nbsp; &nbsp; DW &nbsp;Number of resource entries.<br><br>&nbsp; &nbsp; 36h &nbsp; &nbsp; DB &nbsp;Executable type, used by loader.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 02h = WINDOWS<br><br>&nbsp; &nbsp; 37h-3Fh DB &nbsp;Reserved, currently 0's.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SEGMENT TABLE<br>======================================================================<br><br>The segment table contains an entry for each segment in the executable<br>file. The number of segment table entries are defined in the segmented<br>EXE header. The first entry in the segment table is segment number 1.<br>The following is the structure of a segment table entry.<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DW &nbsp; Logical-sector offset (n byte) to the contents of the segment<br>&nbsp; &nbsp; &nbsp; &nbsp; data, relative to the beginning of the file. Zero means no<br>&nbsp; &nbsp; &nbsp; &nbsp; file data.<br><br>&nbsp; &nbsp;DW &nbsp; Length of the segment in the file, in bytes. Zero means 64K.<br><br>&nbsp; &nbsp;DW &nbsp; Flag word.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0007h = TYPE_MASK &nbsp;Segment-type field.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0000h = CODE &nbsp; &nbsp; &nbsp; Code-segment type.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0001h = DATA &nbsp; &nbsp; &nbsp; Data-segment type.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0010h = MOVEABLE &nbsp; Segment is not fixed.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0040h = PRELOAD &nbsp; &nbsp;Segment will be preloaded; read-only if<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this is a data segment.<br>&nbsp; &nbsp; &nbsp; &nbsp; 0100h = RELOCINFO &nbsp;Set if segment has relocation records.<br>&nbsp; &nbsp; &nbsp; &nbsp; F000h = DISCARD &nbsp; &nbsp;Discard priority.<br><br>&nbsp; &nbsp;DW &nbsp; Minimum allocation size of the segment, in bytes. Total size<br>&nbsp; &nbsp; &nbsp; &nbsp; of the segment. Zero means 64K.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RESOURCE TABLE<br>======================================================================<br><br>The resource table follows the segment table and contains entries for<br>each resource in the executable file. The resource table consists of<br>an alignment shift count, followed by a table of resource records. The<br>resource records define the type ID for a set of resources. Each<br>resource record contains a table of resource entries of the defined<br>type. The resource entry defines the resource ID or name ID for the<br>resource. It also defines the location and size of the resource. The<br>following describes the contents of each of these structures:<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DW &nbsp; Alignment shift count for resource data.<br><br>&nbsp; &nbsp;A table of resource type information blocks follows. The following<br>&nbsp; &nbsp;is the format of each type information block:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Type ID. This is an integer type if the high-order bit is<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set (8000h); otherwise, it is an offset to the type string,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the offset is relative to the beginning of the resource<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table. A zero type ID marks the end of the resource type<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; information blocks.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Number of resources for this type.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DD &nbsp;Reserved.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; A table of resources for this type follows. The following is<br>&nbsp; &nbsp; &nbsp; &nbsp; the format of each resource (8 bytes each):<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;File offset to the contents of the resource data,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; relative to beginning of file. The offset is in terms<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of the alignment shift count value specified at<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the resource table.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Length of the resource in the file (in bytes).<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Flag word.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0010h = MOVEABLE &nbsp;Resource is not fixed.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0020h = PURE &nbsp; &nbsp; &nbsp;Resource can be shared.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0040h = PRELOAD &nbsp; Resource is preloaded.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Resource ID. This is an integer type if the high-order<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bit is set (8000h), otherwise it is the offset to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resource string, the offset is relative to the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginning of the resource table.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DD &nbsp;Reserved.<br><br>&nbsp; &nbsp;Resource type and name strings are stored at the end of the<br>&nbsp; &nbsp;resource table. Note that these strings are NOT null terminated and<br>&nbsp; &nbsp;are case sensitive.<br><br>&nbsp; &nbsp;DB &nbsp; Length of the type or name string that follows. A zero value<br>&nbsp; &nbsp; &nbsp; &nbsp; indicates the end of the resource type and name string, also<br>&nbsp; &nbsp; &nbsp; &nbsp; the end of the resource table.<br><br>&nbsp; &nbsp;DB &nbsp; ASCII text of the type or name string.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RESIDENT-NAME TABLE<br>======================================================================<br><br>The resident-name table follows the resource table, and contains this<br>module's name string and resident exported procedure name strings. The<br>first string in this table is this module's name. These name strings<br>are case-sensitive and are not null-terminated. The following<br>describes the format of the name strings:<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DB &nbsp; Length of the name string that follows. A zero value indicates<br>&nbsp; &nbsp; &nbsp; &nbsp; the end of the name table.<br><br>&nbsp; &nbsp;DB &nbsp; ASCII text of the name string.<br><br>&nbsp; &nbsp;DW &nbsp; Ordinal number (index into entry table). This value is ignored<br>&nbsp; &nbsp; &nbsp; &nbsp; for the module name.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MODULE-REFERENCE TABLE<br>======================================================================<br><br>The module-reference table follows the resident-name table. Each entry<br>contains an offset for the module-name string within the imported-<br>names table; each entry is 2 bytes long.<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DW &nbsp; Offset within Imported Names Table to referenced module name<br>&nbsp; &nbsp; &nbsp; &nbsp; string.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IMPORTED-NAME TABLE<br>======================================================================<br><br>The imported-name table follows the module-reference table. This table<br>contains the names of modules and procedures that are imported by the<br>executable file. Each entry is composed of a 1-byte field that<br>contains the length of the string, followed by any number of<br>characters. The strings are not null-terminated and are case<br>sensitive.<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DB &nbsp; Length of the name string that follows.<br><br>&nbsp; &nbsp;DB &nbsp; ASCII text of the name string.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENTRY TABLE<br>======================================================================<br><br>The entry table follows the imported-name table. This table contains<br>bundles of entry-point definitions. Bundling is done to save space in<br>the entry table. The entry table is accessed by an ordinal value.<br>Ordinal number one is defined to index the first entry in the entry<br>table. To find an entry point, the bundles are scanned searching for a<br>specific entry point using an ordinal number. The ordinal number is<br>adjusted as each bundle is checked. When the bundle that contains the<br>entry point is found, the ordinal number is multiplied by the size of<br>the bundle's entries to index the proper entry.<br><br>The linker forms bundles in the most dense manner it can, under the<br>restriction that it cannot reorder entry points to improve bundling.<br>The reason for this restriction is that other .EXE files may refer to<br>entry points within this bundle by their ordinal number. The following<br>describes the format of the entry table bundles.<br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DB &nbsp; Number of entries in this bundle. All records in one bundle<br>&nbsp; &nbsp; &nbsp; &nbsp; are either moveable or refer to the same fixed segment. A zero<br>&nbsp; &nbsp; &nbsp; &nbsp; value in this field indicates the end of the entry table.<br><br>&nbsp; &nbsp;DB &nbsp; Segment indicator for this bundle. This defines the type of<br>&nbsp; &nbsp; &nbsp; &nbsp; entry table entry data within the bundle. There are three<br>&nbsp; &nbsp; &nbsp; &nbsp; types of entries that are defined.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; 000h = Unused entries. There is no entry data in an unused<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bundle. The next bundle follows this field. This is<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;used by the linker to skip ordinal numbers.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; 001h-0FEh = Segment number for fixed segment entries. A fixed<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;segment entry is 3 bytes long and has the following<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;format.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Flag word.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 01h = Set if the entry is exported.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 02h = Set if the entry uses a global (shared) data<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segments.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The first assembly-language instruction in the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; entry point prologue must be "MOV AX,data<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segment number". This may be set only for<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SINGLEDATA library modules.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Offset within segment to entry point.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; 0FFH = Moveable segment entries. The entry data contains the<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;segment number for the entry points. A moveable segment<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;entry is 6 bytes long and has the following format.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Flag word.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 01h = Set if the entry is exported.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 02h = Set if the entry uses a global (shared) data<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segments.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INT 3FH.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Segment number.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Offset within segment to entry point.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NONRESIDENT-NAME TABLE<br>======================================================================<br><br>The nonresident-name table follows the entry table, and contains a<br>module description and nonresident exported procedure name strings.<br>The first string in this table is a module description. These name<br>strings are case-sensitive and are not null-terminated. The name<br>strings follow the same format as those defined in the resident name<br>table.<br><br><br>======================================================================<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PER SEGMENT DATA<br>======================================================================<br><br>The location and size of the per-segment data is defined in the<br>segment table entry for the segment. If the segment has relocation<br>fixups, as defined in the segment table entry flags, they directly<br>follow the segment data in the file. The relocation fixup information<br>is defined as follows:<br><br><br>&nbsp; &nbsp;Size Description<br>&nbsp; &nbsp;---- -----------<br><br>&nbsp; &nbsp;DW &nbsp; Number of relocation records that follow.<br><br>&nbsp; &nbsp;A table of relocation records follows. The following is the format<br>&nbsp; &nbsp;of each relocation record.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Source type.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0Fh = SOURCE_MASK<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 00h = LOBYTE<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 02h = SEGMENT<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 03h = FAR_ADDR (32-bit pointer)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 05h = OFFSET (16-bit offset)<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Flags byte.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 03h = TARGET_MASK<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 00h = INTERNALREF<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 01h = IMPORTORDINAL<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 02h = IMPORTNAME<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 03h = OSFIXUP<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 04h = ADDITIVE<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Offset within this segment of the source chain.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If the ADDITIVE flag is set, then target value is added to<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the source contents, instead of replacing the source and<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; following the chain. The source chain is an 0FFFFh<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; terminated linked list within this segment of all<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; references to the target.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; The target value has four types that are defined in the flag<br>&nbsp; &nbsp; &nbsp; &nbsp; byte field. The following are the formats for each target<br>&nbsp; &nbsp; &nbsp; &nbsp; type:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; INTERNALREF<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;Segment number for a fixed segment, or 0FFh for a<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; movable segment.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DB &nbsp;0<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Offset into segment if fixed segment, or ordinal<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number index into Entry Table if movable segment.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; IMPORTNAME<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Index into module reference table for the imported<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; module.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Offset within Imported Names Table to procedure name<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; IMPORTORDINAL<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Index into module reference table for the imported<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; module.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Procedure ordinal number.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; OSFIXUP<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;Operating system fixup type.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Floating-point fixups.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0001h = FIARQQ, FJARQQ<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0002h = FISRQQ, FJSRQQ<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0003h = FICRQQ, FJCRQQ<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0004h = FIERQQ<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0005h = FIDRQQ<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0006h = FIWRQQ<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DW &nbsp;0<br><br>======================================================================<br><br>Microsoft is a registered trademark and Windows is a trademark of<br>Microsoft Corporation.<br><br>Additional reference words: 3.0<br><br><br><br>2 PE format<br><br><br>&nbsp;PORTABLE EXECUTABLE FORMAT<br><br>&nbsp;Author: &nbsp;Micheal J. O'Leary<br><br><br>&nbsp;Preface<br>&nbsp;<br>&nbsp;This document was edited and released by Microsoft Developer<br>&nbsp;Support. It describes the binary portable executable format for NT.<br>&nbsp;The information is provided at this point because we feel it will<br>&nbsp;make the work of application development easier. Unfortunately, the<br>&nbsp;information in this document may change before the final release of<br>&nbsp;Windows NT. Microsoft is NOT committing to stay with these formats<br>&nbsp;by releasing this document. Questions or follow-ups for any of the<br>&nbsp;information presented here should be posted to CompuServe MSWIN32<br>&nbsp;forum, section 6.<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --Steve Firebaugh<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Microsoft Developer Support<br>&nbsp;<br>&nbsp;<br><br>Contents<br><br>&nbsp;1. Overview<br><br>&nbsp;2. PE Header<br><br>&nbsp;3. Object Table<br><br>&nbsp;4. Image Pages<br><br>&nbsp;5. Exports<br>&nbsp; &nbsp;5.1 Export Directory Table<br>&nbsp; &nbsp;5.2 Export Address Table<br>&nbsp; &nbsp;5.3 Export Name Table Pointers<br>&nbsp; &nbsp;5.4 Export Ordinal Table<br>&nbsp; &nbsp;5.5 Export Name Table<br><br>&nbsp;6. Imports<br>&nbsp; &nbsp;6.1 Import Directory Table<br>&nbsp; &nbsp;6.2 Import Lookup Table<br>&nbsp; &nbsp;6.3 Hint-Name Table<br>&nbsp; &nbsp;6.4 Import Address Table<br><br>&nbsp;7. Thread Local Storage<br>&nbsp; &nbsp;7.1 Thread Local Storage Directory Table<br>&nbsp; &nbsp;7.2 Thread Local Storage CallBack Table<br><br>&nbsp;8. Resources<br>&nbsp; &nbsp;8.1 Resource Directory Table<br>&nbsp; &nbsp;8.2 Resource Example<br><br>&nbsp;9. Fixup Table<br>&nbsp; &nbsp;9.1 Fixup Block<br><br>&nbsp;10. Debug Information<br>&nbsp; &nbsp;10.1 Debug Directory<br><br><br><br>1. Overview<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪目 &nbsp;&lt;哪? &lt;哪哪? Base of Image Header<br>&nbsp; &nbsp; ? DOS 2 Compatible ? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp;EXE Header &nbsp; &nbsp;? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇 &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;unused &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇 &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp;OEM Identifier &nbsp;? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp;OEM Info &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; ? &nbsp; DOS 2.0 Section<br>&nbsp; &nbsp; ? &nbsp; &nbsp;Offset to &nbsp; &nbsp; ? &nbsp; &nbsp; ? &nbsp; (for DOS compatibility only)<br>&nbsp; &nbsp; ? &nbsp; &nbsp;PE Header &nbsp; &nbsp; ? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇 &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; DOS 2.0 Stub &nbsp; ? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; Program &amp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; Reloc. Table &nbsp; ? &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇 &nbsp;&lt;哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;unused &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇 &nbsp;&lt;哪哪哪哪? Aligned on 8 byte boundary<br>&nbsp; &nbsp; ? &nbsp; &nbsp;PE Header &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇<br>&nbsp; &nbsp; ? &nbsp; Object Table &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拇<br>&nbsp; &nbsp; ? &nbsp; Image Pages &nbsp; &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; import info &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; export info &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; fixup info &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; resource info?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; debug info &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪馁<br>&nbsp; &nbsp; <br>Figure 1. A typical 32-bit Portable EXE File Layout<br><br><br><br>2. PE Header<br><br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪哪哪履哪哪哪哪哪哪履哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;SIGNATURE BYTES &nbsp; &nbsp; &nbsp;? &nbsp;CPU TYPE &nbsp; ? &nbsp;# OBJECTS &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪聊哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; TIME/DATE STAMP &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪履哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp;NT HDR SIZE? &nbsp; &nbsp;FLAGS &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪履哪哪穆哪哪哪拍哪哪哪哪哪哪聊哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;RESERVED &nbsp; 矻MAJOR矻MINOR? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪聊哪哪牧哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; ENTRYPOINT RVA &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;IMAGE BASE &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; OBJECT ALIGN &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; &nbsp; &nbsp;FILE ALIGN &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪履哪哪哪哪哪哪拍哪哪哪哪哪哪履哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;OS MAJOR &nbsp; ? &nbsp;OS MINOR &nbsp; 砋SER MAJOR &nbsp; 砋SER MINOR &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪拍哪哪哪哪哪哪拍哪哪哪哪哪哪聊哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? SUBSYS MAJOR? SUBSYS MINOR? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪聊哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;IMAGE SIZE &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; HEADER SIZE &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪履哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; FILE CHECKSUM &nbsp; &nbsp; &nbsp; ? &nbsp;SUBSYSTEM &nbsp;? &nbsp;DLL FLAGS &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪聊哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; STACK RESERVE SIZE &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; STACK COMMIT SIZE &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; HEAP RESERVE SIZE &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; HEAP COMMIT SIZE &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp;# INTERESTING RVA/SIZES &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; EXPORT TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; TOTAL EXPORT DATA SIZE &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; IMPORT TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; TOTAL IMPORT DATA SIZE &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;RESOURCE TABLE RVA &nbsp; &nbsp; &nbsp; ? &nbsp;TOTAL RESOURCE DATA SIZE ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;EXCEPTION TABLE RVA &nbsp; &nbsp; &nbsp;? &nbsp;TOTAL EXCEPTION DATA SIZE?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;SECURITY TABLE RVA &nbsp; &nbsp; &nbsp; ? &nbsp;TOTAL SECURITY DATA SIZE ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp;FIXUP TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp;TOTAL FIXUP DATA SIZE &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp;DEBUG TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp;TOTAL DEBUG DIRECTORIES &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;IMAGE DESCRIPTION RVA &nbsp; &nbsp;? &nbsp;TOTAL DESCRIPTION SIZE &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; MACHINE SPECIFIC RVA &nbsp; &nbsp;? &nbsp; MACHINE SPECIFIC SIZE &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;THREAD LOCAL STORAGE RVA ? &nbsp; &nbsp; &nbsp;TOTAL TLS SIZE &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 2. PE Header<br><br>Notes:<br><br>&nbsp; o &nbsp;A VA is a virtual address that is already biased by the Image<br>&nbsp; &nbsp; &nbsp;Base found in the PE Header. &nbsp;A RVA is a virtual address that is<br>&nbsp; &nbsp; &nbsp;relative to the Image Base.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;An RVA in the PE Header which has a value of zero indicates the<br>&nbsp; &nbsp; &nbsp;field isn't used.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;Image pages are aligned and zero padded to a File Align<br>&nbsp; &nbsp; &nbsp;boundary. &nbsp;The bases of all other tables and structures must be<br>&nbsp; &nbsp; &nbsp;aligned on DWORD (4 byte) boundary. &nbsp;Thus, all VA's and RVA's<br>&nbsp; &nbsp; &nbsp;must be on a 32 bit boundary. All table and structure fields<br>&nbsp; &nbsp; &nbsp;must be aligned on their "natural" boundaries, with the possible<br>&nbsp; &nbsp; &nbsp;exception of the Debug Info.<br>&nbsp; &nbsp; &nbsp;<br>SIGNATURE BYTES = DB * 4.<br>Current value is "PE/0/0". Thats PE followed by two zeros (nulls).<br><br>CPU TYPE = DW CPU Type.<br>This field specifies the type of CPU compatibility required by this<br>image to run. &nbsp;The values are:<br><br>&nbsp; o &nbsp;0000h __unknown<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;014Ch __80386<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;014Dh __80486<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;014Eh __80586<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0162h __MIPS Mark I (R2000, R3000)<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0163h __MIPS Mark II (R6000)<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0166h __MIPS Mark III (R4000)<br>&nbsp; &nbsp; &nbsp;<br># OBJECTS = DW Number of object entries.<br>This field specifies the number of entries in the Object Table.<br><br>TIME/DATE STAMP = DD Used to store the time and date the file was<br>created or modified by the linker.<br><br>NT HDR SIZE = DW This is the number of remaining bytes in the NT<br>header that follow the FLAGS field.<br><br>FLAGS = DW Flag bits for the image.<br>The flag bits have the following definitons:<br><br>&nbsp; o &nbsp;0000h __Program image.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0002h __Image is executable.<br>&nbsp; &nbsp; &nbsp;If this bit isn't set, then it indicates that either errors<br>&nbsp; &nbsp; &nbsp;where detected at link time or that the image is being<br>&nbsp; &nbsp; &nbsp;incrementally linked and therefore can't be loaded.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0200h __Fixed.<br>&nbsp; &nbsp; &nbsp;Indicates that if the image can't be loaded at the Image Base,<br>&nbsp; &nbsp; &nbsp;then don't load it.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;2000h __Library image.<br>&nbsp; &nbsp; &nbsp;<br>LMAJOR/LMINOR = DB Linker major/minor version number.<br><br>ENTRYPOINT RVA = DD Entrypoint relative virtual address.<br>The address is relative to the Image Base. &nbsp;The address is the<br>starting address for program images and the library initialization<br>and library termination address for library images.<br><br>IMAGE BASE = DD The virtual base of the image.<br>This will be the virtual address of the first byte of the file (Dos<br>Header). &nbsp;This must be a multiple of 64K.<br><br>OBJECT ALIGN = DD The alignment of the objects. This must be a power<br>of 2 between 512 and 256M inclusive. The default is 64K.<br><br>FILE ALIGN = DD Alignment factor used to align image pages. &nbsp;The<br>alignment factor (in bytes) used to align the base of the image pages<br>and to determine the granularity of per-object trailing zero pad.<br>Larger alignment factors will cost more file space; smaller alignment<br>factors will impact demand load performance, perhaps significantly.<br>Of the two, wasting file space is preferable. &nbsp;This value should be a<br>power of 2 between 512 and 64K inclusive.<br><br>OS MAJOR/MINOR = DW OS version number required to run this image.<br><br>USER MAJOR/MINOR # = DW User major/minor version number.<br>This is useful for differentiating between revisions of<br>images/dynamic linked libraries. &nbsp;The values are specified at link<br>time by the user.<br><br>SUBSYS MAJOR/MINOR # = DW Subsystem major/minor version number.<br><br>IMAGE SIZE = DD The virtual size (in bytes) of the image.<br>This includes all headers. &nbsp;The total image size must be a multiple<br>of Object Align.<br><br>HEADER SIZE = DD Total header size.<br>The combined size of the Dos Header, PE Header and Object Table.<br><br>FILE CHECKSUM = DD Checksum for entire file. &nbsp;Set to 0 by the linker.<br><br>SUBSYSTEM = DW NT Subsystem required to run this image.<br>The values are:<br><br>&nbsp; o &nbsp;0000h __Unknown<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0001h __Native<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0002h __Windows GUI<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0003h __Windows Character<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0005h __OS/2 Character<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0007h __Posix Character<br>&nbsp; &nbsp; &nbsp;<br>DLL FLAGS = DW Indicates special loader requirements.<br>This flag has the following bit values:<br><br>&nbsp; o &nbsp;0001h __Per-Process Library Initialization.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0002h __Per-Process Library Termination.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0004h __Per-Thread Library Initialization.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0008h __Per-Thread Library Termination.<br>&nbsp; &nbsp; &nbsp;<br>All other bits are reserved for future use and should be set to zero.<br><br>STACK RESERVE SIZE = DD Stack size needed for image.<br>The memory is reserved, but only the STACK COMMIT SIZE is committed.<br>The next page of the stack is a 'guarded page'. When the application<br>hits the guarded page, the guarded page becomes valid, and the next<br>page becomes the guarded page. This continues until the RESERVE SIZE<br>is reached.<br><br>STACK COMMIT SIZE = DD Stack commit size.<br><br>HEAP RESERVE SIZE = DD Size of local heap to reserve.<br><br>HEAP COMMIT SIZE = DD Amount to commit in local heap.<br><br># INTERESTING VA/SIZES = DD Indicates the size of the VA/SIZE array<br>that follows.<br><br>EXPORT TABLE RVA = DD &nbsp;Relative Virtual Address of the Export Table.<br>This address is relative to the Image Base.<br><br>IMPORT TABLE RVA = DD &nbsp;Relative Virtual Address of the Import Table.<br>This address is relative to the Image Base.<br><br>RESOURCE TABLE RVA = DD &nbsp;Relative Virtual Address of the Resource<br>Table. This address is relative to the Image Base.<br><br>EXCEPTION TABLE RVA = DD &nbsp;Relative Virtual Address of the Exception<br>Table. This address is relative to the Image Base.<br><br>SECURITY TABLE RVA = DD &nbsp;Relative Virtual Address of the Security<br>Table. This address is relative to the Image Base.<br><br>FIXUP TABLE RVA = DD &nbsp;Relative Virtual Address of the Fixup Table.<br>This address is relative to the Image Base.<br><br>DEBUG TABLE RVA = DD &nbsp;Relative Virtual Address of the Debug Table.<br>This address is relative to the Image Base.<br><br>IMAGE DESCRIPTION RVA = DD &nbsp;Relative Virtual Address of the<br>description string specified in the module definiton file.<br><br>MACHINE SPECIFIC RVA = DD &nbsp;Relative Virtual Address of a machine<br>specific value. This address is relative to the Image Base.<br><br>TOTAL EXPORT DATA SIZE = DD &nbsp;Total size of the export data.<br><br>TOTAL IMPORT DATA SIZE = DD &nbsp;Total size of the import data.<br><br>TOTAL RESOURCE DATA SIZE = DD &nbsp;Total size of the resource data.<br><br>TOTAL EXCEPTION DATA SIZE = DD &nbsp;Total size of the exception data.<br><br>TOTAL SECURITY DATA SIZE = DD &nbsp;Total size of the security data.<br><br>TOTAL FIXUP DATA SIZE = DD &nbsp;Total size of the fixup data.<br><br>TOTAL DEBUG DIRECTORIES = DD &nbsp;Total number of debug directories.<br><br>TOTAL DESCRIPTION SIZE = DD &nbsp;Total size of the description data.<br><br>MACHINE SPECIFIC SIZE = DD &nbsp;A machine specific value.<br><br><br><br>3. Object Table<br><br>The number of entries in the Object Table is given by the # Objects<br>field in the PE Header. &nbsp;Entries in the Object Table are numbered<br>starting from one. &nbsp;The object table immediately follows the PE<br>Header. &nbsp;The code and data memory object entries are in the order<br>chosen by the linker. &nbsp;The virtual addresses for objects must be<br>assigned by the linker such that they are in ascending order and<br>adjacent, and must be a multiple of Object Align in the PE header.<br><br>Each Object Table entry has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OBJECT NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; VIRTUAL SIZE &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;PHYSICAL SIZE &nbsp; &nbsp; &nbsp; &nbsp;? &nbsp; &nbsp; &nbsp;PHYSICAL OFFSET &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; OBJECT FLAGS &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 3. &nbsp;Object Table<br><br>OBJECT NAME = DB * 8 &nbsp;Object name. This is an eight-byte null-padded<br>ASCII string representing the object name.<br><br>VIRTUAL SIZE = DD Virtual memory size. &nbsp;The size of the object that<br>will be allocated when the object is loaded. Any difference between<br>PHYSICAL SIZE and VIRTUAL SIZE is zero filled.<br><br>RVA = DD Relative Virtual Address. &nbsp;The virtual address the object is<br>currently relocated to, relative to the Image Base. &nbsp;Each Object's<br>virtual address space consumes a multiple of Object Align (power of 2<br>between 512 and 256M inclusive. Default is 64K), and immediately<br>follows the previous Object in the virtual address space (the virtual<br>address space for a image must be dense).<br><br>PHYSICAL SIZE = DD Physical file size of initialized data. &nbsp;The size<br>of the initialized data in the file for the object. &nbsp;The physical<br>size must be a multiple of the File Align field in the PE Header, and<br>must be less than or equal to the Virtual Size.<br><br>PHYSICAL OFFSET = DD Physical offset for object's first page. &nbsp;This<br>offset is relative to beginning of the EXE file, and is aligned on a<br>multiple of the File Align field in the PE Header. &nbsp;The offset is<br>used as a seek value.<br><br>OBJECT FLAGS = DD Flag bits for the object. &nbsp;The object flag bits<br>have the following definitions:<br><br>&nbsp; o &nbsp;000000020h __Code object.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;000000040h __Initialized data object.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;000000080h __Uninitialized data object.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;040000000h __Object must not be cached.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;080000000h __Object is not pageable.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;100000000h __Object is shared.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;200000000h __Executable object.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;400000000h __Readable object.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;800000000h __Writeable object.<br>&nbsp; &nbsp; &nbsp;<br>All other bits are reserved for future use and should be set to zero.<br><br>4. Image Pages<br><br>The Image Pages section contains all initialized data for all<br>objects. &nbsp;The seek offset for the first page in each object is<br>specified in the object table and is aligned on a File Align<br>boundary. &nbsp;The objects are ordered by the RVA. &nbsp;Every object begins<br>on a multiple of Object Align.<br><br><br><br>5. Exports<br><br>A typical file layout for the export information follows:<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; DIRECTORY TABLE &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; ADDRESS TABLE &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; NAME PTR TABLE &nbsp; &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; ORDINAL TABLE &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; NAME STRINGS &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 4. &nbsp;Export File Layout<br><br>5.1 Export Directory Table<br><br>The export information begins with the Export Directory Table which<br>describes the remainder of the export information. &nbsp;The Export<br>Directory Table contains address information that is used to resolve<br>fixup references to the entry points within this image.<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXPORT FLAGS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TIME/DATE STAMP &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;MAJOR VERSION &nbsp;? &nbsp; MINOR VERSION ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NAME RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ORDINAL BASE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # EAT ENTRIES &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# NAME PTRS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; ADDRESS TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;NAME PTR TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; ORDINAL TABLE RVA &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 5. &nbsp;Export Directory Table Entry<br><br>EXPORT FLAGS = DD Currently set to zero.<br><br>TIME/DATE STAMP = DD Time/Date the export data was created.<br><br>MAJOR/MINOR VERSION = DW &nbsp;A user settable major/minor version number.<br><br>NAME RVA = DD Relative Virtual Address of the Dll asciiz Name.<br>This is the address relative to the Image Base.<br><br>ORDINAL BASE = DD First valid exported ordinal.<br>This field specifies the starting ordinal number for the export<br>address table for this image. &nbsp;Normally set to 1.<br><br># EAT ENTRIES = DD Indicates number of entries in the Export Address<br>Table.<br><br># NAME PTRS = DD This indicates the number of entries in the Name Ptr<br>Table (and parallel Ordinal Table).<br><br>ADDRESS TABLE RVA = DD Relative Virtual Address of the Export Address<br>Table.<br>This address is relative to the Image Base.<br><br>NAME TABLE RVA = DD Relative Virtual Address of the Export Name Table<br>Pointers.<br>This address is relative to the beginning of the Image Base. &nbsp;This<br>table is an array of RVA's with # NAMES entries.<br><br>ORDINAL TABLE RVA = DD Relative Virtual Address of Export Ordinals<br>Table Entry.<br>This address is relative to the beginning of the Image Base.<br><br>5.2 Export Address Table<br><br>The Export Address Table contains the address of exported entrypoints<br>and exported data and absolutes. &nbsp;An ordinal number is used to index<br>the Export Address Table. The ORDINAL BASE must be subracted from the<br>ordinal number before indexing into this table.<br><br>Export Address Table entry formats are described below:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EXPORTED RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 6. &nbsp;Export Address Table Entry<br><br>EXPORTED RVA = DD Export address.<br>This field contains the relative virtual address of the exported<br>entry (relative to the Image Base).<br><br>5.3 Export Name Table Pointers<br><br>The export name table pointers array contains address into the Export<br>Name Table. &nbsp;The pointers are 32-bits each, and are relative to the<br>Image Base. &nbsp;The pointers are ordered lexically to allow binary<br>searches.<br><br>5.4 Export Ordinal Table<br><br>The Export Name Table Pointers and the Export Ordinal Table form two<br>parallel arrays, separated to allow natural field alignment. &nbsp;The<br>export ordinal table array contains the Export Address Table ordinal<br>numbers associated with the named export referenced by corresponding<br>Export Name Table Pointers.<br><br>The ordinals are 16-bits each, and already include the Ordinal Base<br>stored in the Export Directory Table.<br><br>5.5 Export Name Table<br><br>The export name table contains optional ASCII names for exported<br>entries in the image. &nbsp;These tables are used with the array of Export<br>Name Table Pointers and the array of Export Ordinals to translate a<br>procedure name string into an ordinal number by searching for a<br>matching name string. &nbsp;The ordinal number is used to locate the entry<br>point information in the export address table.<br><br>Import references by name require the Export Name Table Pointers<br>table to be binary searched to find the matching name, then the<br>corresponding Export Ordinal Table is known to contain the entry<br>point ordinal number. &nbsp;Import references by ordinal number provide<br>the fastest lookup since searching the name table is not required.<br><br>Each name table entry has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? ASCII STRING ::: :::::::: &nbsp; '/0' &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 7. &nbsp;Export Name Table Entry<br><br>ASCII STRING = DB ASCII String.<br>The string is case sensitive and is terminated by a null byte.<br><br><br><br>6. Imports<br><br>A typical file layout for the import information follows:<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; DIRECTORY TABLE &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp;NULL DIR ENTRY &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; DLL1 LOOKUP TABLE &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; DLL2 LOOKUP TABLE &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; Dll3 LOOKUP TABLE &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp;HINT-NAME TABLE &nbsp; &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; DLL1 ADDRESS TABLE &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; DLL2 ADDRESS TABLE &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; DLL3 ADDRESS TABLE &nbsp;?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 8. &nbsp;Import File Layout<br><br>6.1 Import Directory Table<br><br>The import information begins with the Import Directory Table which<br>describes the remainder of the import information. &nbsp;The Import<br>Directory Table contains address information that is used to resolve<br>fixup references to the entry points within a DLL image. &nbsp;The import<br>directory table consists of an array of Import Directory Entries, one<br>entry for each DLL this image references. The last directory entry is<br>empty (NULL) which indicates the end of the directory table.<br><br>An Import Directory Entry has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IMPORT FLAGS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TIME/DATE STAMP &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;MAJOR VERSION &nbsp;? &nbsp; MINOR VERSION ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NAME RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;IMPORT LOOKUP TABLE RVA &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;IMPORT ADDRESS TABLE RVA &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 9. &nbsp;Import Directory Entry<br><br>IMPORT FLAGS = DD Currently set to zero.<br><br>TIME/DATE STAMP = DD Time/Date the import data was pre-snapped or<br>zero if not pre-snapped.<br><br>MAJOR/MINOR VERSION = DW &nbsp;The major/minor version number of the dll<br>being referenced.<br><br>NAME RVA = DD Relative Virtual Address of the Dll asciiz Name.<br>This is the address relative to the Image Base.<br><br>IMPORT LOOKUP TABLE RVA = DD This field contains the address of the<br>start of the import lookup table for this image. &nbsp;The address is<br>relative to the beginning of the Image Base.<br><br>IMPORT ADDRESS TABLE RVA = DD This field contains the address of the<br>start of the import addresses for this image. &nbsp;The address is<br>relative to the beginning of the Image Base.<br><br>6.2 Import Lookup Table<br><br>The Import Lookup Table is an array of ordinal or hint/name RVA's for<br>each DLL. The last entry is empty (NULL) which indicates the end of<br>the table.<br><br>The last element is empty.<br><br>&nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br>&nbsp; &nbsp; &nbsp;1<br>&nbsp; &nbsp; 谀夷哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ?0? &nbsp; ORDINAL#/HINT-NAME TABLE RVA &nbsp;?<br>&nbsp; &nbsp; 滥心哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 10. &nbsp;Import Address Table Format<br><br>ORDINAL/HINT-NAME TABLE RVA = 31-bits (mask = 7fffffffh) Ordinal<br>Number or Name Table RVA.<br>If the import is by ordinal, this field contains a 31 bit ordinal<br>number. &nbsp;If the import is by name, this field contains a 31 bit<br>address relative to the Image Base to the Hint-Name Table.<br><br>O = 1-bit (mask = 80000000h) Import by ordinal flag.<br><br>&nbsp; o &nbsp;00000000h __Import by name.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;80000000h __Import by ordinal.<br>&nbsp; &nbsp; &nbsp;<br>6.3 Hint-Name Table<br><br>The Hint-Name Table format follows:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; HINT &nbsp; &nbsp; &nbsp;? ASCII STRING |||?<br>&nbsp; &nbsp; 媚哪哪哪呐哪哪哪哪拍哪哪哪呐哪哪哪哪?<br>&nbsp; &nbsp; 硘||||||||||||||||? &nbsp;'/0' &nbsp; &nbsp; PAD &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; The PAD field is optional.<br>&nbsp; &nbsp; <br>Figure 11. &nbsp;Import Hint-Name Table<br><br>HINT = DW Hint into Export Name Table Pointers.<br>The hint value is used to index the Export Name Table Pointers array,<br>allowing faster by-name imports. &nbsp;If the hint is incorrect, then a<br>binary search is performed on the Export Name Ptr Table.<br><br>ASCII STRING = DB ASCII String.<br>The string is case sensitive and is terminated by a null byte.<br><br>PAD = DB Zero pad byte.<br>A trailing zero pad byte appears after the trailing null byte if<br>necessary to align the next entry on an even boundary.<br><br>The loader overwrites the import address table when loading the image<br>with the 32-bit address of the import.<br><br><br><br>6.4 Import Address Table<br><br>The Import Address Table is an array of addresses of the imported<br>routines for each DLL. The last entry is empty (NULL) which indicates<br>the end of the table.<br><br>7. Thread Local Storage<br><br>Thread local storage is a special contiguous block of data. Each<br>thread will gets its own block upon creation of the thread.<br><br>The file layout for thread local storage follows:<br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; DIRECTORY TABLE &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;TLS DATA &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp;INDEX VARIABLE &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; CALLBACK ADDRESSES &nbsp;?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br><br>Figure 12. &nbsp;Thread Local Storage Layout<br><br>7.1 Thread Local Storage Directory Table<br><br>The Thread Local Storage Directory Table contains address information<br>that is used to describe the rest of TLS.<br><br>The Thread Local Storage Directory Table has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; START DATA BLOCK VA &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp;END DATA BLOCK VA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INDEX VA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; CALLBACK TABLE VA &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 13. &nbsp;Thread Local Storage Directory Table<br><br>START DATA BLOCK VA = DD Virtual Address of the start of the thread<br>local storage data block.<br><br>END DATA BLOCK VA = DD Virtual Address of the end of the thread local<br>storage data block.<br><br>INDEX VA = DD &nbsp;Virtual Address of the index variable used to access<br>the thread local storage data block.<br><br>CALLBACK TABLE VA = DD Virtual Address of the callback table.<br><br>7.2 Thread Local Storage CallBack Table<br><br>The Thread Local Storage Callbacks is an array of Virtual Address of<br>functions to be called by the loader after thread creation and thread<br>termination. The last entry is empty (NULL) which indicates the end<br>of the table.<br><br>The Thread Local Storage CallBack Table has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FUNCTION1 VA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FUNCTION2 VA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 14. &nbsp;Thread Local Storage CallBack Table<br><br>8. Resources<br><br>Resources are indexed by a multiple level binary-sorted tree<br>structure. &nbsp;The overall design can incorporate 2**31 levels, however,<br>NT uses only three: &nbsp;the highest is TYPE, then NAME, then LANGUAGE.<br><br>A typical file layout for the resource information follows:<br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;RESOURCE DIRECTORY &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; RESOURCE DATA &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 15. &nbsp;Resource File Layout<br><br><br>The Resource directory is made up of the following tables:<br><br><br><br>8.1 Resource Directory Table<br>谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RESOURCE FLAGS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TIME/DATE STAMP &nbsp; &nbsp; &nbsp; &nbsp; ?<br>媚哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪?<br>? &nbsp;MAJOR VERSION &nbsp;? &nbsp; MINOR VERSION ?<br>媚哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪?<br>? &nbsp; &nbsp;# NAME ENTRY ? &nbsp;# ID ENTRY &nbsp; &nbsp; ?<br>媚哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp; RESOURCE DIR ENTRIES &nbsp; &nbsp; &nbsp; &nbsp;?<br>滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br><br>Figure 16. &nbsp;Resource Table Entry<br><br><br>RESOURCE FLAGS = DD Currently set to zero.<br><br>TIME/DATE &nbsp;STAMP = DD Time/Date the resource data was created by the<br>resource compiler.<br><br>MAJOR/MINOR VERSION = DW &nbsp;A user settable major/minor version number.<br><br># NAME ENTRY = DW The number of name entries.<br>This field contains the number of entries at the beginning of the<br>array of directory entries which have actual string names associated<br>with them.<br><br># ID ENTRY = DW The number of ID integer entries.<br>This field contains the number of 32-bit integer IDs as their names<br>in the array of directory entries.<br><br>The resource directory is followed by a variable length array of<br>directory entries. &nbsp;# NAME ENTRY is the number of entries at the<br>beginning of the array that have actual names associated with each<br>entry. &nbsp;The entires are in ascending order, case insensitive strings.<br># ID ENTRY identifies the number of entries that have 32-bit integer<br>IDs as their name. &nbsp;These entries are also sorted in ascending order.<br><br>This structure allows fast lookup by either name or number, but for<br>any given resource entry only one form of lookup is supported, not<br>both. This is consistent with the syntax of the .RC file and the .RES<br>file.<br><br><br><br>The array of directory entries have the following format:<br>&nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br>&nbsp;1<br>谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp; &nbsp; NAME RVA/INTEGER ID &nbsp; &nbsp; &nbsp; ?<br>媚夷哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>矱? &nbsp; &nbsp; DATA ENTRY RVA/SUBDIR RVA &nbsp; ?<br>滥心哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br><br>Figure 17. &nbsp;Resource Directory Entry<br><br><br>INTERGER ID = DD ID.<br>This field contains a integer ID field to identify a resource.<br><br>NAME RVA = DD Name RVA address.<br>This field contains a 31-bit address relative to the beginning of the<br>Image Base to a Resource Directory String Entry.<br><br>E = 1-bit (mask 80000000h) Unescape bit.<br>This bit is zero for unescaped Resource Data Entries.<br><br>DATA RVA = 31-bits (mask 7fffffffh) Data entry address.<br>This field contains a 31-bit address relative to the beginning of the<br>Image Base to a Resource Data Entry.<br><br>E = 1-bit (mask 80000000h) Escape bit.<br>This bit is 1 for escaped Subdirectory Entry.<br><br>DATA RVA = 31-bits (mask 7fffffffh) Directory entries.<br>This field contains a 31-bit address relative to the beginning of the<br>Image Base to Subdirectory Entry.<br><br><br><br>Each resource directory string entry has the following format:<br>谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp;LENGTH &nbsp; &nbsp; ? UNICODE STRING &nbsp;?<br>媚哪哪哪呐哪哪哪哪拍哪哪哪呐哪哪哪哪?<br>? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br><br>Figure 18. &nbsp;Resource Directory String Entry<br><br><br>LENGTH = DW Length of string.<br><br>UNICODE STRING = DW UNICODE String.<br><br>All of these string objects are stored together after the last<br>resource directory entry and before the first resource data object.<br>This minimizes the impact of these variable length objects on the<br>alignment of the fixed size directory entry objects. The length needs<br>to be word aligned.<br><br><br><br>Each Resource Data Entry has the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DATA RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SIZE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CODEPAGE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RESERVED &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 19. &nbsp;Resource Data Entry<br><br><br><br>DATA RVA = DD Address of Resource Data.<br>This field contains 32-bit virtaul address of the resource data<br>(relative to the Image Base).<br><br>SIZE = DD Size of Resource Data.<br>This field contains the size of the resource data for this resource.<br><br>CODEPAGE = DD Codepage.<br><br>RESERVED = DD Reserved - must be zero.<br><br>Each resource data entry describes a leaf node in the resource<br>directory tree. &nbsp;It contains an address which is &nbsp;relative to the<br>beginning of Image Base, a size field that gives the number of bytes<br>of data at that address, a CodePage that should be used when decoding<br>code point values within the resource data. &nbsp;Typically for new<br>applications the code page would be the unicode code page.<br><br><br><br>8.2 Resource Example<br><br>The following is an example for an app. which wants to use the following data<br>as resources:<br><br>&nbsp; TypeId# &nbsp; &nbsp;NameId# &nbsp; Language ID Resource Data<br>&nbsp;00000001 &nbsp; &nbsp;00000001 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00010001<br>&nbsp;00000001 &nbsp; &nbsp;00000001 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp;10010001<br>&nbsp;00000001 &nbsp; &nbsp;00000002 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00010002<br>&nbsp;00000001 &nbsp; &nbsp;00000003 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00010003<br>&nbsp;00000002 &nbsp; &nbsp;00000001 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00020001<br>&nbsp;00000002 &nbsp; &nbsp;00000002 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00020002<br>&nbsp;00000002 &nbsp; &nbsp;00000003 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00020003<br>&nbsp;00000002 &nbsp; &nbsp;00000004 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00020004<br>&nbsp;00000009 &nbsp; &nbsp;00000001 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00090001<br>&nbsp;00000009 &nbsp; &nbsp;00000009 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp;00090009<br>&nbsp;00000009 &nbsp; &nbsp;00000009 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp;10090009<br>&nbsp;00000009 &nbsp; &nbsp;00000009 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; &nbsp;20090009<br><br>Then the Resource Directory in the Portable format looks like:<br>Offset &nbsp; &nbsp; &nbsp; &nbsp; Data<br>0000: &nbsp; 00000000 00000000 00000000 00030000 &nbsp;(3 entries in this directory)<br>0010: &nbsp; 00000001 80000028 &nbsp; &nbsp; (TypeId #1, Subdirectory at offset 0x28)<br>0018: &nbsp; 00000002 80000050 &nbsp; &nbsp; (TypeId #2, Subdirectory at offset 0x50)<br>0020: &nbsp; 00000009 80000080 &nbsp; &nbsp; (TypeId #9, Subdirectory at offset 0x80)<br>0028: &nbsp; 00000000 00000000 00000000 00030000 &nbsp;(3 entries in this directory)<br>0038: &nbsp; 00000001 800000A0 &nbsp; &nbsp; (NameId #1, Subdirectory at offset 0xA0)<br>0040: &nbsp; 00000002 00000108 &nbsp; &nbsp; (NameId #2, data desc at offset 0x108)<br>0048: &nbsp; 00000003 00000118 &nbsp; &nbsp; (NameId #3, data desc at offset 0x118)<br>0050: &nbsp; 00000000 00000000 00000000 00040000 &nbsp;(4 entries in this directory)<br>0060: &nbsp; 00000001 00000128 &nbsp; &nbsp; (NameId #1, data desc at offset 0x128)<br>0068: &nbsp; 00000002 00000138 &nbsp; &nbsp; (NameId #2, data desc at offset 0x138)<br>0070: &nbsp; 00000003 00000148 &nbsp; &nbsp; (NameId #3, data desc at offset 0x148)<br>0078: &nbsp; 00000004 00000158 &nbsp; &nbsp; (NameId #4, data desc at offset 0x158)<br>0080: &nbsp; 00000000 00000000 00000000 00020000 &nbsp;(2 entries in this directory)<br>0090: &nbsp; 00000001 00000168 &nbsp; &nbsp; (NameId #1, data desc at offset 0x168)<br>0098: &nbsp; 00000009 800000C0 &nbsp; &nbsp; (NameId #9, Subdirectory at offset 0xC0)<br>00A0: &nbsp; 00000000 00000000 00000000 00020000 &nbsp;(2 entries in this directory)<br>00B0: &nbsp; 00000000 000000E8 &nbsp; &nbsp; (Language ID 0, data desc at offset 0xE8<br>00B8: &nbsp; 00000001 000000F8 &nbsp; &nbsp; (Language ID 1, data desc at offset 0xF8<br>00C0: &nbsp; 00000000 00000000 00000000 00030000 &nbsp;(3 entries in this directory)<br>00D0: &nbsp; 00000001 00000178 &nbsp; &nbsp; (Language ID 0, data desc at offset 0x178<br>00D8: &nbsp; 00000001 00000188 &nbsp; &nbsp; (Language ID 1, data desc at offset 0x188<br>00E0: &nbsp; 00000001 00000198 &nbsp; &nbsp; (Language ID 2, data desc at offset 0x198<br><br>00E8: &nbsp; 000001A8 &nbsp;(At offset 0x1A8, for TypeId #1, NameId #1, Language id #0<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>00F8: &nbsp; 000001AC &nbsp;(At offset 0x1AC, for TypeId #1, NameId #1, Language id #1<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0108: &nbsp; 000001B0 &nbsp;(At offset 0x1B0, for TypeId #1, NameId #2,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0118: &nbsp; 000001B4 &nbsp;(At offset 0x1B4, for TypeId #1, NameId #3,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0128: &nbsp; 000001B8 &nbsp;(At offset 0x1B8, for TypeId #2, NameId #1,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0138: &nbsp; 000001BC &nbsp;(At offset 0x1BC, for TypeId #2, NameId #2,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0148: &nbsp; 000001C0 &nbsp;(At offset 0x1C0, for TypeId #2, NameId #3,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0158: &nbsp; 000001C4 &nbsp;(At offset 0x1C4, for TypeId #2, NameId #4,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0168: &nbsp; 000001C8 &nbsp;(At offset 0x1C8, for TypeId #9, NameId #1,<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0178: &nbsp; 000001CC &nbsp;(At offset 0x1CC, for TypeId #9, NameId #9, Language id #0<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0188: &nbsp; 000001D0 &nbsp;(At offset 0x1D0, for TypeId #9, NameId #9, Language id #1<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br>0198: &nbsp; 000001D4 &nbsp;(At offset 0x1D4, for TypeId #9, NameId #9, Language id #2<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000004 &nbsp;(4 bytes of data)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(codepage)<br>&nbsp; &nbsp; &nbsp; &nbsp; 00000000 &nbsp;(reserved)<br><br>And the data for the resources will look like:<br>01A8: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00010001<br>01AC: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10010001<br>01B0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00010002<br>01B4: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00010003<br>01B8: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00020001<br>01BC: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00020002<br>01C0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00020003<br>01C4: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00020004<br>01C8: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00090001<br>01CC: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00090009<br>01D0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10090009<br>01D4: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;20090009<br><br><br>9. Fixup Table<br><br>The Fixup Table contains entries for all fixups in the image. The<br>Total Fixup Data Size in the PE Header is the number of bytes in the<br>fixup table. The fixup table is broken into blocks of fixups. Each<br>block represents the fixups for a 4K page.<br><br>Fixups that are resolved by the linker do not need to be processed by<br>the loader, unless the load image can't be loaded at the Image Base<br>specified in the PE Header.<br><br>9.1 Fixup Block<br><br>Fixup blocks have the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PAGE RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BLOCK SIZE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; TYPE/OFFSET &nbsp; ? &nbsp; TYPE/OFFSET &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪拍哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; TYPE/OFFSET &nbsp; ? &nbsp; &nbsp; &nbsp; ... &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 20. &nbsp;Fixup Block Format<br><br>To apply a fixup, a delta needs to be calculated. &nbsp;The 32-bit delta<br>is the difference between the preferred base, and the base where the<br>image is actually loaded. &nbsp;If the image is loaded at its preferred<br>base, the delta would be zero, and thus the fixups would not have to<br>be applied. Each block must start on a DWORD boundary. The ABSOLUTE<br>fixup type can be used to pad a block.<br><br>PAGE RVA = DD Page RVA. The image base plus the page rva is added to<br>each offset to create the virtual address of where the fixup needs to<br>be applied.<br><br>BLOCK SIZE = DD Number of bytes in the fixup block. This includes the<br>PAGE RVA and SIZE fields.<br><br>TYPE/OFFSET is defined as:<br><br>&nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0<br>&nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp;1<br>&nbsp; &nbsp; 谀哪囊哪哪哪哪哪哪?<br>&nbsp; &nbsp; 砊YPE? &nbsp; OFFSET &nbsp; ?<br>&nbsp; &nbsp; 滥哪男哪哪哪哪哪哪?<br>Figure 21. &nbsp;Fixup Record Format<br><br>TYPE = 4-bit fixup type. This value has the following definitions:<br><br>&nbsp; o &nbsp;0h __ABSOLUTE. This is a NOP. The fixup is skipped.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;1h __HIGH. Add the high 16-bits of the delta to the 16-bit field<br>&nbsp; &nbsp; &nbsp;at Offset. &nbsp;The 16-bit field represents the high value of a 32-<br>&nbsp; &nbsp; &nbsp;bit word.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;2h __LOW. Add the low 16-bits of the delta to the 16-bit field<br>&nbsp; &nbsp; &nbsp;at Offset. &nbsp;The 16-bit field represents the low half value of a<br>&nbsp; &nbsp; &nbsp;32-bit word. &nbsp;This fixup will only be emitted for a RISC machine<br>&nbsp; &nbsp; &nbsp;when the image Object Align isn't the default of 64K.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;3h __HIGHLOW. Apply the 32-bit delta to the 32-bit field at<br>&nbsp; &nbsp; &nbsp;Offset.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;4h __HIGHADJUST. This fixup requires a full 32-bit value. &nbsp;The<br>&nbsp; &nbsp; &nbsp;high 16-bits is located at Offset, and the low 16-bits is<br>&nbsp; &nbsp; &nbsp;located in the next Offset array element (this array element is<br>&nbsp; &nbsp; &nbsp;included in the SIZE field). The two need to be combined into a<br>&nbsp; &nbsp; &nbsp;signed variable. &nbsp;Add the 32-bit delta. &nbsp;Then add 0x8000 and<br>&nbsp; &nbsp; &nbsp;store the high 16-bits of the signed variable to the 16-bit<br>&nbsp; &nbsp; &nbsp;field at Offset.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;5h __MIPSJMPADDR.<br>&nbsp; &nbsp; &nbsp;<br>All other values are reserved.<br><br><br><br>10. Debug Information<br><br>The debug information is defined by the debugger and is not<br>controlled by the portable EXE format or linker. &nbsp;The only data<br>defined by the portable EXE format is the Debug Directory Table.<br><br>10.1 Debug Directory<br><br>The debug directory table consists of one or more entries that have<br>the following format:<br><br>&nbsp; &nbsp; 谀哪哪哪穆哪哪哪哪履哪哪哪穆哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DEBUG FLAGS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TIME/DATE STAMP &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪履哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp;MAJOR VERSION &nbsp;? &nbsp;MINOR VERSION &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪聊哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DEBUG TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DATA SIZE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DATA RVA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?<br>&nbsp; &nbsp; 媚哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?<br>&nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DATA SEEK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?<br>&nbsp; &nbsp; 滥哪哪哪牧哪哪哪哪聊哪哪哪牧哪哪哪哪?<br>&nbsp; &nbsp; <br>Figure 22. &nbsp;Debug Directory Entry<br><br>DEBUG FLAGS = DD Set to zero for now.<br><br>TIME/DATE STAMP = DD Time/Date the debug data was created.<br><br>MAJOR/MINOR VERSION = DW Version stamp.<br>This stamp can be used to determine the version of the debug data.<br><br>DEBUG TYPE = DD Format type.<br>To support multiple debuggers, this field determines the format of<br>the debug information. This value has the following definitions:<br><br>&nbsp; o &nbsp;0001h __Image contains COFF symbolics.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0001h __Image contains CodeView symbolics.<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; o &nbsp;0001h __Image contains FPO symbolics.<br>&nbsp; &nbsp; &nbsp;<br>DATA SIZE = DD The number of bytes in the debug data. This is the<br>size of the actual debug data and does not include the debug<br>directory.<br><br>DATA RVA = DD The relative virtual address of the debug data. This<br>address is relative to the beginning of the Image Base.<br><br>DATA SEEK = DD The seek value from the beginning of the file to the<br>debug data.<br><br>If the image contains more than one type of debug information, then<br>the next debug directory will immediately follow the first debug<br>directory.<br><br>
 
多人接受答案了。
 
后退
顶部