For those of you, who dont know about GetSystemDEPPolicy Function, Please refer to this link:
For others lets see on implementing this:
Gets the data execution prevention (DEP) policy setting for the system.
Syntax in C++:
DEP_SYSTEM_POLICY_TYPE WINAPI GetSystemDEPPolicy(void);
Describe a typedef in the beginning.
typedef DEP_SYSTEM_POLICY_TYPE (WINAPI *ptr_getsystemdeppolicy) (void);
Next you will need to load the kernel32.dll. You can do that using GetModuleHandleW. After this,
ptr_getsystemdeppolicy ptrfunc = (ptr_getsystemdeppolicy)GetProcAddress(hMod,”GetSystemDEPPolicy”);
DEP_SYSTEM_POLICY_TYPE var = ptrfunc();
From the above you can get the state of the DEP. But his works I think on XP SP3 and above. For others you will need to manually read c:boot.ini.