32 bit testing code for memory breakpoints

This commit is contained in:
mrexodia 2017-02-04 05:19:35 +01:00
parent 7c38a18c5f
commit 2198e3c4e3
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 12 additions and 4 deletions

View File

@ -19,12 +19,16 @@ protected:
printf("Reached entry breakpoint! GIP: 0x%p\n", printf("Reached entry breakpoint! GIP: 0x%p\n",
mRegisters->Gip()); mRegisters->Gip());
#ifdef _WIN64 #ifdef _WIN64
printf("RBX: 0x%p\n", mRegisters->Rbx()); auto addr = mRegisters->Rbx();
if (mProcess->SetMemoryBreakpoint(mRegisters->Rbx(), 0x1000, this, &MyDebugger::cbMemoryBreakpoint, MemoryType::Execute)) #else
auto addr = mRegisters->Esi();
#endif //_WIN64
printf("Addr: 0x%p\n", addr);
if (mProcess->SetMemoryBreakpoint(addr, 0x1000, this, &MyDebugger::cbMemoryBreakpoint, MemoryType::Execute))
puts("Memory breakpoint set!"); puts("Memory breakpoint set!");
else else
puts("Failed to set memory breakpoint..."); puts("Failed to set memory breakpoint...");
#endif
//system("pause"); //system("pause");
/*if (mProcess->DeleteBreakpoint(info.address)) /*if (mProcess->DeleteBreakpoint(info.address))
@ -77,7 +81,11 @@ protected:
printf("No free hardware breakpoint slot...\n");*/ printf("No free hardware breakpoint slot...\n");*/
//https://github.com/mrexodia/GleeBugMembpTest //https://github.com/mrexodia/GleeBugMembpTest
#ifdef _WIN64
entry = ptr(createProcess.lpBaseOfImage) + 0x1060; //MembpTest, main.cpp:43 (x64) entry = ptr(createProcess.lpBaseOfImage) + 0x1060; //MembpTest, main.cpp:43 (x64)
#else
entry = ptr(createProcess.lpBaseOfImage) + 0x108F; //MembpTest, main.cpp:43 (x32)
#endif //_WIN64
if(mProcess->SetBreakpoint(entry, this, &MyDebugger::cbEntryBreakpoint, true)) if(mProcess->SetBreakpoint(entry, this, &MyDebugger::cbEntryBreakpoint, true))
printf("Breakpoint set at 0x%p!\n", entry); printf("Breakpoint set at 0x%p!\n", entry);
else else

View File

@ -9,7 +9,7 @@ static void testDebugger()
#ifdef _WIN64 #ifdef _WIN64
wchar_t szFilePath[256] = L"c:\\MembpTest_x64.exe"; wchar_t szFilePath[256] = L"c:\\MembpTest_x64.exe";
#else //x86 #else //x86
wchar_t szFilePath[256] = L"c:\\test32.exe"; wchar_t szFilePath[256] = L"c:\\MembpTest_x32.exe";
#endif //_WIN64 #endif //_WIN64
wchar_t szCommandLine[256] = L""; wchar_t szCommandLine[256] = L"";
wchar_t szCurrentDir[256] = L"c:\\"; wchar_t szCurrentDir[256] = L"c:\\";