Dan Hall
Dan Hall

Reputation: 1534

Get DEP Setting

I need to determine if Windows DEP is disabled, set to essential windows programs and services or all programs except those I select.

I've searched for a way of doing this but haven't had any success. Is there a way of doing this? Developing in C#.

Upvotes: 2

Views: 606

Answers (1)

BryanJ
BryanJ

Reputation: 8563

public enum DepSystemPolicyType
{
    AlwaysOff = 0,
    AlwaysOn,
    OptIn,
    OptOut
}

[DllImport("kernel32.dll")]
static extern int GetSystemDEPPolicy();

public static void ValidateDepPolicy()
{
    int policy = GetSystemDEPPolicy();
    //here you can evaluate the return value
    //against the enum DepSystemPolicyType
}

MSDN documentation: GetSystemDEPPolicy function

Upvotes: 6

Related Questions