Re: How to recover from a EXCEPTION_STACK_OVERFLOW?



Jochen Kalmbach [MVP] a écrit :
Hallo Aurelien!

Hello,

- modifying ESP by hand (risky)


static LONG __stdcall CrashHandlerExceptionFilter(EXCEPTION_POINTERS* pExPtrs)
{
if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW)
{
static char MyStack[1024*128]; // be sure that we have enought space...
// it assumes that DS and SS are the same!!! (this is the case for Win32)
// change the stack only if the selectors are the same (this is the case for Win32)
//__asm push offset MyStack[1024*128];
//__asm pop esp;
__asm mov eax,offset MyStack[1024*128];
__asm mov esp,eax;
}

// TODO: ...
}

Thanks. I guess I can no longer use pExPtrs after modifying esp, nor any local variable even if declared after the change?

--
Aurélien Regat-Barrel
.



Relevant Pages

  • Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
    ... // change the stack only if the selectors are the same (this is the case for Win32) ... I guess I can no longer use pExPtrs after modifying esp, nor any local variable even if declared after the change? ... But you should not use any local variables, because this increases the stack! ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to recover from a EXCEPTION_STACK_OVERFLOW?
    ... pExPtrs) ... // change the stack only if the selectors are the same (this is the case for Win32) ... // TODO: ... ...
    (microsoft.public.win32.programmer.kernel)

Loading