/* * Design: * * ScripterResume MUST be called from within the debug loop * - BP callback * - or via plugin interface: + Call to ScripterAutoDebug which loads exe and calls DebugLoop and calls ScripterResume on EP + it will immediately return, this is needed for returning to the debug loop + and executing until a breakpoint/exception occurs: + + / + DebugLoop() + ^ + OnBP/OnException callback | + OllyLang::Step() | ^ [do commands until return to loop is required (RUN, STI, etc.)] | - | ^ - \ - \ \ When done, call FinishedCallback \ (if script loaded inside debug loop and not via ScripterExecuteScript) \ or return */ // TitanEngine plugin callbacks void TitanDebuggingCallBack(DEBUG_EVENT debugEvent, int CallReason) { switch (CallReason) { case Ue.UE_PLUGIN_CALL_REASON_POSTDEBUG: break; case Ue.UE_PLUGIN_CALL_REASON_EXCEPTION: switch (debugEvent.dwDebugEventCode) { case DEBUG_EVENT.CREATE_PROCESS_DEBUG_EVENT: scriptInterpreter.InitGlobalVariables(); break; case DEBUG_EVENT.EXCEPTION_DEBUG_EVENT: if (scriptInterpreter.script_running) { rulong NewIP = debugger.GetContextData(eContextData.UE_CIP); //if(debugEvent.u.Exception.ExceptionRecord.ExceptionCode == 1) // EXCEPTION_BREAKPOINT) NewIP--; //DBG_LOG("Exception debug event @ " + Helper.rul2hexstr(NewIP)); //$LATER if (NewIP != OldIP) { scriptInterpreter.debuggee_running = false; } //$LATER //if(!debugEvent.u.Exception.dwFirstChance) // ollylang.OnException(); OldIP = NewIP; } break; } break; } }
/* Design: ScripterResume MUST be called from within the debug loop - BP callback - or via plugin interface: + Call to ScripterAutoDebug which loads exe and calls DebugLoop and calls ScripterResume on EP it will immediately return, this is needed for returning to the debug loop and executing until a breakpoint/exception occurs: / + DebugLoop() ^ + OnBP/OnException callback | + OllyLang::Step() ^ [do commands until return to loop is required (RUN, STI, etc.)] | - ^ - \ - When done, call FinishedCallback (if script loaded inside debug loop and not via ScripterExecuteScript) or return */ // TitanEngine plugin callbacks void TitanDebuggingCallBack(DEBUG_EVENT debugEvent, int CallReason) { switch (CallReason) { case Ue.UE_PLUGIN_CALL_REASON_POSTDEBUG: break; case Ue.UE_PLUGIN_CALL_REASON_EXCEPTION: switch (debugEvent.dwDebugEventCode) { case DEBUG_EVENT.CREATE_PROCESS_DEBUG_EVENT: scriptInterpreter.InitGlobalVariables(); break; case DEBUG_EVENT.EXCEPTION_DEBUG_EVENT: if (scriptInterpreter.script_running) { rulong NewIP = debugger.GetContextData(eContextData.UE_CIP); //if(debugEvent.u.Exception.ExceptionRecord.ExceptionCode == 1) // EXCEPTION_BREAKPOINT) NewIP--; //DBG_LOG("Exception debug event @ " + Helper.rul2hexstr(NewIP)); //$LATER if (NewIP != OldIP) scriptInterpreter.debuggee_running = false; //$LATER //if(!debugEvent.u.Exception.dwFirstChance) // ollylang.OnException(); OldIP = NewIP; } break; } break; } }