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

GetProcessDEPPolicy (kernel32)
 
.
Summary
Gets the data execution prevention (DEP) and DEP-ATL thunk emulation settings for the specified 32-bit process.

C# Signature:

[DllImport("kernel32.dll", SetLastError=true)]
static extern IntPtr GetProcessDEPPolicy(IntPtr hProcess, out Policy lpFlags, out bool lpPermanent);

VB Signature:

Declare Function GetProcessDEPPolicy Lib "kernel32.dll" (TODO) As TODO

User-Defined Types:

None.

Policy:

[System.Flags]
public enum Policy : uint {
    DISABLED = 0x0,
    PROCESS_DEP_ENABLE = 0x00000001,
    PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION = 0x00000002
}

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

GetProcessDEPPolicy is supported for 32-bit processes only. If this function is called on a 64-bit process, it fails with ERROR_NOT_SUPPORTED.

Tips & Tricks:

Please add some!

Sample Code:

var result = default(Policy);
var per = false;
var policy = GetProcessDEPPolicy((IntPtr)(-1), out result, out per);
if(policy == default(IntPtr)) {
    throw new Win32Exception(Marshal.GetLastWin32Error());
}else {
    Console.WriteLine("Process DEP policy: " + result);
    Console.WriteLine("Permanent: " + per);
}

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
Edit This Page
Find References
Show Printable Version
Revisions