From: Pali Rohár Date: Fri, 29 Mar 2024 20:19:27 +0000 (+0100) Subject: windows: Do not show unwanted file-not-found GUI message box X-Git-Tag: v3.13.0~25 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=4b4ea003ef812f098d6ad7052792261248959a1c;p=pciutils.git 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. --- 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)