@@ -74,13 +74,72 @@ pub extern "system" fn __CxxFrameHandler3() -> i32 {
74
74
driver_model__driver_type = "KMDF" ,
75
75
driver_model__driver_type = "UMDF"
76
76
) ) ]
77
- #[ allow( missing_docs) ]
78
77
#[ must_use]
79
78
#[ allow( non_snake_case) ]
79
+ /// Evaluates to TRUE if the return value specified by `nt_status` is a success
80
+ /// type (0 − 0x3FFFFFFF) or an informational type (0x40000000 − 0x7FFFFFFF).
81
+ /// This function is taken from ntdef.h in the WDK.
82
+ ///
83
+ /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and
84
+ /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details.
80
85
pub const fn NT_SUCCESS ( nt_status : NTSTATUS ) -> bool {
81
86
nt_status >= 0
82
87
}
83
88
89
+ #[ cfg( any(
90
+ driver_model__driver_type = "WDM" ,
91
+ driver_model__driver_type = "KMDF" ,
92
+ driver_model__driver_type = "UMDF"
93
+ ) ) ]
94
+ #[ must_use]
95
+ #[ allow( non_snake_case) ]
96
+ #[ allow( clippy:: cast_sign_loss) ]
97
+ /// Evaluates to TRUE if the return value specified by `nt_status` is an
98
+ /// informational type (0x40000000 − 0x7FFFFFFF). This function is taken from
99
+ /// ntdef.h in the WDK.
100
+ ///
101
+ /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and
102
+ /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details.
103
+ pub const fn NT_INFORMATION ( nt_status : NTSTATUS ) -> bool {
104
+ ( nt_status as u32 >> 30 ) == 1
105
+ }
106
+
107
+ #[ cfg( any(
108
+ driver_model__driver_type = "WDM" ,
109
+ driver_model__driver_type = "KMDF" ,
110
+ driver_model__driver_type = "UMDF"
111
+ ) ) ]
112
+ #[ must_use]
113
+ #[ allow( non_snake_case) ]
114
+ #[ allow( clippy:: cast_sign_loss) ]
115
+ /// Evaluates to TRUE if the return value specified by `nt_status` is a warning
116
+ /// type (0x80000000 − 0xBFFFFFFF). This function is taken from ntdef.h in the
117
+ /// WDK.
118
+ ///
119
+ /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and
120
+ /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details.
121
+ pub const fn NT_WARNING ( nt_status : NTSTATUS ) -> bool {
122
+ ( nt_status as u32 >> 30 ) == 2
123
+ }
124
+
125
+ #[ cfg( any(
126
+ driver_model__driver_type = "WDM" ,
127
+ driver_model__driver_type = "KMDF" ,
128
+ driver_model__driver_type = "UMDF"
129
+ ) ) ]
130
+ #[ must_use]
131
+ #[ allow( non_snake_case) ]
132
+ #[ allow( clippy:: cast_sign_loss) ]
133
+ /// Evaluates to TRUE if the return value specified by `nt_status` is an error
134
+ /// type (0xC0000000 - 0xFFFFFFFF). This function is taken from ntdef.h in the
135
+ /// WDK.
136
+ ///
137
+ /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and
138
+ /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details.
139
+ pub const fn NT_ERROR ( nt_status : NTSTATUS ) -> bool {
140
+ ( nt_status as u32 >> 30 ) == 3
141
+ }
142
+
84
143
#[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
85
144
#[ allow( missing_docs) ]
86
145
#[ macro_export]
0 commit comments