]> mj.ucw.cz Git - pciutils.git/commitdiff
windows: Do not show unwanted file-not-found GUI message box
authorPali Rohár <pali@kernel.org>
Fri, 29 Mar 2024 20:19:27 +0000 (21:19 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 5 Apr 2024 11:14:06 +0000 (13:14 +0200)
Sometimes SEM_FAILCRITICALERRORS flag (disable critical-error-handler GUI
messages) is not enough for LoadLibrary() and SEM_NOOPENFILEERRORBOX flag
(disable file-not-found GUI messages) is needed too to prevent showing GUI
messages on LoadLibrary() failures.

lib/i386-io-windows.h
lib/win32-helpers.c
lib/win32-sysdbg.c

index d2da45295a0570768978ccf2a51042c887ba1f24..8f8cffdb8c7d1af271407e1326eecccafc56f8bb 100644 (file)
@@ -150,11 +150,12 @@ SetProcessUserModeIOPL(VOID)
   BOOL ret;
 
   /*
-   * Load ntdll.dll library with disabled critical-error-handler message box.
+   * Load ntdll.dll library with disabled critical-error-handler and
+   * file-not-found message box.
    * It means that NT kernel does not show unwanted GUI message box to user
    * when LoadLibrary() function fails.
    */
-  prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS);
+  prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
   ntdll = LoadLibrary(TEXT("ntdll.dll"));
   win32_change_error_mode(prev_error_mode);
   if (!ntdll)
index 5338efa21b3faab9eddc6d6cc5d347d852e1383d..0190f21531f29b4ce5dfbb9f475c9ac63906b9cb 100644 (file)
@@ -948,7 +948,7 @@ win32_find_and_open_process_for_query(LPCSTR exe_file)
        * On older NT-based systems these functions are available in
        * psapi.dll library without K32 prefix.
        */
-      prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS);
+      prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
       psapi = LoadLibrary(TEXT("psapi.dll"));
       win32_change_error_mode(prev_error_mode);
 
index 0c175ca31387592fcf62f768c7b60e759ca59937..6847fee00db32c836e97ec8f82ffa0c81b390929 100644 (file)
@@ -125,7 +125,7 @@ win32_sysdbg_setup(struct pci_access *a)
   if (win32_sysdbg_initialized)
     return 1;
 
-  prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS);
+  prev_error_mode = win32_change_error_mode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
   ntdll = LoadLibrary(TEXT("ntdll.dll"));
   win32_change_error_mode(prev_error_mode);
   if (!ntdll)