remove singleshoot breakpoints before the breakpoint callback

This commit is contained in:
Mr. eXoDia 2014-08-15 22:21:22 +02:00
parent 7726d8fcf1
commit fe91cd08b4
1 changed files with 22 additions and 16 deletions

View File

@ -558,8 +558,17 @@ __declspec(dllexport) void TITCALL DebugLoop()
char* DisassembledString = (char*)StaticDisassembleEx(ueCurrentPosition, (LPVOID)instr);
if(strstr(DisassembledString, "PUSHF"))
PushfBPX = true;
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
if(FoundBreakPoint.BreakPointType == UE_SINGLESHOOT)
{
DeleteBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
ResetBPXSize = FoundBreakPoint.BreakPointSize - 1;
ResetBPXAddressTo = NULL;
ResetBPX = false;
}
//execute callback
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
__try
{
myCustomBreakPoint();
@ -568,6 +577,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
}
if(FoundBreakPoint.BreakPointType != UE_SINGLESHOOT)
{
DisableBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
@ -575,13 +585,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
ResetBPXAddressTo = (ULONG_PTR)FoundBreakPoint.BreakPointAddress;
ResetBPX = true;
}
else
{
DeleteBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
ResetBPXSize = FoundBreakPoint.BreakPointSize - 1;
ResetBPXAddressTo = NULL;
ResetBPX = false;
}
}
else
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)FoundBreakPoint.BreakPointAddress, FoundBreakPoint.BreakPointSize, OldProtect, &OldProtect);
@ -1180,8 +1183,17 @@ __declspec(dllexport) void TITCALL DebugLoop()
SetThreadContext(hActiveThread, &myDBGContext);
EngineCloseHandle(hActiveThread);
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)FoundBreakPoint.BreakPointAddress, FoundBreakPoint.BreakPointSize, OldProtect, &OldProtect);
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
if(FoundBreakPoint.BreakPointType == UE_SINGLESHOOT)
{
DeleteBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
ResetBPXSize = FoundBreakPoint.BreakPointSize - 1;
ResetBPXAddressTo = NULL;
ResetBPX = false;
}
//execute callback
myCustomBreakPoint = (fCustomBreakPoint)((LPVOID)FoundBreakPoint.ExecuteCallBack);
__try
{
myCustomBreakPoint();
@ -1190,6 +1202,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
}
if(FoundBreakPoint.BreakPointType != UE_SINGLESHOOT)
{
DisableBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
@ -1197,13 +1210,6 @@ __declspec(dllexport) void TITCALL DebugLoop()
ResetBPXAddressTo = (ULONG_PTR)FoundBreakPoint.BreakPointAddress;
ResetBPX = true;
}
else
{
DeleteBPX((ULONG_PTR)FoundBreakPoint.BreakPointAddress);
ResetBPXSize = FoundBreakPoint.BreakPointSize - 1;
ResetBPXAddressTo = NULL;
ResetBPX = false;
}
}
else
VirtualProtectEx(dbgProcessInformation.hProcess, (LPVOID)FoundBreakPoint.BreakPointAddress, FoundBreakPoint.BreakPointSize, OldProtect, &OldProtect);