github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/utils/memmod/syscall_windows_32.go (about)

     1  //go:build (windows && 386) || (windows && arm)
     2  
     3  /* SPDX-License-Identifier: MIT
     4   *
     5   * Copyright (C) 2017-2022 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  	BaseOfData                  uint32
    21  	ImageBase                   uintptr
    22  	SectionAlignment            uint32
    23  	FileAlignment               uint32
    24  	MajorOperatingSystemVersion uint16
    25  	MinorOperatingSystemVersion uint16
    26  	MajorImageVersion           uint16
    27  	MinorImageVersion           uint16
    28  	MajorSubsystemVersion       uint16
    29  	MinorSubsystemVersion       uint16
    30  	Win32VersionValue           uint32
    31  	SizeOfImage                 uint32
    32  	SizeOfHeaders               uint32
    33  	CheckSum                    uint32
    34  	Subsystem                   uint16
    35  	DllCharacteristics          uint16
    36  	SizeOfStackReserve          uintptr
    37  	SizeOfStackCommit           uintptr
    38  	SizeOfHeapReserve           uintptr
    39  	SizeOfHeapCommit            uintptr
    40  	LoaderFlags                 uint32
    41  	NumberOfRvaAndSizes         uint32
    42  	DataDirectory               [IMAGE_NUMBEROF_DIRECTORY_ENTRIES]IMAGE_DATA_DIRECTORY
    43  }
    44  
    45  const IMAGE_ORDINAL_FLAG uintptr = 0x80000000
    46  
    47  type IMAGE_LOAD_CONFIG_DIRECTORY struct {
    48  	Size                                     uint32
    49  	TimeDateStamp                            uint32
    50  	MajorVersion                             uint16
    51  	MinorVersion                             uint16
    52  	GlobalFlagsClear                         uint32
    53  	GlobalFlagsSet                           uint32
    54  	CriticalSectionDefaultTimeout            uint32
    55  	DeCommitFreeBlockThreshold               uint32
    56  	DeCommitTotalFreeThreshold               uint32
    57  	LockPrefixTable                          uint32
    58  	MaximumAllocationSize                    uint32
    59  	VirtualMemoryThreshold                   uint32
    60  	ProcessHeapFlags                         uint32
    61  	ProcessAffinityMask                      uint32
    62  	CSDVersion                               uint16
    63  	DependentLoadFlags                       uint16
    64  	EditList                                 uint32
    65  	SecurityCookie                           uint32
    66  	SEHandlerTable                           uint32
    67  	SEHandlerCount                           uint32
    68  	GuardCFCheckFunctionPointer              uint32
    69  	GuardCFDispatchFunctionPointer           uint32
    70  	GuardCFFunctionTable                     uint32
    71  	GuardCFFunctionCount                     uint32
    72  	GuardFlags                               uint32
    73  	CodeIntegrity                            IMAGE_LOAD_CONFIG_CODE_INTEGRITY
    74  	GuardAddressTakenIatEntryTable           uint32
    75  	GuardAddressTakenIatEntryCount           uint32
    76  	GuardLongJumpTargetTable                 uint32
    77  	GuardLongJumpTargetCount                 uint32
    78  	DynamicValueRelocTable                   uint32
    79  	CHPEMetadataPointer                      uint32
    80  	GuardRFFailureRoutine                    uint32
    81  	GuardRFFailureRoutineFunctionPointer     uint32
    82  	DynamicValueRelocTableOffset             uint32
    83  	DynamicValueRelocTableSection            uint16
    84  	Reserved2                                uint16
    85  	GuardRFVerifyStackPointerFunctionPointer uint32
    86  	HotPatchTableOffset                      uint32
    87  	Reserved3                                uint32
    88  	EnclaveConfigurationPointer              uint32
    89  	VolatileMetadataPointer                  uint32
    90  	GuardEHContinuationTable                 uint32
    91  	GuardEHContinuationCount                 uint32
    92  	GuardXFGCheckFunctionPointer             uint32
    93  	GuardXFGDispatchFunctionPointer          uint32
    94  	GuardXFGTableDispatchFunctionPointer     uint32
    95  	CastGuardOsDeterminedFailureMode         uint32
    96  }