Monday, September 27, 2010

Disable DEP

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 MSDN
SetProcessDEPPolicy Function [Visit]

New NX APIs added to Vista SP1, XP SP3 and Server 2008 [Visit]

No comments:

Post a Comment

Hello

Would try to update this blog from now. many links are broken like platnet source code and many websites shutdown.