- Code: Select all
VOID On_Open_FOO_EXE( HANDLE hHandle, DWORD dwProcess )
{
PrintF("Foo opened!");
if (!AttachDebugger())
{
PrintF("Failed to attach debugger!");
//return;
}
SCRIPT_ADD_BP bp1 = {0};
bp1.pcName = "Breakpoint 1";
bp1.aAddress = 0x1234567;
bp1.iType = SPBT_EXECUTE;
bp1.bHardware = true;
bp1.iProlog = SYS_FUNCS_SCRIPT_FUNC;
bp1.dwNewParms[0] = 1;
bp1.bSet = true;
if (AddBreakpoint(&bp1, NULL))
PrintF("BP 1 set!");
SCRIPT_ADD_BP bp2 = {0};
bp2.pcName = "Breakpoint 2";
bp2.aAddress = 0x1234560;
bp2.iType = SPBT_EXECUTE;
bp2.bHardware = true;
bp2.iProlog = SYS_FUNCS_SCRIPT_FUNC;
bp2.dwNewParms[0] = 1;
bp2.bSet = true;
if (AddBreakpoint(&bp2, NULL))
PrintF("BP 2 set!");
return;
}
void On_BP_1(LPVOID lpvAddress, LPPROC_INFO_MHS lpProcInfo)
{
lpProcInfo->pcContext->Eax = 0x40;
lpProcInfo->bSetContext = true;
}
void On_BP_2(LPVOID lpvAddress, LPPROC_INFO_MHS lpProcInfo)
{
lpProcInfo->pcContext->Eax = 0x40;
lpProcInfo->bSetContext = true;
}
For some reason, this either:
a.) crashes my game or
b.) BP 2 will not be set to hardware, even tho it is set correctly above.
What am I doing wrong?