[DllImport("kernel32.dll")]
public static extern int VirtualQueryEx(
IntPtr handle,
IntPtr adress,
out ProcessQueryInformation processQuery,
uint length
);
public enum ProtectionConstant
{
Execute = 0x10,
ExecuteAndRead = 0x20,
ExecuteAndReadAndWrite = 0x40,
ExecuteWithWriteCopy = 0x80,
NoAccess = 0x01,
ReadOnly = 0x02,
ReadAndWrite = 0x04,
WriteCopy = 0x08,
Guard = 0x100,
NoCache = 0x200,
WriteCombine = 0x400,
}
public enum QueryState
{
Commit = 0x1000,
Free = 0x10000,
Reserved = 0x2000,
}
public enum MemoryType
{
Image = 0x1000000,
Mapped = 0x40000,
Private = 0x20000,
}
[StructLayout(LayoutKind.Sequential)]
public struct ProcessQueryInformation
{
public IntPtr BaseAdress; // void*
public IntPtr AllocationBase; // void*
public ProtectionConstant AllocationProtect; // DWORD
public uint RegionSize; // size_t
public QueryState State; // DWORD
public ProtectionConstant Protect; // DWORD
public MemoryType Type; // DWORD
}
