Add more precise NTSTATUS const fns.
The current NT_SUCCESS macro checks for NTSTATUS >= 0. While this is semantically equivalent to the official behavior I think it is appropriate to match MSDN documentation exactly.
This PR also adds the other NT_ macros for information, warning, and error values.
Reference: https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values
For reference, here's how they're defined in C:
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#ifdef _PREFAST_
#define NT_INFORMATION(Status) (((NTSTATUS)(Status)) >= (long)0x40000000)
#else
#define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
#endif
#ifdef _PREFAST_
#define NT_WARNING(Status) (((NTSTATUS)(Status) < (long)0xc0000000))
#else
#define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
#endif
#ifdef _PREFAST_
#define NT_ERROR(Status) (((NTSTATUS)(Status)) >= (unsigned long)0xc0000000)
#else
#define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
#endif
@wmmc88 it looks like one of the docs jobs hanged. Can you restart it or bypass it?
@wmmc88 it looks like one of the docs jobs hanged. Can you restart it or bypass it?
Ah. Hanged on winget installation. Winget installation is primarily used to get the WDK. Do you think someone could port the pipelines to use the new nuget pkgs?