...
Run Format

Source file src/debug/pe/pe.go

Documentation: debug/pe

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pe
     6  
     7  type FileHeader struct {
     8  	Machine              uint16
     9  	NumberOfSections     uint16
    10  	TimeDateStamp        uint32
    11  	PointerToSymbolTable uint32
    12  	NumberOfSymbols      uint32
    13  	SizeOfOptionalHeader uint16
    14  	Characteristics      uint16
    15  }
    16  
    17  type DataDirectory struct {
    18  	VirtualAddress uint32
    19  	Size           uint32
    20  }
    21  
    22  type OptionalHeader32 struct {
    23  	Magic                       uint16
    24  	MajorLinkerVersion          uint8
    25  	MinorLinkerVersion          uint8
    26  	SizeOfCode                  uint32
    27  	SizeOfInitializedData       uint32
    28  	SizeOfUninitializedData     uint32
    29  	AddressOfEntryPoint         uint32
    30  	BaseOfCode                  uint32
    31  	BaseOfData                  uint32
    32  	ImageBase                   uint32
    33  	SectionAlignment            uint32
    34  	FileAlignment               uint32
    35  	MajorOperatingSystemVersion uint16
    36  	MinorOperatingSystemVersion uint16
    37  	MajorImageVersion           uint16
    38  	MinorImageVersion           uint16
    39  	MajorSubsystemVersion       uint16
    40  	MinorSubsystemVersion       uint16
    41  	Win32VersionValue           uint32
    42  	SizeOfImage                 uint32
    43  	SizeOfHeaders               uint32
    44  	CheckSum                    uint32
    45  	Subsystem                   uint16
    46  	DllCharacteristics          uint16
    47  	SizeOfStackReserve          uint32
    48  	SizeOfStackCommit           uint32
    49  	SizeOfHeapReserve           uint32
    50  	SizeOfHeapCommit            uint32
    51  	LoaderFlags                 uint32
    52  	NumberOfRvaAndSizes         uint32
    53  	DataDirectory               [16]DataDirectory
    54  }
    55  
    56  type OptionalHeader64 struct {
    57  	Magic                       uint16
    58  	MajorLinkerVersion          uint8
    59  	MinorLinkerVersion          uint8
    60  	SizeOfCode                  uint32
    61  	SizeOfInitializedData       uint32
    62  	SizeOfUninitializedData     uint32
    63  	AddressOfEntryPoint         uint32
    64  	BaseOfCode                  uint32
    65  	ImageBase                   uint64
    66  	SectionAlignment            uint32
    67  	FileAlignment               uint32
    68  	MajorOperatingSystemVersion uint16
    69  	MinorOperatingSystemVersion uint16
    70  	MajorImageVersion           uint16
    71  	MinorImageVersion           uint16
    72  	MajorSubsystemVersion       uint16
    73  	MinorSubsystemVersion       uint16
    74  	Win32VersionValue           uint32
    75  	SizeOfImage                 uint32
    76  	SizeOfHeaders               uint32
    77  	CheckSum                    uint32
    78  	Subsystem                   uint16
    79  	DllCharacteristics          uint16
    80  	SizeOfStackReserve          uint64
    81  	SizeOfStackCommit           uint64
    82  	SizeOfHeapReserve           uint64
    83  	SizeOfHeapCommit            uint64
    84  	LoaderFlags                 uint32
    85  	NumberOfRvaAndSizes         uint32
    86  	DataDirectory               [16]DataDirectory
    87  }
    88  
    89  const (
    90  	IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
    91  	IMAGE_FILE_MACHINE_AM33      = 0x1d3
    92  	IMAGE_FILE_MACHINE_AMD64     = 0x8664
    93  	IMAGE_FILE_MACHINE_ARM       = 0x1c0
    94  	IMAGE_FILE_MACHINE_ARM64     = 0xaa64
    95  	IMAGE_FILE_MACHINE_EBC       = 0xebc
    96  	IMAGE_FILE_MACHINE_I386      = 0x14c
    97  	IMAGE_FILE_MACHINE_IA64      = 0x200
    98  	IMAGE_FILE_MACHINE_M32R      = 0x9041
    99  	IMAGE_FILE_MACHINE_MIPS16    = 0x266
   100  	IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
   101  	IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
   102  	IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
   103  	IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
   104  	IMAGE_FILE_MACHINE_R4000     = 0x166
   105  	IMAGE_FILE_MACHINE_SH3       = 0x1a2
   106  	IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
   107  	IMAGE_FILE_MACHINE_SH4       = 0x1a6
   108  	IMAGE_FILE_MACHINE_SH5       = 0x1a8
   109  	IMAGE_FILE_MACHINE_THUMB     = 0x1c2
   110  	IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
   111  )
   112  
   113  // IMAGE_DIRECTORY_ENTRY constants
   114  const (
   115  	IMAGE_DIRECTORY_ENTRY_EXPORT         = 0
   116  	IMAGE_DIRECTORY_ENTRY_IMPORT         = 1
   117  	IMAGE_DIRECTORY_ENTRY_RESOURCE       = 2
   118  	IMAGE_DIRECTORY_ENTRY_EXCEPTION      = 3
   119  	IMAGE_DIRECTORY_ENTRY_SECURITY       = 4
   120  	IMAGE_DIRECTORY_ENTRY_BASERELOC      = 5
   121  	IMAGE_DIRECTORY_ENTRY_DEBUG          = 6
   122  	IMAGE_DIRECTORY_ENTRY_ARCHITECTURE   = 7
   123  	IMAGE_DIRECTORY_ENTRY_GLOBALPTR      = 8
   124  	IMAGE_DIRECTORY_ENTRY_TLS            = 9
   125  	IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG    = 10
   126  	IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT   = 11
   127  	IMAGE_DIRECTORY_ENTRY_IAT            = 12
   128  	IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT   = 13
   129  	IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14
   130  )
   131  

View as plain text