diff options
author | Pali Rohár <pali@kernel.org> | 2024-03-29 21:19:27 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2024-04-05 13:14:06 +0200 |
commit | 4b4ea003ef812f098d6ad7052792261248959a1c (patch) | |
tree | 7156b6e3cf3e0a03d49163abbac4a2b07c554b60 | |
parent | 90251023d44d50973e956d308b29a53ae84668e3 (diff) | |
download | pciutils-4b4ea003ef812f098d6ad7052792261248959a1c.tar.gz |
windows: Do not show unwanted file-not-found GUI message box
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.
-rw-r--r-- | lib/i386-io-windows.h | 5 | ||||
-rw-r--r-- | lib/win32-helpers.c | 2 | ||||
-rw-r--r-- | lib/win32-sysdbg.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h index d2da452..8f8cffd 100644 --- a/lib/i386-io-windows.h +++ b/lib/i386-io-windows.h @@ -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) diff --git a/lib/win32-helpers.c b/lib/win32-helpers.c index 5338efa..0190f21 100644 --- a/lib/win32-helpers.c +++ b/lib/win32-helpers.c @@ -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); diff --git a/lib/win32-sysdbg.c b/lib/win32-sysdbg.c index 0c175ca..6847fee 100644 --- a/lib/win32-sysdbg.c +++ b/lib/win32-sysdbg.c @@ -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) |