...
Run Format

Source file src/debug/pe/pe.go

     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	type SectionHeader32 struct {
    90		Name                 [8]uint8
    91		VirtualSize          uint32
    92		VirtualAddress       uint32
    93		SizeOfRawData        uint32
    94		PointerToRawData     uint32
    95		PointerToRelocations uint32
    96		PointerToLineNumbers uint32
    97		NumberOfRelocations  uint16
    98		NumberOfLineNumbers  uint16
    99		Characteristics      uint32
   100	}
   101	
   102	const COFFSymbolSize = 18
   103	
   104	type COFFSymbol struct {
   105		Name               [8]uint8
   106		Value              uint32
   107		SectionNumber      int16
   108		Type               uint16
   109		StorageClass       uint8
   110		NumberOfAuxSymbols uint8
   111	}
   112	
   113	const (
   114		IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
   115		IMAGE_FILE_MACHINE_AM33      = 0x1d3
   116		IMAGE_FILE_MACHINE_AMD64     = 0x8664
   117		IMAGE_FILE_MACHINE_ARM       = 0x1c0
   118		IMAGE_FILE_MACHINE_EBC       = 0xebc
   119		IMAGE_FILE_MACHINE_I386      = 0x14c
   120		IMAGE_FILE_MACHINE_IA64      = 0x200
   121		IMAGE_FILE_MACHINE_M32R      = 0x9041
   122		IMAGE_FILE_MACHINE_MIPS16    = 0x266
   123		IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
   124		IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
   125		IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
   126		IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
   127		IMAGE_FILE_MACHINE_R4000     = 0x166
   128		IMAGE_FILE_MACHINE_SH3       = 0x1a2
   129		IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
   130		IMAGE_FILE_MACHINE_SH4       = 0x1a6
   131		IMAGE_FILE_MACHINE_SH5       = 0x1a8
   132		IMAGE_FILE_MACHINE_THUMB     = 0x1c2
   133		IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
   134	)
   135	

View as plain text