DEP (Data Execution Prevention) is a new feature that was introduced with Windows XP SP2 and above, to prevent running of malicious codes, it marks certain memory locations as non-executable. But sometimes it creates problem with applications that are not doing anything harmful and they crashes. In XP SP3 and above Microsoft introduced new APIs that allow us to disable or enable DEP on our applications. This code shows how you can disable or enable DEP at runtime for your applications.
'API In General Declaration Section
Private Declare Function SetProcessDEPPolicy Lib "Kernel32.dll" (ByVal dwFlags As Long) As Long
'To Disable DEP
SetProcessDEPPolicy(0)
'To Enable DEP
SetProcessDEPPolicy(1)
'Note: Once Enabled Using API you cannot disable it Again
More on MSDNSetProcessDEPPolicy Function [
Visit]
New NX APIs added to Vista SP1, XP SP3 and Server 2008 [
Visit]
No comments:
Post a Comment