Class W32Errors

  • All Implemented Interfaces:
    WinError

    public abstract class W32Errors
    extends Object
    implements WinError
    Utility class for some common error functions.
    • Constructor Detail

      • W32Errors

        public W32Errors()
    • Method Detail

      • SUCCEEDED

        public static final boolean SUCCEEDED​(int hr)
        Generic test for success on any status value (non-negative numbers indicate success).
        Parameters:
        hr - the hr
        Returns:
        true, if successful
      • FAILED

        public static final boolean FAILED​(int hr)
        and the inverse.
        Parameters:
        hr - the hr
        Returns:
        true, if successful
      • SUCCEEDED

        public static final boolean SUCCEEDED​(WinNT.HRESULT hr)
        Succeeded.
        Parameters:
        hr - the hr
        Returns:
        true, if successful
      • FAILED

        public static final boolean FAILED​(WinNT.HRESULT hr)
        Failed.
        Parameters:
        hr - the hr
        Returns:
        true, if successful
      • HRESULT_CODE

        public static final int HRESULT_CODE​(int hr)
        Extract error code from HRESULT.
        Parameters:
        hr - the hr
        Returns:
        the int
      • SCODE_CODE

        public static final int SCODE_CODE​(int sc)
        Extract error code from SCODE.
        Parameters:
        sc - the sc
        Returns:
        the int
      • HRESULT_FACILITY

        public static final int HRESULT_FACILITY​(int hr)
        Return the facility.
        Parameters:
        hr - the hr
        Returns:
        the int
      • SCODE_FACILITY

        public static final int SCODE_FACILITY​(short sc)
        Scode facility.
        Parameters:
        sc - the sc
        Returns:
        the int
      • HRESULT_SEVERITY

        public static short HRESULT_SEVERITY​(int hr)
        Return the severity.
        Parameters:
        hr - the hr
        Returns:
        the short
      • SCODE_SEVERITY

        public static short SCODE_SEVERITY​(short sc)
        Scode severity.
        Parameters:
        sc - the sc
        Returns:
        the short
      • MAKE_HRESULT

        public static int MAKE_HRESULT​(short sev,
                                       short fac,
                                       short code)
        Create an HRESULT value from component pieces.
        Parameters:
        sev - the sev
        fac - the fac
        code - the code
        Returns:
        the int
      • MAKE_SCODE

        public static final int MAKE_SCODE​(short sev,
                                           short fac,
                                           short code)
        Make scode.
        Parameters:
        sev - the sev
        fac - the fac
        code - the code
        Returns:
        the int
      • HRESULT_FROM_WIN32

        public static final WinNT.HRESULT HRESULT_FROM_WIN32​(int x)
        Map a WIN32 error value into a HRESULT Note: This assumes that WIN32 errors fall in the range -32k to=32k.
        Parameters:
        x - original w32 error code
        Returns:
        the converted value
      • FILTER_HRESULT_FROM_FLT_NTSTATUS

        public static final int FILTER_HRESULT_FROM_FLT_NTSTATUS​(int x)
        FACILITY_USERMODE_FILTER_MANAGER

        Translation macro for converting: NTSTATUS --> HRESULT.

        Parameters:
        x - the x
        Returns:
        the int