private static bool NT_SUCCESS(PInvoke.NTSTATUS status) { return(PInvoke.NTSTATUS.Code.STATUS_SUCCESS == status); }
/// <summary> /// Initializes a new instance of the <see cref="NTStatusException"/> class. /// </summary> /// <param name="statusCode">The status code identifying the error.</param> /// <param name="message">The exception message (which may be null to use the default).</param> /// <param name="inner">The inner exception.</param> public NTStatusException(NTSTATUS statusCode, string message, Exception inner) : base(message ?? GetMessage(statusCode), inner) { this.NativeErrorCode = statusCode; }
/// <summary> /// Initializes a new instance of the <see cref="NTStatusException"/> class. /// </summary> /// <param name="statusCode">The status code identifying the error.</param> /// <param name="message">The exception message (which may be null to use the default).</param> public NTStatusException(NTSTATUS statusCode, string message) : this(statusCode, message, null) { }
/// <summary> /// Initializes a new instance of the <see cref="NTStatusException"/> class. /// </summary> /// <param name="statusCode">The status code identifying the error.</param> public NTStatusException(NTSTATUS statusCode) : this(statusCode, GetMessage(statusCode)) { }
public static extern Win32ErrorCode RtlNtStatusToDosError(NTSTATUS Status);
/// <summary> /// Converts an <see cref="NTSTATUS"/> to an <see cref="HResult"/>. /// </summary> /// <param name="status">The <see cref="NTSTATUS"/> to convert.</param> /// <returns>The <see cref="HResult"/>.</returns> public static HResult ToHResult(this NTSTATUS status) { // From winerror.h // #define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT)) return(status | (int)FACILITY_NT_BIT); }