Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

ReadProcessMemory (kernel32)
 
.
Summary

C# Signature:

[DllImport("kernel32.dll")]
public static extern int VirtualQueryEx(
     IntPtr handle,
     IntPtr adress,
     out ProcessQueryInformation processQuery,
     uint length
);

User-defined structures

    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
    }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions