diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 624c5564..e4f6bd6b 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -193,19 +193,34 @@ namespace Components Command::Execute(command, false); }); +#pragma warning(push) +#pragma warning(disable:4740) // flow in or out of inline asm code suppresses global optimization Command::Add("debug_minidump", [](Command::Params) { CONTEXT ectx; - + ZeroMemory(&ectx, sizeof(CONTEXT)); + ectx.ContextFlags = CONTEXT_CONTROL; + + __asm + { + Label: + mov[ectx.Ebp], ebp; + mov[ectx.Esp], esp; + mov eax, [Label]; + mov[ectx.Eip], eax; + } + EXCEPTION_RECORD erec; - erec.ExceptionAddress = 0x0; + ZeroMemory(&erec, sizeof(EXCEPTION_RECORD)); + erec.ExceptionAddress = _ReturnAddress(); erec.ExceptionCode = EXCEPTION_BREAKPOINT; - EXCEPTION_POINTERS eptr; - eptr.ContextRecord = &ectx; - eptr.ExceptionRecord = &erec; + auto eptr = new EXCEPTION_POINTERS(); + eptr->ContextRecord = &ectx; + eptr->ExceptionRecord = &erec; - Exception::ExceptionFilter(&eptr); + Exception::ExceptionFilter(eptr); }); +#pragma warning(pop) } }