-
Notifications
You must be signed in to change notification settings - Fork 11
/
DEP.cpp
32 lines (29 loc) · 898 Bytes
/
DEP.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Windows.h>
//
//typedef bool (*FPTR_SetProcessDEPPolicy)(DWORD dwFlags);
//typedef bool (*FPTR_GetProcessDEPPolicy)(HANDLE hProcess,LPDWORD lpFlags,PBOOL lpPermanent);
//
void enableDEP()
{
HMODULE result;
HMODULE v1;
// FPTR_SetProcessDEPPolicy func_SetProcessDEPPolicy;
//FPTR_GetProcessDEPPolicy func_GetProcessDEPPolicy;
HANDLE v4; // eax@4
DWORD lpFlags;
BOOL lpPermanent;
HMODULE handle = GetModuleHandleW(L"Kernel32.dll");
v1 = result;
if ( handle ){
v4 = GetCurrentProcess();
DWORD new_setting;
bool ret = GetProcessDEPPolicy(GetCurrentProcess(), &lpFlags, &lpPermanent);
if ( ret ){
if ( lpFlags & 0x1 ) // // dep is enabled
new_setting = lpFlags;
else
new_setting = true;
ret = SetProcessDEPPolicy(new_setting);// enableDEP
}
}
}