github.com/apernet/sing-tun@v0.2.6-0.20240323130332-b9f6511036ad/internal/wintun/memmod/syscall_windows_64.go (about)

     1  //go:build (windows && amd64) || (windows && arm64)
     2  
     3  /* SPDX-License-Identifier: MIT
     4   *
     5   * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
     6   */
     7  
     8  package memmod
     9  
    10  // Optional header format
    11  type IMAGE_OPTIONAL_HEADER struct {
    12  	Magic                       uint16
    13  	MajorLinkerVersion          uint8
    14  	MinorLinkerVersion          uint8
    15  	SizeOfCode                  uint32
    16  	SizeOfInitializedData       uint32
    17  	SizeOfUninitializedData     uint32
    18  	AddressOfEntryPoint         uint32
    19  	BaseOfCode                  uint32
    20  	ImageBase                   uintptr
    21  	SectionAlignment            uint32
    22  	FileAlignment               uint32
    23  	MajorOperatingSystemVersion uint16
    24  	MinorOperatingSystemVersion uint16
    25  	MajorImageVersion           uint16
    26  	MinorImageVersion           uint16
    27  	MajorSubsystemVersion       uint16
    28  	MinorSubsystemVersion       uint16
    29  	Win32VersionValue           uint32
    30  	SizeOfImage                 uint32
    31  	SizeOfHeaders               uint32
    32  	CheckSum                    uint32
    33  	Subsystem                   uint16
    34  	DllCharacteristics          uint16
    35  	SizeOfStackReserve          uintptr
    36  	SizeOfStackCommit           uintptr
    37  	SizeOfHeapReserve           uintptr
    38  	SizeOfHeapCommit            uintptr
    39  	LoaderFlags                 uint32
    40  	NumberOfRvaAndSizes         uint32
    41  	DataDirectory               [IMAGE_NUMBEROF_DIRECTORY_ENTRIES]IMAGE_DATA_DIRECTORY
    42  }
    43  
    44  const IMAGE_ORDINAL_FLAG uintptr = 0x8000000000000000
    45  
    46  type IMAGE_LOAD_CONFIG_DIRECTORY struct {
    47  	Size                                     uint32
    48  	TimeDateStamp                            uint32
    49  	MajorVersion                             uint16
    50  	MinorVersion                             uint16
    51  	GlobalFlagsClear                         uint32
    52  	GlobalFlagsSet                           uint32
    53  	CriticalSectionDefaultTimeout            uint32
    54  	DeCommitFreeBlockThreshold               uint64
    55  	DeCommitTotalFreeThreshold               uint64
    56  	LockPrefixTable                          uint64
    57  	MaximumAllocationSize                    uint64
    58  	VirtualMemoryThreshold                   uint64
    59  	ProcessAffinityMask                      uint64
    60  	ProcessHeapFlags                         uint32
    61  	CSDVersion                               uint16
    62  	DependentLoadFlags                       uint16
    63  	EditList                                 uint64
    64  	SecurityCookie                           uint64
    65  	SEHandlerTable                           uint64
    66  	SEHandlerCount                           uint64
    67  	GuardCFCheckFunctionPointer              uint64
    68  	GuardCFDispatchFunctionPointer           uint64
    69  	GuardCFFunctionTable                     uint64
    70  	GuardCFFunctionCount                     uint64
    71  	GuardFlags                               uint32
    72  	CodeIntegrity                            IMAGE_LOAD_CONFIG_CODE_INTEGRITY
    73  	GuardAddressTakenIatEntryTable           uint64
    74  	GuardAddressTakenIatEntryCount           uint64
    75  	GuardLongJumpTargetTable                 uint64
    76  	GuardLongJumpTargetCount                 uint64
    77  	DynamicValueRelocTable                   uint64
    78  	CHPEMetadataPointer                      uint64
    79  	GuardRFFailureRoutine                    uint64
    80  	GuardRFFailureRoutineFunctionPointer     uint64
    81  	DynamicValueRelocTableOffset             uint32
    82  	DynamicValueRelocTableSection            uint16
    83  	Reserved2                                uint16
    84  	GuardRFVerifyStackPointerFunctionPointer uint64
    85  	HotPatchTableOffset                      uint32
    86  	Reserved3                                uint32
    87  	EnclaveConfigurationPointer              uint64
    88  	VolatileMetadataPointer                  uint64
    89  	GuardEHContinuationTable                 uint64
    90  	GuardEHContinuationCount                 uint64
    91  	GuardXFGCheckFunctionPointer             uint64
    92  	GuardXFGDispatchFunctionPointer          uint64
    93  	GuardXFGTableDispatchFunctionPointer     uint64
    94  	CastGuardOsDeterminedFailureMode         uint64
    95  }