mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
a0ecb1c49d
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1432 21ef857c-d57f-4fe0-8362-d861dc6d29cd
185 lines
6.3 KiB
C#
185 lines
6.3 KiB
C#
|
|
namespace ProcessHacker.Native.Api
|
|
{
|
|
/// <summary>
|
|
/// A NT status value.
|
|
/// </summary>
|
|
public enum NtStatus : uint
|
|
{
|
|
// Success
|
|
Success = 0x00000000,
|
|
Wait0 = 0x00000000,
|
|
Wait1 = 0x00000001,
|
|
Wait2 = 0x00000002,
|
|
Wait3 = 0x00000003,
|
|
Wait63 = 0x0000003f,
|
|
Abandoned = 0x00000080,
|
|
AbandonedWait0 = 0x00000080,
|
|
AbandonedWait1 = 0x00000081,
|
|
AbandonedWait2 = 0x00000082,
|
|
AbandonedWait3 = 0x00000083,
|
|
AbandonedWait63 = 0x000000bf,
|
|
UserApc = 0x000000c0,
|
|
KernelApc = 0x00000100,
|
|
Alerted = 0x00000101,
|
|
Timeout = 0x00000102,
|
|
Pending = 0x00000103,
|
|
Reparse = 0x00000104,
|
|
MoreEntries = 0x00000105,
|
|
NotAllAssigned = 0x00000106,
|
|
SomeNotMapped = 0x00000107,
|
|
OpLockBreakInProgress = 0x00000108,
|
|
VolumeMounted = 0x00000109,
|
|
PageFaultTransition = 0x00000110,
|
|
PageFaultDemandZero = 0x00000111,
|
|
PageFaultCopyOnWrite = 0x00000112,
|
|
PageFaultGuardPage = 0x00000113,
|
|
PageFaultPagingFile = 0x00000114,
|
|
CrashDump = 0x00000116,
|
|
ReparseObject = 0x00000118,
|
|
NothingToTerminate = 0x00000122,
|
|
ProcessNotInJob = 0x00000123,
|
|
ProcessInJob = 0x00000124,
|
|
ProcessCloned = 0x00000129,
|
|
|
|
// Informational
|
|
Informational = 0x40000000,
|
|
ObjectNameExists = 0x40000000,
|
|
ThreadWasSuspended = 0x40000001,
|
|
|
|
// Warning
|
|
Warning = 0x80000000,
|
|
GuardPageViolation = 0x80000001,
|
|
DatatypeMisalignment = 0x80000002,
|
|
Breakpoint = 0x80000003,
|
|
SingleStep = 0x80000004,
|
|
BufferOverflow = 0x80000005,
|
|
NoMoreFiles = 0x80000006,
|
|
HandlesClosed = 0x8000000a,
|
|
PartialCopy = 0x8000000d,
|
|
DeviceBusy = 0x80000011,
|
|
InvalidEaName = 0x80000013,
|
|
EaListInconsistent = 0x80000014,
|
|
LongJump = 0x80000026,
|
|
DllMightBeInsecure = 0x8000002b,
|
|
|
|
// Error
|
|
Error = 0xc0000000,
|
|
Unsuccessful = 0xc0000001,
|
|
NotImplemented = 0xc0000002,
|
|
InvalidInfoClass = 0xc0000003,
|
|
InfoLengthMismatch = 0xc0000004,
|
|
AccessViolation = 0xc0000005,
|
|
InPageError = 0xc0000006,
|
|
PagefileQuota = 0xc0000007,
|
|
InvalidHandle = 0xc0000008,
|
|
BadInitialStack = 0xc0000009,
|
|
BadInitialPc = 0xc000000a,
|
|
InvalidCid = 0xc000000b,
|
|
TimerNotCanceled = 0xc000000c,
|
|
InvalidParameter = 0xc000000d,
|
|
NoSuchDevice = 0xc000000e,
|
|
NoSuchFile = 0xc000000f,
|
|
InvalidDeviceRequest = 0xc0000010,
|
|
EndOfFile = 0xc0000011,
|
|
WrongVolume = 0xc0000012,
|
|
NoMediaInDevice = 0xc0000013,
|
|
NoMemory = 0xc0000017,
|
|
NotMappedView = 0xc0000019,
|
|
UnableToFreeVm = 0xc000001a,
|
|
UnableToDeleteSection = 0xc000001b,
|
|
IllegalInstruction = 0xc000001d,
|
|
AlreadyCommitted = 0xc0000021,
|
|
AccessDenied = 0xc0000022,
|
|
BufferTooSmall = 0xc0000023,
|
|
ObjectTypeMismatch = 0xc0000024,
|
|
NonContinuableException = 0xc0000025,
|
|
BadStack = 0xc0000028,
|
|
NotLocked = 0xc000002a,
|
|
NotCommitted = 0xc000002d,
|
|
InvalidParameterMix = 0xc0000030,
|
|
ObjectNameInvalid = 0xc0000033,
|
|
ObjectNameNotFound = 0xc0000034,
|
|
ObjectNameCollision = 0xc0000035,
|
|
ObjectPathInvalid = 0xc0000039,
|
|
ObjectPathSyntaxBad = 0xc000003b,
|
|
QuotaExceeded = 0xc0000044,
|
|
InvalidPageProtection = 0xc0000045,
|
|
MutantNotOwned = 0xc0000046,
|
|
SemaphoreLimitExceeded = 0xc0000047,
|
|
SuspendCountExceeded = 0xc000004a,
|
|
ThreadIsTerminating = 0xc000004b,
|
|
NotSameDevice = 0xc00000d4,
|
|
FileRenamed = 0xc00000d5,
|
|
CantWait = 0xc00000d8,
|
|
PipeEmpty = 0xc00000d9,
|
|
CantTerminateSelf = 0xc00000db,
|
|
InternalError = 0xc00000e5,
|
|
InvalidParameter1 = 0xc00000ef,
|
|
InvalidParameter2 = 0xc00000f0,
|
|
InvalidParameter3 = 0xc00000f1,
|
|
InvalidParameter4 = 0xc00000f2,
|
|
InvalidParameter5 = 0xc00000f3,
|
|
InvalidParameter6 = 0xc00000f4,
|
|
InvalidParameter7 = 0xc00000f5,
|
|
InvalidParameter8 = 0xc00000f6,
|
|
InvalidParameter9 = 0xc00000f7,
|
|
InvalidParameter10 = 0xc00000f8,
|
|
InvalidParameter11 = 0xc00000f9,
|
|
InvalidParameter12 = 0xc00000fa,
|
|
PortNotSet = 0xc0000353,
|
|
DebuggerInactive = 0xc0000354,
|
|
|
|
MaximumNtStatus = 0xffffffff
|
|
}
|
|
|
|
public static class NtStatusExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets whether the NT status value indicates an error.
|
|
/// </summary>
|
|
/// <param name="status">The NT status value.</param>
|
|
public static bool IsError(this NtStatus status)
|
|
{
|
|
return status >= NtStatus.Error && status <= NtStatus.MaximumNtStatus;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets whether the NT status value indicates information.
|
|
/// </summary>
|
|
/// <param name="status">The NT status value.</param>
|
|
public static bool IsInformational(this NtStatus status)
|
|
{
|
|
return status >= NtStatus.Informational && status < NtStatus.Warning;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets whether the NT status value indicates success.
|
|
/// </summary>
|
|
/// <param name="status">The NT status value.</param>
|
|
public static bool IsSuccess(this NtStatus status)
|
|
{
|
|
return status >= NtStatus.Success && status < NtStatus.Informational;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets whether the NT status value indicates a warning.
|
|
/// </summary>
|
|
/// <param name="status">The NT status value.</param>
|
|
public static bool IsWarning(this NtStatus status)
|
|
{
|
|
return status >= NtStatus.Warning && status < NtStatus.Error;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Converts the NT status value to a DOS/Windows error code.
|
|
/// </summary>
|
|
/// <param name="status">The NT status value.</param>
|
|
/// <returns>A DOS/Windows error code.</returns>
|
|
public static int ToDosError(this NtStatus status)
|
|
{
|
|
return Win32.RtlNtStatusToDosError(status);
|
|
}
|
|
}
|
|
}
|