Questions tagged [seh]

Microsoft Structured Exception Handling (SEH) is the native exception handling mechanism for Windows.

Microsoft Structured Exception Handling (SEH) is the native exception handling mechanism for Windows.

177 questions
1
vote
1 answer

__try and __except not working in Release build

In my program i really need to use SEH exception handlers, which catch errors like AccessViolation & etc., but handlers work only in Debug build. I have enabled same option in Release build, but it does not work. How to enable SEH in Release mode…
Loryan55
  • 325
  • 4
  • 13
1
vote
3 answers

Is ARM (not Thumb) supported on WinPhone8 at all?

I'm facing a weird issue, somewhat similar to this. I have a Windows Phone 8 native DLL project, mostly C++ but with an ARM assembly source in it. The source is in ARM mode (i. e. not Thumb). C++ is compiled to Thumb. The app crashes when C++ tries…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
vote
2 answers

Template function accepting callable functors with X parameters

I'm writing a hosted C++ program that runs user-written C-code compiled on the fly. It's absolutely vital that certain typical exceptions are caught from the C-code and processed/ignored. To do this, I'm calling the C code from within a structured…
Shaggi
  • 1,121
  • 1
  • 9
  • 31
1
vote
1 answer

Exception handler doesn't call destructors when catching SEH exception

class ScopedShit { public: ScopedShit() { cout << "ScopedShit()" << endl; } ~ScopedShit() { cout << "~ScopedShit()" << endl; } }; void foo() { ScopedShit ss; int x = 0; int y = 5 / x; } int main() { …
prgDevelop
  • 1,557
  • 2
  • 15
  • 26
1
vote
0 answers

__try not catching exception on HeapFree

I'm trying to catch a HeapFree exception.. On MSDN it says HeapFree has undefined behavior when trying to free an already freed pointer. Well, I tried that on VS2010, and it "throwed" a breakpoint (windows has triggered a breakpoint), then an…
Icebone1000
  • 1,231
  • 4
  • 13
  • 25
0
votes
3 answers

Should I use SEH "by default" in C?

When I'm programming C code for Windows, should I "default" to using SEH's __try...__finally blocks, or is it considered bad practice to do so unnecessarily? In other words, which one below (for example) is considered better practice, and why? HDC…
user541686
  • 205,094
  • 128
  • 528
  • 886
0
votes
1 answer

Emiting code with Exception support

I need to generate code at runtime that do the following: auto v_cleanup = std::shared_ptr(nullptr, [](void *){ cleanup(); }); //... do_some_danger_thing(); //... or C equivalent: __try { //... do_some_danger_thing(); //... }…
Earth Engine
  • 10,048
  • 5
  • 48
  • 78
0
votes
1 answer

Does Vector Exception Handlers handle all exceptions in different threads including C++ exceptions?

Continued from my previous question: How to handle SEH exception on a global level Does Vector Exception Handlers catch all exceptions including C++ exceptions? Microsoft's documentation says it is an extension of SEH handlers but I read somewhere…
Batmon
  • 21
  • 5
0
votes
0 answers

Is there a way to leave the exception unhandled after invoking the VectorExceptionHandler the first time?

I want to check if a SEH occurred and if it's of a certain type I don't want to handle it and let the program crash, as it is important for having it generate a dump file. One issue is that my program has a VectorExceptionHandler in main but there…
Batmon
  • 21
  • 5
0
votes
0 answers

Why does SEH in main jump back to same Vector Exception Handler?

I am writing code to test C++ and SEH exceptions. However, on running my code below, the exception again calls the same handler even though I have specified the index to be 0 i.e. the last handler. In my opinion, the ideal handling should be: SEH…
Batmon
  • 21
  • 5
0
votes
0 answers

How to catch SEH thrown from ntdll.dll's TppRaiseInvalidParameter?

I am using MSVC2019 and COM and compiling using /EHa getting a SEH from ntdll.dll from TppRaiseInvalidParameter that I am trying to catch but seem unable to. I know exactly why the exception is thrown, but that is not the issue here. I tried using…
Radu C
  • 303
  • 2
  • 11
0
votes
1 answer

How to set an exception using masm64?

How can i access the exception chain (SEH) using masm64? Using masm32, I get the first exception looking into fs:[0] But when I checked in Windbg if fs:[0] still pointed at the first exception in x64, I figured that it wasn't. I'd like to set an…
ginko
  • 47
  • 5
0
votes
0 answers

Does Clang support SEH?

Edit: I don't mean SEH I mean asynchronous exception handling. As commented SEH is supported by __try, __except. The following example requires asynchronous exception handling (-EHa) which appears to be not available. I tried the structured…
maybourne
  • 23
  • 5
0
votes
1 answer

Is Visual C++ SEH available on other OS?

I learned about Visual C++ Structured Exception Handling (SEH) recently. I am considering implementing it, but my code is supposed to be as cross platform as possible. In the future, I'm thinking of porting ny code to Linux, MAC, Android, IOS and…
0
votes
3 answers

C/C++ SEH Example build failure

I am complete unfamiliar with c/c++. I need to compile a small program to do some analysis. This is the program #include #include #include //#include #include int ExceptionHandler(void); int main(int…
Madhur Ahuja
  • 22,211
  • 14
  • 71
  • 124