2020-12-23 17:49:36 +01:00
|
|
|
// +build windows,386 windows,arm
|
2020-11-06 05:24:50 +01:00
|
|
|
|
|
|
|
/* SPDX-License-Identifier: MIT
|
|
|
|
*
|
2021-01-28 17:52:15 +01:00
|
|
|
* Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
|
2020-11-06 05:24:50 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
package memmod
|
|
|
|
|
|
|
|
// Optional header format
|
|
|
|
type IMAGE_OPTIONAL_HEADER struct {
|
|
|
|
Magic uint16
|
|
|
|
MajorLinkerVersion uint8
|
|
|
|
MinorLinkerVersion uint8
|
|
|
|
SizeOfCode uint32
|
|
|
|
SizeOfInitializedData uint32
|
|
|
|
SizeOfUninitializedData uint32
|
|
|
|
AddressOfEntryPoint uint32
|
|
|
|
BaseOfCode uint32
|
|
|
|
BaseOfData uint32
|
|
|
|
ImageBase uintptr
|
|
|
|
SectionAlignment uint32
|
|
|
|
FileAlignment uint32
|
|
|
|
MajorOperatingSystemVersion uint16
|
|
|
|
MinorOperatingSystemVersion uint16
|
|
|
|
MajorImageVersion uint16
|
|
|
|
MinorImageVersion uint16
|
|
|
|
MajorSubsystemVersion uint16
|
|
|
|
MinorSubsystemVersion uint16
|
|
|
|
Win32VersionValue uint32
|
|
|
|
SizeOfImage uint32
|
|
|
|
SizeOfHeaders uint32
|
|
|
|
CheckSum uint32
|
|
|
|
Subsystem uint16
|
|
|
|
DllCharacteristics uint16
|
|
|
|
SizeOfStackReserve uintptr
|
|
|
|
SizeOfStackCommit uintptr
|
|
|
|
SizeOfHeapReserve uintptr
|
|
|
|
SizeOfHeapCommit uintptr
|
|
|
|
LoaderFlags uint32
|
|
|
|
NumberOfRvaAndSizes uint32
|
|
|
|
DataDirectory [IMAGE_NUMBEROF_DIRECTORY_ENTRIES]IMAGE_DATA_DIRECTORY
|
|
|
|
}
|
|
|
|
|
|
|
|
const IMAGE_ORDINAL_FLAG uintptr = 0x80000000
|
2021-07-29 01:01:46 +02:00
|
|
|
|
|
|
|
type IMAGE_LOAD_CONFIG_DIRECTORY struct {
|
|
|
|
Size uint32
|
|
|
|
TimeDateStamp uint32
|
|
|
|
MajorVersion uint16
|
|
|
|
MinorVersion uint16
|
|
|
|
GlobalFlagsClear uint32
|
|
|
|
GlobalFlagsSet uint32
|
|
|
|
CriticalSectionDefaultTimeout uint32
|
|
|
|
DeCommitFreeBlockThreshold uint32
|
|
|
|
DeCommitTotalFreeThreshold uint32
|
|
|
|
LockPrefixTable uint32
|
|
|
|
MaximumAllocationSize uint32
|
|
|
|
VirtualMemoryThreshold uint32
|
|
|
|
ProcessHeapFlags uint32
|
|
|
|
ProcessAffinityMask uint32
|
|
|
|
CSDVersion uint16
|
|
|
|
DependentLoadFlags uint16
|
|
|
|
EditList uint32
|
|
|
|
SecurityCookie uint32
|
|
|
|
SEHandlerTable uint32
|
|
|
|
SEHandlerCount uint32
|
|
|
|
GuardCFCheckFunctionPointer uint32
|
|
|
|
GuardCFDispatchFunctionPointer uint32
|
|
|
|
GuardCFFunctionTable uint32
|
|
|
|
GuardCFFunctionCount uint32
|
|
|
|
GuardFlags uint32
|
|
|
|
CodeIntegrity IMAGE_LOAD_CONFIG_CODE_INTEGRITY
|
|
|
|
GuardAddressTakenIatEntryTable uint32
|
|
|
|
GuardAddressTakenIatEntryCount uint32
|
|
|
|
GuardLongJumpTargetTable uint32
|
|
|
|
GuardLongJumpTargetCount uint32
|
|
|
|
DynamicValueRelocTable uint32
|
|
|
|
CHPEMetadataPointer uint32
|
|
|
|
GuardRFFailureRoutine uint32
|
|
|
|
GuardRFFailureRoutineFunctionPointer uint32
|
|
|
|
DynamicValueRelocTableOffset uint32
|
|
|
|
DynamicValueRelocTableSection uint16
|
|
|
|
Reserved2 uint16
|
|
|
|
GuardRFVerifyStackPointerFunctionPointer uint32
|
|
|
|
HotPatchTableOffset uint32
|
|
|
|
Reserved3 uint32
|
|
|
|
EnclaveConfigurationPointer uint32
|
|
|
|
VolatileMetadataPointer uint32
|
|
|
|
GuardEHContinuationTable uint32
|
|
|
|
GuardEHContinuationCount uint32
|
|
|
|
GuardXFGCheckFunctionPointer uint32
|
|
|
|
GuardXFGDispatchFunctionPointer uint32
|
|
|
|
GuardXFGTableDispatchFunctionPointer uint32
|
|
|
|
CastGuardOsDeterminedFailureMode uint32
|
|
|
|
}
|