Register safe exception handler  
Author Message

PostPosted: Visual C++ General, Register safe exception handler Top

I have a mixed mode dll where i use fs:0 to register my own exception handler. During debugging Visual Studio freezes after the "mov DWORD PTR fs:0, esp" statement executes. The problem doesn't happen during normal execution.

If I turn off mixed mode and only run native, the program executes nicely also during debugging.

There is a compiler warning that I think may be the root of the problem: "Warning C4733: Inline asm assigning to 'FS:0' : handler not registered as safe handler".

I've tried to turn off the check by stating /SAFESEH:NO in the project properties, but that seems to have no effect.

Do I need to add an .asm to the project to register the exception handler as safe In that case, how is that done

I'm running VS2005/.Net 2.0 on Windows XP.


Best regards,
Truls Tveoy

Visual C++3  

PostPosted: Visual C++ General, Register safe exception handler Top

If I try to parse this article, exception handlers need to be registered in the LOAD_CONFIG section of the PE. That can be done by the .SAFESEH directive in an ASM file but not with inline assembly. Maybe there's a new #pragma but I don't see it.

Sounds like a Microsoft anti-virus feature. Whether this has anything to do with the de**** crash is somewhat unlikely...