PE文件结构Microsoft Developer Support.docx

上传人:b****4 文档编号:4595721 上传时间:2023-05-07 格式:DOCX 页数:43 大小:26.02KB
下载 相关 举报
PE文件结构Microsoft Developer Support.docx_第1页
第1页 / 共43页
PE文件结构Microsoft Developer Support.docx_第2页
第2页 / 共43页
PE文件结构Microsoft Developer Support.docx_第3页
第3页 / 共43页
PE文件结构Microsoft Developer Support.docx_第4页
第4页 / 共43页
PE文件结构Microsoft Developer Support.docx_第5页
第5页 / 共43页
PE文件结构Microsoft Developer Support.docx_第6页
第6页 / 共43页
PE文件结构Microsoft Developer Support.docx_第7页
第7页 / 共43页
PE文件结构Microsoft Developer Support.docx_第8页
第8页 / 共43页
PE文件结构Microsoft Developer Support.docx_第9页
第9页 / 共43页
PE文件结构Microsoft Developer Support.docx_第10页
第10页 / 共43页
PE文件结构Microsoft Developer Support.docx_第11页
第11页 / 共43页
PE文件结构Microsoft Developer Support.docx_第12页
第12页 / 共43页
PE文件结构Microsoft Developer Support.docx_第13页
第13页 / 共43页
PE文件结构Microsoft Developer Support.docx_第14页
第14页 / 共43页
PE文件结构Microsoft Developer Support.docx_第15页
第15页 / 共43页
PE文件结构Microsoft Developer Support.docx_第16页
第16页 / 共43页
PE文件结构Microsoft Developer Support.docx_第17页
第17页 / 共43页
PE文件结构Microsoft Developer Support.docx_第18页
第18页 / 共43页
PE文件结构Microsoft Developer Support.docx_第19页
第19页 / 共43页
PE文件结构Microsoft Developer Support.docx_第20页
第20页 / 共43页
亲,该文档总共43页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

PE文件结构Microsoft Developer Support.docx

《PE文件结构Microsoft Developer Support.docx》由会员分享,可在线阅读,更多相关《PE文件结构Microsoft Developer Support.docx(43页珍藏版)》请在冰点文库上搜索。

PE文件结构Microsoft Developer Support.docx

PE文件结构MicrosoftDeveloperSupport

download:

 

PORTABLEEXECUTABLEFORMAT

Author:

MichealJ.O'Leary

 

Preface

ThisdocumentwaseditedandreleasedbyMicrosoftDeveloper

Support.ItdescribesthebinaryportableexecutableformatforNT.

Theinformationisprovidedatthispointbecausewefeelitwill

maketheworkofapplicationdevelopmenteasier.Unfortunately,the

informationinthisdocumentmaychangebeforethefinalreleaseof

WindowsNT.MicrosoftisNOTcommittingtostaywiththeseformats

byreleasingthisdocument.Questionsorfollow-upsforanyofthe

informationpresentedhereshouldbepostedtoCompuServeMSWIN32

forum,section6.

--SteveFirebaugh

MicrosoftDeveloperSupport

Contents

1.Overview

2.PEHeader

3.ObjectTable

4.ImagePages

5.Exports

5.1ExportDirectoryTable

5.2ExportAddressTable

5.3ExportNameTablePointers

5.4ExportOrdinalTable

5.5ExportNameTable

6.Imports

6.1ImportDirectoryTable

6.2ImportLookupTable

6.3Hint-NameTable

6.4ImportAddressTable

7.ThreadLocalStorage

7.1ThreadLocalStorageDirectoryTable

7.2ThreadLocalStorageCallBackTable

8.Resources

8.1ResourceDirectoryTable

8.2ResourceExample

9.FixupTable

9.1FixupBlock

10.DebugInformation

10.1DebugDirectory

 

1.Overview

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿<ÄÄ¿<ÄÄÄÄÄBaseofImageHeader

³DOS2Compatible³³

³EXEHeader³³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³

³unused³³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³

³OEMIdentifier³³

³OEMInfo³³

³³³DOS2.0Section

³Offsetto³³(forDOScompatibilityonly)

