Questions tagged [structured-exception]
30 questions
52
votes
5 answers
What should I know about Structured Exceptions (SEH) in C++?
What important points about Structured Exceptions should every C++ developer know?

Andrew T
- 5,549
- 7
- 43
- 55
39
votes
2 answers
Why can't 64-bit Windows unwind user-kernel-user exceptions?
Why can't 64-bit Windows unwind the stack during an exception, if the stack crosses the kernel boundary - when 32-bit Windows can?
The context of this entire question comes from:
The case of the disappearing OnLoad exception – user-mode callback…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
8
votes
1 answer
Is __finally supposed to run after EXCEPTION_CONTINUE_SEARCH?
In the following code, the function foo calls itself recursively once. The inner call causes an access violation to be raised. The outer call catches the exception.
#include
#include
void foo(int cont)
{
__try
{
…

avakar
- 32,009
- 9
- 68
- 103
7
votes
3 answers
intermixing c++ exception handling and SEH (windows)
I have a function in which I call getaddrinfo() to get an sockaddr* which targets memory is allocated by the system.
As many may know, you need to call freeaddrinfo() to free the memory allocated by getaddrinfo().
Now, in my function, there are a…

Juarrow
- 2,232
- 5
- 42
- 61
6
votes
5 answers
How can I guarantee catching a EXCEPTION_STACK_OVERFLOW structured exception in C++ under Visual Studio 2005?
Background
I have an application with a Poof-Crash[1]. I'm fairly certain it is due to a blown stack.
The application is Multi-Threaded.
I am compiling with "Enable C++ Exceptions: Yes With SEH Exceptions (/EHa)".
I have written an SE Translator…

Aaron
- 3,726
- 2
- 26
- 23
5
votes
1 answer
How do I expose through COM an exception caught with structured exceptions handling?
My COM server implemented in Visual C++ uses a ton of other C++ code. That other C++ code sometimes wraps code in __try-__except and translates structured exceptions into custom C++ exceptions. This part I cannot change.
No method of my COM server…

sharptooth
- 167,383
- 100
- 513
- 979
5
votes
1 answer
Mapping external error codes to std::error_condition
I'm looking at modifying the MS structured exception-to-exception mapping code we have to use the new C++11 error_code/error_condition/exception mechanisim.
My understanding is that the general philosiphy is that you should try to map your error…

T.E.D.
- 44,016
- 10
- 73
- 134
4
votes
2 answers
Structured Exception Handler (SEH) does not catch heap corruption
I'm writing small utility (VC 2010, no clr) that does one simple task (rasterizing) using 3rd party library. Later utility will be used by bigger application. Sometimes the utility crashes because of some heap corruption in 3rd party library. That…

AC.
- 714
- 8
- 27
3
votes
1 answer
Under what circumstances does EXCEPTION_RECORD link to another nested exception?
The documentation for _EXCEPTION_RECORD says about one of it's members, struct _EXCEPTION_RECORD *ExceptionRecord
A pointer to an associated EXCEPTION_RECORD structure. Exception records can be chained together to provide additional information…

Tobi
- 2,591
- 15
- 34
3
votes
1 answer
Consequences of using Structured Exception Handling (SEH)?
I see Doug Harrison has made a good statement of what is "wrong" with using (i.e. catching) structured exceptions (see question #3). But what other consequences are there? For example, what happens if I have several projects compiled with /eha,…

Brent Arias
- 29,277
- 40
- 133
- 234
3
votes
1 answer
Recovering context after handling exception only works with VS /RTCs (run time checks) enabled
My end goal here is to provide a means to catch a floating-point exception, print a stack trace, and resume execution with floating point exceptions disabled (using the resulting non-finite/not-a-number values). I've progressed a bit since my…

jHops
- 340
- 1
- 3
- 11
3
votes
1 answer
Configuring floating point unit context in WIN32 vs WIN64
I am attempting to write an unhandled exception filter ( see SetUnhandledExceptionFilter()) to use with Windows SEH to report invalid floating point operations. I'd like to trap the exception, print a stack trace, then disable floating point…

jHops
- 340
- 1
- 3
- 11
2
votes
1 answer
Structured Exceptions (SE) from standard library calls
I've got code that calls ::fgetpos, which results in a kernel exception that can't be caught (I have option /ehs in my VS 2008 project). But I can't help think that standard library routines should never throw these kinds of exceptions.
update:…

Brent Arias
- 29,277
- 40
- 133
- 234
2
votes
0 answers
error C2712 Cannot use __try in functions that require object unwinding
I'm writing a simple C++ WIN32 API program that install&start a windows service. I'm using SEH __try&__finaly in my code. Unfortunately I'm getting a known error as below:
error C2712 Cannot use __try in functions that require object unwinding.
I…
user6691392
2
votes
1 answer
Ways for an unmanaged Windows process to crash?
I am trying to understand the ways in which an unmanaged user-mode Windows process can "crash" (which is really too much of a catch-all term).
Here are the ways I know of so far:
Unhandled Structured Exception
Default UnhandledExceptionFilter:…

Roman Starkov
- 59,298
- 38
- 251
- 324