| View previous topic :: View next topic |
| Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Jan 06, 2013 11:30 pm Post subject: Problem with debug registers |
|
|
While hacking a game I set 3 of the 4 debug registers (Dr0, Dr1, Dr2) to my targets but i'm only getting a breakpoint for the first one (Dr0).
| Code: |
Context.Dr0 = dwTarget1;
Context.Dr1 = dwTarget2;
Context.Dr2 = dwTarget3;
|
I traced to see if there were any calls from the game to SetThreadContext but there were none which meant that they were not setting any breakpoints for the debug registers to be full. And even if they did, my debug registers would overwrite theres.
Why is only one debug register being called? Is there something I missed out on? I can't seem to solve that question.
My Breakpoint function works fine, but if you guys want to double check:
| Code: |
while ( Thread32Next ( hSnapshot, &te ) )
{
// Check the thread
if ( te.th32OwnerProcessID == GetCurrentProcessId () && te.th32ThreadID != GetCurrentThreadId () )
{
// Open the thread
HANDLE hThread = OpenThread ( THREAD_SUSPEND_RESUME | THREAD_SET_CONTEXT | THREAD_GET_CONTEXT, false, te.th32ThreadID );
// Suspend the thread
SuspendThread ( hThread );
// Obtain the thread information
CONTEXT Context;
Context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
// Obtain the thread information
GetThreadContext ( hThread, &Context );
// Find an available regiser and set it
Context.Dr0 = dwTarget1;
Context.Dr1 = dwTarget2;
Context.Dr2 = dwTarget3;
// Set the Dr7 register
Context.Dr7 = 0x1;
// Set the thread information
SetThreadContext ( hThread, &Context );
// Resume the thread
ResumeThread ( hThread );
CloseHandle ( hThread );
}
}
|
|
|
| Back to top |
|
 |
Innovation Grandmaster Cheater
Reputation: 12
Joined: 14 Aug 2008 Posts: 617
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Mon Jan 07, 2013 7:23 am Post subject: |
|
|
No I make my call to Thread32First, I just wanted to show my hooking code.
In that topic, I asked on how to set the bits for the Dr7 breakpoint..
|
|
| Back to top |
|
 |
|