seh

Mixing Win32 SEH with heap-allocated stack frames

一个人想着一个人 提交于 2019-12-13 12:48:42
问题 Is there a way to escape the "one big stack" model of Win32 without crippling SEH? I'd like to be able to allocate stack frames on the heap, as a way to implement coroutines. However, my code is currently depending on SEH, and this article, a few pages down, says (relating to traversal of exception handlers, scanning, emphasis mine): The OS is pretty paranoid about corrupt stacks during this chain traversal. It checks that all chain entries are within the bounds of the stack . (These bounds

Is it legal and possible to access the return value in a finally block?

我只是一个虾纸丫 提交于 2019-12-12 14:40:01
问题 I wish to set a usererror string before leaving a function, depending on the return code and variable in the function. I currently have: Dim RetVal as RetType try ... if ... then RetVal = RetType.FailedParse end try endif ... finally select case RetVal case ... UserStr = ... end select end try return RetVal Is it possible to use return RetType.FailedParse, then access this in the finally block? 回答1: The only real way of doing this in C# would be to declare a variable at the start of the

Template function accepting callable functors with X parameters

こ雲淡風輕ζ 提交于 2019-12-11 07:35:50
问题 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 exception handling block. Due to the nature and semantics of this block (and where it's called from), I've separated the actual calling to it's own function: template <typename ret_type, class func> static ret_type Cstate::RunProtectedCode(func

How do I interpret GetExceptionCode results when using SEH?

我的未来我决定 提交于 2019-12-11 04:26:00
问题 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 able to identify these errors without access to the source code. I have something put together from various SEH error handling routines, but although it works, there are several... inconsistencies with it. I'm trying to isolate each one, and I'm

__try and __exception portability

早过忘川 提交于 2019-12-11 03:42:14
问题 Hello and excuse me again I am reading "Detecting Multiprocessor Topology in IA-32 Architecture" from Intel. I was recoding the example. However I read this sentences __try and __except in the code. I found MSDN Microsoft web page some information but I am using gcc compiler/linker are __try and __except valid sentences in gcc? are __try and __except portable sentences on *nux environments? do exist a better mode than __try and __except sentences for exception handling in C? Thanks in advance

What happens when a fault occurs during stack unwinding on Windows?

柔情痞子 提交于 2019-12-11 00:50:35
问题 What happens when a fault occurs during the SEH stack unwinding on Windows? For example, if the unwind info is corrupted or incorrect, or the stack has been overwritten with invalid data, and a GP fault occurs during the unwind process? Is the diagnostic dialog still presented to the user or is there a different behavior in this case? 来源: https://stackoverflow.com/questions/45335145/what-happens-when-a-fault-occurs-during-stack-unwinding-on-windows

Structured exception handling with a multi-threaded server

我是研究僧i 提交于 2019-12-10 15:52:14
问题 This article gives a good overview on why structured exception handling is bad. Is there a way to get the robustness of stopping your server from crashing, while getting past the problems mentioned in the article? I have a server software that runs about 400 connected users concurrently. But if there is a crash all 400 users are affected. We added structured exception handling and enjoyed the results for a while, but eventually had to remove it because of some crashes causing the whole server

64bit exceptions in WndProc silently fail

烂漫一生 提交于 2019-12-09 17:14:35
问题 The following code will give a hard fail when run under Windows 7 32bit: void CTestView::OnDraw(CDC* /*pDC*/) { *(int*)0 = 0; // Crash CTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: add draw code for native data here } However, if I try this on Windows 7 64bit, I just get this in the output window: First-chance exception at 0x13929384 in Test.exe: 0xC0000005: Access violation writing location 0x00000000. First-chance exception at 0x77c6ee42 in Test.exe:

How to add a (SEH) exception handler dynamically for a 64-bit function?

淺唱寂寞╮ 提交于 2019-12-09 05:11:27
Say, if I have a function that is injected into another 64-bit process (for instance, using CreateRemoteThread ) and I want to implement Structured Exception Handling in that function (otherwise done via __try , __except , __finally blocks), can I add the SEH handler/filter dynamically? PS. The reason I'm asking is because SEH is no longer implemented via a stack frame in 64-bit processes (as it used to be in x86.) All SEH entries are now in the PE header of the target process image file. 来源: https://stackoverflow.com/questions/48675663/how-to-add-a-seh-exception-handler-dynamically-for-a-64

How to add a (SEH) exception handler dynamically for a 64-bit function?

允我心安 提交于 2019-12-08 05:23:25
问题 Say, if I have a function that is injected into another 64-bit process (for instance, using CreateRemoteThread) and I want to implement Structured Exception Handling in that function (otherwise done via __try , __except , __finally blocks), can I add the SEH handler/filter dynamically? PS. The reason I'm asking is because SEH is no longer implemented via a stack frame in 64-bit processes (as it used to be in x86.) All SEH entries are now in the PE header of the target process image file. 来源: