c - A manually installed SEH doesn't work in inner blocks -
after reading crash course , few posts here, i've implemented basic version. requirement able "catch" exception (only 'win32', don't throw/raise any) , exit thread raised it. have prototyped function calls 'exitthread', , 'exception_registration' struct has in it's handler property, , actual previous handle in previous property. set handler calling:
bool set_my_handler(){ exception_registration* p_excep = &excep // excep global static exception_registration __asm{ mov eax, p_excep mov fs:[0],eax } ... }
the problem: when cause exception (say by:
* (dword*) 0 = 0;)
in same scope called set_my_handler, handler called expected. but, if cause same exception in inner block, calling function it, it's doesn't work. unhandled exception messagebox. while debugging, i've noticed fs:[0] remains same (pointing handler) in inner function. btw, i'm not using (try/catch or try/_except in code)
i appreciate help, thanks.
the reply problem (thanks raymond chen): turns out exception registration entities must allocated on stack, there's security mechanism verifies location against stack segment registers.
c winapi seh
No comments:
Post a Comment