]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/i386-io-windows.h
libpci: i386-io-windows.h: Fix error code in ERROR_PRIVILEGE_NOT_HELD code path
[pciutils.git] / lib / i386-io-windows.h
index 1509d7de86803252718d3f70aa11054872b841a6..8089d19b3a28922bfe93d674b4a0a801dc3966cb 100644 (file)
@@ -5,7 +5,9 @@
  *     Copyright (c) 2006 Martin Mares <mj@ucw.cz>
  *     Copyright (c) 2021 Pali Rohár <pali@kernel.org>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <io.h>
@@ -1141,7 +1143,7 @@ SetProcessUserModeIOPL(VOID)
    */
 
   if (!LookupPrivilegeValue(NULL, SE_TCB_NAME, &luid_tcb_privilege))
-    goto err_not_implemented;
+    goto err_privilege_not_held;
 
   /*
    * If the current thread has already Tcb privilege enabled then there
@@ -1343,7 +1345,8 @@ intel_setup_io(struct pci_access *a)
   /* On NT-based systems issue ProcessUserModeIOPL syscall which changes IOPL to 3. */
   if (!SetProcessUserModeIOPL())
     {
-      a->warning("NT ProcessUserModeIOPL call failed with error: %lu.", (unsigned long int)GetLastError());
+      DWORD error = GetLastError();
+      a->debug("NT ProcessUserModeIOPL call failed: %s.", error == ERROR_INVALID_FUNCTION ? "Not Implemented" : error == ERROR_PRIVILEGE_NOT_HELD ? "Access Denied" : "Operation Failed");
       return 0;
     }