[DllImport("kernel32.dll", SetLastError=true)]
static extern IntPtr GetProcessDEPPolicy(IntPtr hProcess, out Policy lpFlags, out bool lpPermanent);
Declare Function GetProcessDEPPolicy Lib "kernel32.dll" (TODO) As TODO
None.
[System.Flags]
public enum Policy : uint {
DISABLED = 0x0,
PROCESS_DEP_ENABLE = 0x00000001,
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION = 0x00000002
}
Do you know one? Please contribute it!
GetProcessDEPPolicy is supported for 32-bit processes only. If this function is called on a 64-bit process, it fails with ERROR_NOT_SUPPORTED.
Please add some!
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);
}