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
0
votes
1 answer

Why are objects not cleared after hardware exception?

I am learning exception models in c++. Following example showed interesting result for me #include struct A { A(int order) : m_order(order){} ~A(){printf("~A(%d)\n", m_order);} int m_order; }; void foo(void) { A a2 = 2; …
Alex Aparin
  • 4,393
  • 5
  • 25
  • 51
0
votes
0 answers

Why to use `SEH` and how to use it properly?

I'm learning Shell Extensions from an old but nevertheless outstanding "The Complete Idiot's Guide" series of articles by Michael Dunn. The second part describes an extension that allows to register and unregister COM Servers via context menu.…
Jyrkka
  • 526
  • 1
  • 8
  • 26
0
votes
0 answers

throw .net-wrappable exception from native COM-Dll

In a native-C++-Dll (MFC): how to throw an Exception (with some additional text) that can be catched and handled from a .NET-Client? This is the native-MFC-Dll which wants to throw an Exception: void…
suriel
  • 191
  • 1
  • 10
0
votes
0 answers

Are there any disadvantages to using the __try/__finally extension in my Windows C library?

I am writing a Windows-specific library in C and am considering the use of try-finally statements, a Microsoft extension to the C language, to streamline my code for cleaning up resources even in cases of unexpected failures. An example is given in…
Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
0
votes
1 answer

Masm32 jump to label in other module after seh handler handled exception

I am trying an method of anti-debug. First I did everything nessissery and raised an exception by a line of not corrected code assume fs:nothing push offset antiDebug ;function to deal with exception push fs:[0] mov fs:[0],esp …
ooo cherro
  • 55
  • 4
0
votes
0 answers

Crash Dump and SEH with variadic argument unwinding error

I'm trying to create a thread wrapper that will execute a lambda function with N parameters INSIDE a __try / __except as defined here: https://learn.microsoft.com/en-us/cpp/cpp/structured-exception-handling-c-cpp?view=vs-2019 The application is not…
Alexandre Severino
  • 1,563
  • 1
  • 16
  • 38
0
votes
2 answers

SEH error reporting

I have a Visual Studio 2008 C++ program where the program is wrapped in a __try/__except block to capture any SEH exceptions. The exception filter creates an error log and gives the user detailed instructions on how to submit a defect report. Does…
PaulH
  • 7,759
  • 8
  • 66
  • 143
0
votes
1 answer

handling SEH exception of specific type (access violation only)

In order to handle access violation exception, project should be configured with SEH Exceptions (/EHa). I'm looking for handling access violation exceptions only. According to this Microsoft publication here, in order to catch this SEH exceptions,…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
0
votes
0 answers

Windows SEH - What exactly is __except_handler3?

My current understanding of SEH in windows is that when an exception occurs the OS uses the FS:[0] register which contains the address of a _EXCEPTION_RECORD linked list which in turn has a plethora of functions that might or might not handle the…
Trey
  • 474
  • 2
  • 9
  • 32
0
votes
0 answers

Different seh filtering in x86 and x64

I am implementing logging of error message (It includes information of exception backtrace). I asked similar question how to do this at Reliable way to print exception backtrace in catch handler?. I decided to check out callstacks at x86 and x64…
Alex Aparin
  • 4,393
  • 5
  • 25
  • 51
0
votes
0 answers

Are boost::bind and boost::function compatible with SEH?

I have a function that uses boost::bind to move function evaluation into a try/catch wrapper, based on this question. Problem is, boost::bind doesn't seem to work with SEH - and worse, it returns a garbage value, which is exactly what I don't…
Carbon
  • 3,828
  • 3
  • 24
  • 51
0
votes
0 answers

Handling a PCI driver exceptions in Qt5.7/C++ mingw

I've a PCI card (PISO Encoder 600/300) in which reads data from a sensor. In computers that the PCI card is not connected, the code crashes and I've tried to handle the exception by using try/catch but the exception didn't caught: try { …
Mosi
  • 1,178
  • 2
  • 12
  • 30
0
votes
0 answers

Is it possible to dump local variables value in VEH or SEH exception handler?

Is it possible to dump local variables value in VEH or SEH exception handler? In the exception context, we can get the registers SS,SP,BP... Can I get the local vairable value by these registers? and how? If we return EXCEPTION_CONTINUE_EXECUTION in…
0
votes
0 answers

Nested __try __except inside exception filter function

Is it officially documented anywhere is it permitted to use nested SEH inside exception filter? I'm talking about this: __try { buggy_function_1(); } __except(filter_function()) { // ... } and int filter_function() { __try { …
firk
  • 339
  • 2
  • 10
0
votes
1 answer

How do I use _controlfp_s when using SEH?

I have been trying to write some error-protection clauses for identifying problems in a dll which is provided to us by an third party. There may be problems in this dll (memory exceptions, floating point errors, etc), and it is advantageous to be…
Mike Sadler
  • 1,750
  • 1
  • 20
  • 37