Zebediah Figura : include: Add NTSTATUS severity macros.

Alexandre Julliard julliard at winehq.org
Thu Aug 8 19:27:19 CDT 2019


Module: wine
Branch: master
Commit: a28736df1fad6c64995afb9e7432b4d741adeed0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a28736df1fad6c64995afb9e7432b4d741adeed0

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Aug  7 21:10:11 2019 -0500

include: Add NTSTATUS severity macros.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/sec.c | 6 ++----
 include/ntdef.h  | 5 +++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index 02fc77d..464104d 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -43,8 +43,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 
-#define NT_SUCCESS(status) (status == STATUS_SUCCESS)
-
 #define SELF_RELATIVE_FIELD(sd,field) ((BYTE *)(sd) + ((SECURITY_DESCRIPTOR_RELATIVE *)(sd))->field)
 
 /* helper function to retrieve active length of an ACL */
@@ -1521,7 +1519,7 @@ RtlAdjustPrivilege(ULONG Privilege,
                                     &TokenHandle);
     }
 
-    if (!NT_SUCCESS(Status))
+    if (Status)
     {
         WARN("Retrieving token handle failed (Status %x)\n", Status);
         return Status;
@@ -1546,7 +1544,7 @@ RtlAdjustPrivilege(ULONG Privilege,
         TRACE("Failed to assign all privileges\n");
         return STATUS_PRIVILEGE_NOT_HELD;
     }
-    if (!NT_SUCCESS(Status))
+    if (Status)
     {
         WARN("NtAdjustPrivilegesToken() failed (Status %x)\n", Status);
         return Status;
diff --git a/include/ntdef.h b/include/ntdef.h
index 83ecffd..014102a 100644
--- a/include/ntdef.h
+++ b/include/ntdef.h
@@ -43,4 +43,9 @@ typedef enum _WAIT_TYPE {
 }
 #endif
 
+#define NT_SUCCESS(status)      (((NTSTATUS)(status)) >= 0)
+#define NT_INFORMATION(status)  ((((NTSTATUS)(status)) & 0xc0000000) == 0x40000000)
+#define NT_WARNING(status)      ((((NTSTATUS)(status)) & 0xc0000000) == 0x80000000)
+#define NT_ERROR(status)        ((((NTSTATUS)(status)) & 0xc0000000) == 0xc0000000)
+
 #endif /* _NTDEF_ */




More information about the wine-cvs mailing list