示例#1
0
 private static bool NT_SUCCESS(PInvoke.NTSTATUS status)
 {
     return(PInvoke.NTSTATUS.Code.STATUS_SUCCESS == status);
 }
示例#2
0
 /// <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;
 }
示例#3
0
 /// <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)
 {
 }
示例#4
0
 /// <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))
 {
 }
示例#5
0
 public static extern Win32ErrorCode RtlNtStatusToDosError(NTSTATUS Status);
示例#6
0
 /// <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);
 }