How catch a specific hardware exception with try/catch?

  • Thread starter Thread starter PHBecker
  • Start date Start date
P

PHBecker

Guest
I have understood that I can filter exceptions in a __try/__except construct and find out about the nature of the exception.

However, many of the methods I am referring to in my code are using exceptions which I have to catch with catch, so I have to continue using try/catch structures which work fine to some extent but I do not see a way to isolate the hardware exception code.

Here's a short example:


int APIENTRY wWinMain ( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )
{
int A=3, B=0;
int RCode;

try
{
RCode=A / B;
}
catch( DWORD V )
{
}
catch( int V )
{
}
catch(...)
{

// divide by zero error caught here ...
}
}


The INTEGER_DIVIDE_BY_ZERO exception is caught by the ellipsis block, and I would like to get the relating hardware error code. Do I have to use another type of catch block, or is there a kernel function which returns me that code?

Regards

Continue reading...
 
Back
Top