Re: std::uncaught_exception( ) is not supported by VC++ 6 SP6

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Eugene Gershnik (gershnik_at_hotmail.com)
Date: 07/09/04


Date: Fri, 9 Jul 2004 13:08:59 -0700

Antonio wrote:
> Unfortunately as Doug wrote std::uncaught_exception( ) is not
> supported by VC++ 6 (even SP6) and always returns false. Does
> anyone have an idea how this situation can be manually detected
> probably by mean of some assembler code?
>

There is a way but it is complicated and will bind you to a specific version
of CRT you are using.
First of all check http://www.windevnet.com/documents/win0212a/ (requires
registration) for some background info.

The function that performs the actual catch() is

void * __cdecl _CallCatchBlock2(struct EHRegistrationNode *,struct
_s_FuncInfo const *,void *,int,unsigned long);

You will need to hook it to set some TLS flag that will tell you that an
exception is in fact caught. Combine it with a hook on __CxxThrowException
and you will have a reliable std::uncaught_exception replacement.

--
Eugene


Relevant Pages