HardwareBreakpoints (on Read? on Access?)
-
hey,
nehmen wir einfach mal folgenden beispielcode (nicht von mir!)
#include <Windows.h> #define Addr 0x12fe9c LONG WINAPI __UnhandlerExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) { if(ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP ) { if ((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == Addr) { MessageBox(0, "bp!!!", 0, 0); return EXCEPTION_CONTINUE_EXECUTION; } } return EXCEPTION_CONTINUE_SEARCH; } void Set_Breakpoints() { CONTEXT ctx = {CONTEXT_DEBUG_REGISTERS}; ctx.Dr0 = Addr; ctx.Dr7 = 0x00000001; HANDLE hThread = GetModuleHandle("bpme.exe"); SetThreadContext(hThread, &ctx); } BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved) { if(dwReason == DLL_PROCESS_ATTACH) { MessageBox(0, "attach", 0, 0); CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Set_Breakpoints, 0, 0, 0); } return true; }wie / wo kann ich da nun bestimmen ob der hardware breakpoint on access / on read / on write seien soll? verstehe das nicht ganz.
lg
-
Du musst die Intel-Handbücher lesen, da steht das ausführlichst beschrieben....
Siehe:
http://www.intel.com/products/processor/manuals/
Speziell:
Intel
64 and IA-32 Architectures Software Developer's Manual
Volume 3B: System Programming Guide
http://www.intel.com/Assets/PDF/manual/253669.pdf
-
Und Multiposts sind überflüssig...
http://www.c-plusplus.net/forum/viewtopic-var-p-is-1825432.html#1825432
-
Jochen Kalmbach schrieb:
Und Multiposts sind überflüssig...
http://www.c-plusplus.net/forum/viewtopic-var-p-is-1825432.html#1825432danke für die links.
der andere thread hat nicht direkt mit meinem thema zu tun (- und ist auch nicht von mir).
lg
-
der thread ist nicht von mir, unsere ips könnten auch nicht gleich sein, wie kommst du drauf das es was mit mir zu tun hat?
-- mein problem ist auch ein ganz anderes als seins.
btw. @ bronx
DR7 contains the bits explained here:
Bits Meaning
0-7 Flags for each of the 4 debug registers (2 for each). The first flag is set to specify a local breakpoint (so the CPU resets the flag when switching tasks), and the second flag is set to specify a global breakpoint. In Windows, obviously, you can only use the first flag (although I haven't tried the second).
16-232 bits for each register, defining when the breakpoint will be triggered:
* 00b - Triggers when code is executed
* 01b - Triggers when data is written
* 10b - Reserved
* 11b - Triggers when data is read or written24-31
2 bits for each register, defining the size of the breakpoint:
* 00b - 1 byte
* 01b - 2 bytes
* 10b - 8 bytes
* 11b - 4 bytesquelle:
http://www.codeproject.com/KB/debug/hardwarebreakpoint.aspxso gibst du dein binär prod aus

#include <bitset> #include <iostream> using namespace std; ... Context.Dr7=(1<<0)|(3<<16);// schalte bp 1 an, und setze ihn auf read/write bitset<32> bs = bitset<32>(Context.Dr7); cout << bs << endl; cout << "bit 16: " << bs[16] << " bit 17: " << bs[17] << endl;unter vorraussetzung das du ne console hast.
-
schurke = bronX
-
nein !
-
schnauzer schrieb:
schurke = bronX
Nein!
vielen dank @ Schurke, hat mir weitergeholfen!
lg