³PEHeader³³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³

³DOS2.0Stub³³

³Program&³³

³Reloc.Table³³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´<ÄÄÙ

³unused³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´<ÄÄÄÄÄÄÄÄÄAlignedon8byteboundary

³PEHeader³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³ObjectTable³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³ImagePages³

³importinfo³

³exportinfo³

³fixupinfo³

³resourceinfo³

³debuginfo³

ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Figure1.Atypical32-bitPortableEXEFileLayout

 

2.PEHeader

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿

³SIGNATUREBYTES³CPUTYPE³#OBJECTS³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³TIME/DATESTAMP³RESERVED³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESERVED³NTHDRSIZE³FLAGS³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESERVED³LMAJOR³LMINOR³RESERVED³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESERVED³RESERVED³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³ENTRYPOINTRVA³RESERVED³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESERVED³IMAGEBASE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³OBJECTALIGN³FILEALIGN³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³OSMAJOR³OSMINOR³USERMAJOR³USERMINOR³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³SUBSYSMAJOR³SUBSYSMINOR³RESERVED³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³IMAGESIZE³HEADERSIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³FILECHECKSUM³SUBSYSTEM³DLLFLAGS³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³STACKRESERVESIZE³STACKCOMMITSIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³HEAPRESERVESIZE³HEAPCOMMITSIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESERVED³#INTERESTINGRVA/SIZES³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³EXPORTTABLERVA³TOTALEXPORTDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³IMPORTTABLERVA³TOTALIMPORTDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³RESOURCETABLERVA³TOTALRESOURCEDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³EXCEPTIONTABLERVA³TOTALEXCEPTIONDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³SECURITYTABLERVA³TOTALSECURITYDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³FIXUPTABLERVA³TOTALFIXUPDATASIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³DEBUGTABLERVA³TOTALDEBUGDIRECTORIES³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³IMAGEDESCRIPTIONRVA³TOTALDESCRIPTIONSIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³MACHINESPECIFICRVA³MACHINESPECIFICSIZE³

ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´

³THREADLOCALSTORAGERVA³TOTALTLSSIZE³

ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Figure2.PEHeader

Notes:

oAVAisavirtualaddressthatisalreadybiasedbytheImage

BasefoundinthePEHeader.ARVAisavirtualaddressthatis

relativetotheImageBase.

oAnRVAinthePEHeaderwhichhasavalueofzeroindicatesthe

fieldisn'tused.

oImagepagesarealignedandzeropaddedtoaFileAlign

boundary.Thebasesofallothertablesandstructuresmustbe

alignedonDWORD(4byte)boundary.Thus,allVA'sandRVA's

mustbeona32bitboundary.Alltableandstructurefields

mustbealignedontheir"natural"boundaries,withthepossible

exceptionoftheDebugInfo.

SIGNATUREBYTES=DB*4.

Currentvalueis"PE/0/0".ThatsPEfollowedbytwozeros(nulls).

CPUTYPE=DWCPUType.

ThisfieldspecifiesthetypeofCPUcompatibilityrequiredbythis

imagetorun.Thevaluesare:

o0000h__unknown

o014Ch__80386

o014Dh__80486

o014Eh__80586

o0162h__MIPSMarkI(R2000,R3000)

o0163h__MIPSMarkII(R6000)

o0166h__MIPSMarkIII(R4000)

#OBJECTS=DWNumberofobjectentries.

ThisfieldspecifiesthenumberofentriesintheObjectTable.

TIME/DATESTAMP=DDUsedtostorethetimeanddatethefilewas

createdormodifiedbythelinker.

NTHDRSIZE=DWThisisthenumberofremainingbytesintheNT

headerthatfollowtheFLAGSfield.

FLAGS=DWFlagbitsfortheimage.

Theflagbitshavethefollowingdefinitions:

o0000h__Programimage.

0001h__Imageisexecutable,butCONSOLE!

o0002h__Imageisexecutable.

Ifthisbitisn'tset,thenitindicatesthateithererrors

wheredetectedatlinktimeorthattheimageisbeing

incrementallylinkedandthereforecan'tbeloaded.

o0200h__Fixed.

Indicatesthatiftheimagecan'tbeloadedattheImageBase,

thendon'tloadit.

o2000h__Libraryimage.

LMAJOR/LMINOR=DBLinkermajor/minorversionnumber.

ENTRYPOINTRVA=DDEntrypointrelativevirtualaddress.

TheaddressisrelativetotheImageBase.Theaddressisthe

startingaddressforprogramimagesandthelibraryinitialization

andlibraryterminationaddressforlibraryimages.

IMAGEBASE=DDThevirtualbaseoftheimage.

Thiswillbethevirtualaddressofthefirstbyteofthefile(Dos

Header).Thismustbeamultipleof64K.

OBJECTALIGN=DDThealignmentoftheobjects.Thismustbeapower

of2between512and256Minclusive.Thedefaultis64K.

FILEALIGN=DDAlignmentfactorusedtoalignimagepages.The

alignmentfactor(inbytes)usedtoalignthebaseoftheimagepages

andtodeterminethegranularityofper-objecttrailingzeropad.

Largeralignmentfactorswillcostmorefilespace;smalleralignment

factorswillimpactdemandloadperformance,perhapssignificantly.

Ofthetwo,wastingfilespaceispreferable.Thisvalueshouldbea

powerof2between512and64Kinclusive.

OSMAJOR/MINOR=DWOSversionnumberrequiredtorunthisimage.

USERMAJOR/MINOR#=DWUsermajor/minorversionnumber.

Thisisusefulfordifferentiatingbetweenrevisionsof

images/dynamiclinkedlibraries.Thevaluesarespecifiedatlink

timebytheuser.

SUBSYSMAJOR/MINOR#=DWSubsystemmajor/minorversionnumber.

IMAGESIZE=DDThevirtualsize(inbytes)oftheimage.

Thisincludesallheaders.Thetotalimagesizemustbeamultiple

ofObjectAlign.

HEADERSIZE=DDTotalheadersize.

ThecombinedsizeoftheDosHeader,PEHeaderandObjectTable.

FILECHECKSUM=DDChecksumforentirefile.Setto0bythelinker.

SUBSYSTEM=DWNTSubsystemrequiredtorunthisimage.

Thevaluesare:

o0000h__Unknown

o0001h__Native

o0002h__WindowsGUI

o0003h__WindowsCharacter

o0005h__OS/2Character

o0007h__PosixCharacter

DLLFLAGS=DWIndicatesspecialloaderrequirements.

Thisflaghasthefollowingbitvalues:

o0001h__Per-ProcessLibraryInitialization.

o0002h__Per-ProcessLibraryTermination.

o0004h__Per-ThreadLibraryInitialization.

o0008h__Per-ThreadLibraryTermination.

Allotherbitsarereservedforfutureuseandshouldbesettozero.

STACKRESERVESIZE=DDStacksizeneededforimage.

Thememoryisreserved,butonlytheSTACKCOMMITSIZEiscommitted.

Thenextpageofthestackisa'guardedpage'.Whentheapplication

hitstheguardedpage,theguardedpagebecomesvalid,andthenext

pagebecomestheguardedpage.ThiscontinuesuntiltheRESERVESIZE

isreached.

STACKCOMMITSIZE=DDStackcommitsize.

HEAPRESERVESIZE=DDSizeoflocalheaptoreserve.

HEAPCOMMITSIZE=DDAmounttocommitinlocalheap.

#INTERESTINGVA/SIZES=DDIndicatesthesizeoftheVA/SIZEarray

thatfollows.

EXPORTTABLERVA=DDRelativeVirtualAddressoftheExportTable.

ThisaddressisrelativetotheImageBase.

IMPORTTABLERVA=DDRelativeVirtualAddressoftheImportTable.

ThisaddressisrelativetotheImageBase.

RESOURCETABLERVA=DDRelativeVirtualAddressoftheResource

Table.ThisaddressisrelativetotheImageBase.

EXCEPTIONTABLERVA=DDRelativeVirtualAddressoftheException

Table.Thisaddressisrelativetothe

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2