如何理解windows ddk中的"NTSTATUS","NT_SUCCESS"typedef?

Zhe*_*ren 5 c driver wdk

两个问题:

1.

在"ntdef.h"中,NTSTATUS定义如下:

typedef __success(return >= 0) LONG NTSTATUS;
Run Code Online (Sandbox Code Playgroud)

到底是什么"__ success(return> = 0)"?

2.

在"ntstatus.h"中,STATUS_SUCCESS定义为0.

#define STATUS_SUCCESS   ((NTSTATUS)0x00000000L) // ntsubauth
Run Code Online (Sandbox Code Playgroud)

但是"ntdef.h"中的NT_SUCCESS宏是:

#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
Run Code Online (Sandbox Code Playgroud)

不应该是"状态== 0"吗?

tor*_*rak 10

__ccess是SpecStrings_strict.h中定义的"高级注释",它定义如下.

*  __success(expr) T f() :  indicates whether function f succeeded or
*  not. If  is true at exit, all the function's guarantees (as given
*  by other annotations) must hold. If  is false at exit, the caller
*  should not expect any of the function's guarantees to hold. If not used,
*  the function must always satisfy its guarantees. Added automatically to
*  functions that indicate success in standard ways, such as by returning an
*  HRESULT.

NT_SUCCESS没有进行严格测试的原因STATUS_SUCCESS (0)可能是其他代码STATUS_PENDING实际上并非失败.