Skip to content

Commit

Permalink
Add MEMORY_BASIC_INFORMATION
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Jul 7, 2022
1 parent be7b531 commit 6f83ddb
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
42 changes: 42 additions & 0 deletions memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,45 @@ typedef enum _MEMORY_INFORMATION_CLASS
MemoryPhysicalContiguityInformation,
} MEMORY_INFORMATION_CLASS;
*/

/*
type:
typedef struct _MEMORY_BASIC_INFORMATION {
PVOID BaseAddress;
PVOID AllocationBase;
ULONG AllocationProtect;
USHORT PartitionId;
SIZE_T RegionSize;
ULONG State;
ULONG Protect;
ULONG Type;
} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
*/

/*
type:
typedef struct _MEMORY_BASIC_INFORMATION32 {
DWORD BaseAddress;
DWORD AllocationBase;
DWORD AllocationProtect;
DWORD RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
} MEMORY_BASIC_INFORMATION32, *PMEMORY_BASIC_INFORMATION32;
*/

/*
type:
typedef struct _MEMORY_BASIC_INFORMATION64 {
ULONGLONG BaseAddress;
ULONGLONG AllocationBase;
DWORD AllocationProtect;
DWORD __alignment1;
ULONGLONG RegionSize;
DWORD State;
DWORD Protect;
DWORD Type;
DWORD __alignment2;
} MEMORY_BASIC_INFORMATION64, *PMEMORY_BASIC_INFORMATION64;
*/
36 changes: 36 additions & 0 deletions memory_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,42 @@ var (
procNtFlushVirtualMemory = modntdll.NewProc("NtFlushVirtualMemory")
)

// MemoryBasicInformationT has been derived from the MEMORY_BASIC_INFORMATION struct definition.
type MemoryBasicInformationT struct {
BaseAddress *byte
AllocationBase *byte
AllocationProtect uint32
PartitionId uint16
RegionSize uintptr
State uint32
Protect uint32
Type uint32
}

// MemoryBasicInformation32 has been derived from the MEMORY_BASIC_INFORMATION32 struct definition.
type MemoryBasicInformation32 struct {
BaseAddress uint32
AllocationBase uint32
AllocationProtect uint32
RegionSize uint32
State uint32
Protect uint32
Type uint32
}

// MemoryBasicInformation64 has been derived from the MEMORY_BASIC_INFORMATION64 struct definition.
type MemoryBasicInformation64 struct {
BaseAddress uint64
AllocationBase uint64
AllocationProtect uint32
__alignment1 uint32
RegionSize uint64
State uint32
Protect uint32
Type uint32
__alignment2 uint32
}

// INOUT-parameter: BaseAddress, RegionSize.
func NtAllocateVirtualMemory(
ProcessHandle Handle,
Expand Down

0 comments on commit 6f83ddb

Please sign in to comment.