public static GetErrorMessage ( int error ) : string | ||
error | int | |
리턴 | string |
public static string GetErrorMessage(int error)
{
// Look up specific error message in WINHTTP.DLL since it is not listed in default system resources
// and thus can't be found by default .Net interop.
IntPtr moduleHandle = Interop.Kernel32.GetModuleHandle(Interop.Libraries.WinHttp);
return Interop.Kernel32.GetMessage(moduleHandle, error);
}
}
public static void TraceAsyncError(string message, Interop.WinHttp.WINHTTP_ASYNC_RESULT asyncResult) { if (!IsTraceEnabled()) { return; } uint apiIndex = (uint)asyncResult.dwResult.ToInt32(); uint error = asyncResult.dwError; Debug.WriteLine( "{0}: api={1}, error={2}({3}) \"{4}\"", message, GetNameFromApiIndex(apiIndex), GetNameFromError(error), error, WinHttpException.GetErrorMessage((int)error)); }