freshbug's notes

freshbug的代码人生

bekilledlzyID:bekilledlzy
14756次访问,排名7705好友0人,关注者0
bekilledlzy的文章
原创 17 篇
翻译 0 篇
转载 32 篇
评论 6 篇
freshbug的公告
访问www.freshbug.com
自2007年10月16日
freshbug的联系方式:
freshbug@gmail.com
最近评论
loadend:你好,我想问一下,那注册google ad帐户的时候不是要填网址嘛,填什么呢?是不是填http://blog.csdn.net/用户名/??
freshbug:stl里面有一些静态变量 不能跨dll vector有时候能跨dll是因为连续的内存分布

跨模块传输数据最好是能用C风格的结构 用C++类很容易出问题
wang:我是向dll中传一个map指针,结果也是it++之后就内存泄漏
wang:我也遇到了类似问题。
远离尘嚣:老大,能把你的Uft8ToAnsi是自定义的转码函数共享一下嘛?万分感谢!
文章分类
收藏
    相册
    who's freshbug?
    技术站点
    老牛们的blog
    咨讯
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 PE文件格式偏移参考收藏

    新一篇: 写了第一个勾IAT的APIHOOK 手上事太多 没空写遍历进程部分了 | 旧一篇: x86汇编指令详解

    Complete PE Offset Reference

    While there is a lot of data and various parts of the structure are at varying positions there are still a lot of useful fixed and relative offsets that will help when disassembling/examining PE files. Resource information and the such like are omitted - there are good tools available to manipulate these e.g. ResHacker.

    The DOS Header

     

    OFFSET

    SIZE

    NAME

    EXPLANATION

    00

    WORD

    e_magic

    Magic DOS signature MZ (4Dh 5Ah)

    02

    WORD

    e_cblp

    Bytes on last page of file

    04

    WORD

    e_cp

    Pages in file

    06

    WORD

    e_crlc

    Relocations

    08

    WORD

    e_cparhdr

    Size of header in paragraphs

    0A

    WORD

    e_minalloc

    Minimum extra paragraphs needed

    0C

    WORD

    e_maxalloc

    Maximum extra paragraphs needed

    0E

    WORD

    e_ss

    Initial (relative) SS value

    10

    WORD

    e_sp

    Initial SP value

    12

    WORD

    e_csum

    Checksum

    14

    WORD

    e_ip

    Initial IP value

    16

    WORD

    e_cs

    Initial (relative) CS value

    18

    WORD

    e_lfarlc

    File address of relocation table

    1A

    WORD

    e_ovno

    Overlay number

    1C

    WORD

    e_res[4]

    Reserved words

    24

    WORD

    e_oemid

    OEM identifier (for e_oeminfo)

    26

    WORD

    e_oeminfo

    OEM information; e_oemid specific

    28

    WORD

    e_res2[10]

    Reserved words

    3C

    DWORD

    e_lfanew

    Offset to start of PE header

     

    The PE Header

    Offsets shown  are from the beginning of this section.

     

    00

    DWORD

    Signature

    PE Signature PE.. (50h 45h 00h 00h)

    04

    WORD

    Machine

    014Ch = Intel 386, 014Dh = Intel 486, 014Eh = Intel 586, 0200h = Intel 64-bit, 0162h=MIPS

    06

    WORD

    NumberOfSections

    Number Of Sections

    08

    DWORD

    TimeDateStamp

    Date & time image was created by the linker

    0C

    DWORD

    PointerToSymbolTable

    Zero or offset of COFF symbol table in older files

    10

    DWORD

    NumberOfSymbols

    Number of symbols in COFF symbol table

    14

    WORD

    SizeOfOptionalHeader

    Size of optional header in bytes (224 in 32bit exe)

    16

    WORD

    Characteristics

    see below

    18

    **********

    START OF OPTIONAL HEADER

    **************************************

    18

    WORD

    Magic

    010Bh=32-bit executable image
    020Bh=64-bit executable image
    0107h=ROM image

    1A

    BYTE

    MajorLinkerVersion

    Major version number of the linker

    1B

    BYTE

    MinorLinkerVersion

    Minor version number of the linker

    1C

    DWORD

    SizeOfCode

    size of code section or sum if multiple code sections

    20

    DWORD

    SizeOfInitializedData

    as above

    24

    DWORD

    SizeOfUninitializedData

    as above

    28

    DWORD

    AddressOfEntryPoint

    Start of code execution, optional for DLLs, zero when none present

    2C

    DWORD

    BaseOfCode

    RVA of first byte of code when loaded into RAM

    30

    DWORD

    BaseOfData

    RVA of first byte of data when loaded into RAM

    34

    DWORD

    ImageBase

    Preferred load address

    38

    DWORD

    SectionAlignment 

    Alignment of sections when loaded in RAM

    3C

    DWORD

    FileAlignment 

    Alignment of sections in file on disk

    40

    WORD

    MajorOperatingSystemVersion

    Major version no. of required operating system

    42

    WORD

    MinorOperatingSystemVersion

    Minor version no. of required operating system

    44

    WORD

    MajorImageVersion

    Major version number of the image

    46

    WORD

    MinorImageVersion

    Minor version number of the image

    48

    WORD

    MajorSubsystemVersion

    Major version number of the subsystem

    4A

    WORD

    MinorSubsystemVersion

    Minor version number of the subsystem

    4C

    DWORD

    Reserved1

     

    50

    DWORD

    SizeOfImage

    Amount of memory allocated by loader for image. Must be a multiple of SectionAlignment

    54

    DWORD

    SizeOfHeaders 

    Offset of first section, multiple of FileAlignment

    58

    DWORD

    CheckSum

    Image checksum (only required for kernel-mode drivers and some system DLLs).

    5C

    WORD

    Subsystem

    0002h=Windows GUI, 0003h=console

    5E

    WORD

    DllCharacteristics

    0001h=per-process library initialization
    0002h=per-process library termination
    0003h=per-thread library initialization
    0004h=per-thread library termination

    60

    DWORD

    SizeOfStackReserve

    Number of bytes reserved for the stack

    64

    DWORD

    SizeOfStackCommit

    Number of bytes actually used for the stack

    68

    DWORD

    SizeOfHeapReserve

    Number of bytes to reserve for the local heap

    6C

    DWORD

    SizeOfHeapCommit

    Number of bytes actually used for local heap

    70

    DWORD

    LoaderFlags

    This member is obsolete.

    74

    DWORD

    NumberOfRvaAndSizes

    Number of directory entries.

    78

    **********

    START OF DATA DIRECTORY

    **************************************

    78

    DWORD

    IMAGE_DATA_DIRECTORY0

    RVA of Export Directory

    7C

    DWORD

     

    size of Export Directory

    80

    DWORD

    IMAGE_DATA_DIRECTORY1

    RVA of Import Directory (array of IIDs)

    84

    DWORD

     

    size of Import Directory (array of IIDs)

    88

    DWORD

    IMAGE_DATA_DIRECTORY2

    RVA of Resource Directory

    8C

    DWORD

     

    size of Resource Directory

    90

    DWORD

    IMAGE_DATA_DIRECTORY3

    RVA of Exception Directory

    94

    DWORD

     

    size of Exception Directory

    98

    DWORD

    IMAGE_DATA_DIRECTORY4

    Raw Offset of Security Directory

    9C

    DWORD

     

    size of Security Directory

    A0

    DWORD

    IMAGE_DATA_DIRECTORY5

    RVA of Base Relocation Directory

    A4

    DWORD

     

    size of Base Relocation Directory

    A8

    DWORD

    IMAGE_DATA_DIRECTORY6

    RVA of Debug Directory

    AC

    DWORD

     

    size of Debug Directory

    B0

    DWORD

    IMAGE_DATA_DIRECTORY7