Questions tagged [seh]
Microsoft Structured Exception Handling (SEH) is the native exception handling mechanism for Windows.
184
questions
1
vote
1
answer
129
views
How to fill EXCEPTION_RECORD properly for a RtlUnwindEx call?
I am trying to manually handle a C++ exception ,caused by dynamically loaded code, through a VEH handler.At first I capture the exception with VEH then perform a stackwalk then call the ...
0
votes
0
answers
32
views
SEH exception on GitHub Workflow with Glog and Gtest
My project looks like this:
.bazelrc:
build:vs2022 --copt=-DWIN32_LEAN_AND_MEAN
build:vs2022 --cxxopt=/std:c++20
build:vs2022 --cxxopt=/utf-8
build:vs2022 --cxxopt=/Zc:__cplusplus
build:vs2022 --...
3
votes
0
answers
80
views
Is it possible to compile programs that use ATL using GCC (MinGW or otherwise) given it uses __try?
I'm confused how people use MinGW to compile Windows programs.
I tried using it, but headers like atlalloc.h and atlcom.h use __try in a few ways... which no version of GCC appears to support, for ...
0
votes
0
answers
9
views
Does a pure C program need to follow the part of ABI about proper prologue or .xdata when compiled on Win64?
Let's say, if I don't care exceptions -- I will neither throw nor catch a exception, or need I exceptions pass through the pure C stack. Then do I need to care the xdata or SEH things?
That is, are ...
0
votes
0
answers
40
views
Getting value of a non-volatile register in language-specific exception handler
What is the expected/cleanest way of getting the value of a non-volatile register in a language-specific exception handler in x64 (see MSDN)?
It seems that such a handler gets two "CONTEXT"-...
1
vote
0
answers
90
views
How can I handle the Privileged Instruction Exception on Windows?
I have written a code that checks presence of VMWare hypervisor by testing the in instruction. I can't use __try/__except keywords since I build for MinGW.
static char inside_vm;
static LONG WINAPI ...
5
votes
0
answers
95
views
Reason for (win) x64-calling convention restrictions in epilogues
I'm trying to understand the actual reasoning behind the restrictions that the x64 calling convention has on epilogues, at least on Windows? Quoting from MSDN:
The epilog code must follow a strict ...
0
votes
1
answer
95
views
Equivalent pointer probe from MSVC to GCC in a library
First, let me say I'm primarily a Windows developer.
I'm looking at porting some existing code C++ code from Windows+MSVC to Ubuntu+GCC. Part of what I'm porting includes an MSFT-only idiom that I'm ...
0
votes
1
answer
486
views
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 ...
0
votes
0
answers
301
views
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 ...
1
vote
0
answers
44
views
How to get Thread Id from the exception pointer in the VectorExceptionHandler?
I want to get the thread Id of the thread where SEH exception occurred. I currently have the Handler installed in Main, so need the thread Id where the exception happened.
LONG WINAPI VehHandler(...
-2
votes
1
answer
456
views
How to handle SEH exception on a global level
I wanted to catch SEH exception globally i.e. if a SEH exception occurs in a thread of an object of ClassB called in ClassA, is it possible to catch the SEH exception in Main (ClassA instance is ...
1
vote
1
answer
107
views
How do I modify the instruction pointer from a handler function in Windows/MASM?
I want to use an exception/trap handler from assembly, but I don't know how to actually modify the context of the offending frame.
My code:
_TEXT segment para 'CODE'
MyHandler proc
call ...
1
vote
2
answers
89
views
Does SEH make stores/writes more expensive?
I'm comparing two different methods of buffer checking.
The first method is to check on every iteration if the end of the buffer has been reached, and the second method is to use a guard page to ...
-2
votes
1
answer
379
views
How to solve access violation reading location in google test?
I am trying to run Google test with the below code. I am reading some memory location for register value with code similar to the examples below.
Header file :
typedef union MYREG
{
uint32_t u32reg;
...