HRESULT_FROM_WIN32() private method

private HRESULT_FROM_WIN32 ( int errorCode ) : int
errorCode int
return int
示例#1
0
        public static int ConvertErrorCodeToHR(int error)
        {
            // This method allows common error detection code to be used by consumers
            // of HttpClient. This method converts the ErrorCode returned by WinHTTP
            // to the same HRESULT value as is provided in the .Net Native implementation
            // of HttpClient under the same error conditions. Clients would access
            // HttpRequestException.InnerException.HRESULT to discover what caused
            // the exception.
            switch ((uint)error)
            {
            case Interop.WinHttp.ERROR_WINHTTP_CONNECTION_ERROR:
                return(unchecked ((int)Interop.WinHttp.WININET_E_CONNECTION_RESET));

            default:
                // Marshal.GetHRForLastWin32Error can't be used as not all error codes originate from native
                // code.
                return(Interop.HRESULT_FROM_WIN32(error));
            }
        }
示例#2
0
 protected EventLogException(int errorCode)
 {
     _errorCode = errorCode;
     HResult    = Interop.HRESULT_FROM_WIN32(errorCode);
 }