File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,18 @@ namespace detail {
18
18
namespace pi {
19
19
20
20
void *loadOsLibrary (const std::string &PluginPath) {
21
- return (void *)LoadLibraryA (PluginPath.c_str ());
21
+ // Tells the system to not display the critical-error-handler message box.
22
+ // Instead, the system sends the error to the calling process.
23
+ // This is crucial for graceful handling of plugins that couldn't be
24
+ // loaded, e.g. due to missing native run-times.
25
+ // TODO: add reporting in case of an error.
26
+ // NOTE: we restore the old mode to not affect user app behavior.
27
+ //
28
+ UINT SavedMode = SetErrorMode (SEM_FAILCRITICALERRORS);
29
+ auto Result = (void *)LoadLibraryA (PluginPath.c_str ());
30
+ (void )SetErrorMode (SavedMode);
31
+
32
+ return Result;
22
33
}
23
34
24
35
int unloadOsLibrary (void *Library) {
You can’t perform that action at this time.
0 commit comments