mirror of https://github.com/x64dbg/GleeBug
fixed DEP policy query (documentation of GetProcessDEPPolicy is total bullshit for x64)
This commit is contained in:
parent
f422383d70
commit
bff2775e7a
|
|
@ -10,6 +10,25 @@ namespace GleeBug
|
||||||
mProcess->systemBreakpoint = true;
|
mProcess->systemBreakpoint = true;
|
||||||
mContinueStatus = DBG_CONTINUE;
|
mContinueStatus = DBG_CONTINUE;
|
||||||
|
|
||||||
|
//get process DEP policy
|
||||||
|
#ifndef _WIN64
|
||||||
|
typedef BOOL(WINAPI * GETPROCESSDEPPOLICY)(
|
||||||
|
_In_ HANDLE /*hProcess*/,
|
||||||
|
_Out_ LPDWORD /*lpFlags*/,
|
||||||
|
_Out_ PBOOL /*lpPermanent*/
|
||||||
|
);
|
||||||
|
static auto GPDP = GETPROCESSDEPPOLICY(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetProcessDEPPolicy"));
|
||||||
|
if (GPDP)
|
||||||
|
{
|
||||||
|
DWORD lpFlags;
|
||||||
|
BOOL bPermanent;
|
||||||
|
if (GPDP(mProcess->hProcess, &lpFlags, &bPermanent))
|
||||||
|
mProcess->permanentDep = lpFlags && bPermanent;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
mProcess->permanentDep = true;
|
||||||
|
#endif //_WIN64
|
||||||
|
|
||||||
//call the callback
|
//call the callback
|
||||||
cbSystemBreakpoint();
|
cbSystemBreakpoint();
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +174,7 @@ namespace GleeBug
|
||||||
//call the debug event callback
|
//call the debug event callback
|
||||||
cbExceptionEvent(exceptionInfo);
|
cbExceptionEvent(exceptionInfo);
|
||||||
|
|
||||||
//dispatch the exception
|
//dispatch the exception (https://msdn.microsoft.com/en-us/library/windows/desktop/aa363082(v=vs.85).aspx)
|
||||||
switch (exceptionInfo.ExceptionRecord.ExceptionCode)
|
switch (exceptionInfo.ExceptionRecord.ExceptionCode)
|
||||||
{
|
{
|
||||||
case STATUS_BREAKPOINT:
|
case STATUS_BREAKPOINT:
|
||||||
|
|
|
||||||
|
|
@ -13,25 +13,6 @@ namespace GleeBug
|
||||||
{
|
{
|
||||||
for (int i = 0; i < HWBP_COUNT; i++)
|
for (int i = 0; i < HWBP_COUNT; i++)
|
||||||
hardwareBreakpoints[i].enabled = false;
|
hardwareBreakpoints[i].enabled = false;
|
||||||
|
|
||||||
// DEP is disabled if lpFlagsDep == 0
|
|
||||||
typedef BOOL(WINAPI * GETPROCESSDEPPOLICY)(
|
|
||||||
_In_ HANDLE /*hProcess*/,
|
|
||||||
_Out_ LPDWORD /*lpFlags*/,
|
|
||||||
_Out_ PBOOL /*lpPermanent*/
|
|
||||||
);
|
|
||||||
static auto GPDP = GETPROCESSDEPPOLICY(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetProcessDEPPolicy"));
|
|
||||||
if (GPDP)
|
|
||||||
{
|
|
||||||
DWORD lpFlags;
|
|
||||||
BOOL bPermanent;
|
|
||||||
if (GPDP(hProcess, &lpFlags, &bPermanent))
|
|
||||||
permanentDep = lpFlags && bPermanent;
|
|
||||||
#ifdef _WIN64
|
|
||||||
else if (GetLastError() == ERROR_NOT_SUPPORTED)
|
|
||||||
permanentDep = true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::StepOver(const StepCallback & cbStep)
|
void Process::StepOver(const StepCallback & cbStep)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue