diff options
author | Fredrik Orderud <forderud@gmail.com> | 2017-01-10 11:58:57 +0100 |
---|---|---|
committer | Fredrik Orderud <forderud@gmail.com> | 2017-01-13 07:24:39 +0000 |
commit | d14b0f4eebb54c60596750150c5c32f65f67a7df (patch) | |
tree | c218b09c8b0a15736a3f50ea9c8ac5c7ed9653b8 | |
parent | 7352050562309668e55d46db2d8ab59cd76a7092 (diff) | |
download | qtactiveqt-d14b0f4eebb54c60596750150c5c32f65f67a7df.tar.gz |
Disable SEH & C++ exception handling by COM for out-of-process controls
[ChangeLog][ActiveQt] Out-of-process ActiveQt controls no longer silently
discards unhandled SEH or C++ exceptions that would otherwise crash the
application. Done to make crashes visible, simplify debugging and enable
automatic crash dump generation through Windows error reporting.
Recommended by Microsoft in
https://msdn.microsoft.com/en-us/library/aa344211.aspx
Change-Id: I76d8872a215551893e2423f412001cb8c404e370
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/activeqt/control/qaxservermain.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp index 7aec11d..de1c5a5 100644 --- a/src/activeqt/control/qaxservermain.cpp +++ b/src/activeqt/control/qaxservermain.cpp @@ -239,6 +239,21 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, if (run) { if (SUCCEEDED(CoInitialize(0))) { +#ifdef Q_CC_MINGW + // define GlobalOptions class ID locally for MinGW, since it's missing from the distribution + static const CLSID CLSID_GlobalOptions = + { 0x0000034B, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; +#endif + // Disable C++ & SEH exception handling by the COM runtime for out-of-process COM controls. + // Done to prevent silent crashes and enable crash dump generation. + IGlobalOptions *globalOptions = nullptr; + if (SUCCEEDED(CoCreateInstance(CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER, + IID_IGlobalOptions, reinterpret_cast<void **>(&globalOptions)))) { + globalOptions->Set(COMGLB_EXCEPTION_HANDLING, COMGLB_EXCEPTION_DONOT_HANDLE_ANY); + globalOptions->Release(); + globalOptions = nullptr; + } + { struct Arg { int c; |