PE文件结构Microsoft Developer Support.docx
- 文档编号:10829639
- 上传时间:2023-02-23
- 格式:DOCX
- 页数:43
- 大小:26.02KB
PE文件结构Microsoft Developer Support.docx
《PE文件结构Microsoft Developer Support.docx》由会员分享,可在线阅读,更多相关《PE文件结构Microsoft Developer Support.docx(43页珍藏版)》请在冰豆网上搜索。
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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- PE文件结构 Microsoft Developer Support PE 文件 结构