驅動錯誤傳回值學習筆記

來源:互聯網
上載者:User

說明:ntstatus.h檔案所在路徑C:\WinDDK\7600.16385.1\inc\api


今天看了一個ntstatus.h標頭檔中關於驅動中傳回值的一些資料,為今後調試驅動返回錯誤值作一些準備,
0x40000000這個範圍內的表示是資訊Informational    #define STATUS_OBJECT_NAME_EXISTS        ((NTSTATUS)0x40000000L)
0x80000000這個範圍內的表示是警告Warning        #define STATUS_GUARD_PAGE_VIOLATION      ((NTSTATUS)0x80000001L)    // winnt
0xC0000000等於大於這個基數的表示是錯誤Error    #define STATUS_UNSUCCESSFUL              ((NTSTATUS)0xC0000001L)

根據傳回值大小所在範圍就可以知道大概情況。
具體資訊可以參考ntstatus.h中的MessageText:部分
同時下面提供一個中文的參考對照網址:

http://wenku.baidu.com/view/d7681c2eb4daa58da0114a49.html

//

//  Values are 32 bit values laid out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +---+-+-+-----------------------+-------------------------------+
//  |Sev|C|R|     Facility          |               Code            |
//  +---+-+-+-----------------------+-------------------------------+
//
//  where
//
//      Sev - is the severity code   //最高兩位即第31位與29位共同表示錯誤的程度分別為:成功、資訊、警告、錯誤
//
//          00 - Success
//          01 - Informational
//          10 - Warning
//          11 - Error
//
//      C - is the Customer code flag        //使用者標記
//
//      R - is a reserved bit            //系統保留位
//
//      Facility - is the facility code        //裝置碼
//
//      Code - is the facility's status code    //裝置狀態代碼
//

0x40000000這個範圍內的表示是資訊Informational    #define STATUS_OBJECT_NAME_EXISTS        ((NTSTATUS)0x40000000L)
0x80000000這個範圍內的表示是警告Warning        #define STATUS_GUARD_PAGE_VIOLATION      ((NTSTATUS)0x80000001L)    // winnt
0xC0000000等於大於這個基數的表示是錯誤Error    #define STATUS_UNSUCCESSFUL              ((NTSTATUS)0xC0000001L)

// Define the facility codes
//
#define FACILITY_VOLMGR                  0x38
#define FACILITY_VIRTUALIZATION          0x37
#define FACILITY_VIDEO                   0x1B
#define FACILITY_USB_ERROR_CODE          0x10
#define FACILITY_TRANSACTION             0x19
#define FACILITY_TERMINAL_SERVER         0xA
#define FACILITY_SXS_ERROR_CODE          0x15
#define FACILITY_NTSSPI                  0x9
#define FACILITY_RPC_STUBS               0x3
#define FACILITY_RPC_RUNTIME             0x2
#define FACILITY_NTWIN32                 0x7
#define FACILITY_WIN32K_NTUSER           0x3E
#define FACILITY_WIN32K_NTGDI            0x3F
#define FACILITY_NDIS_ERROR_CODE         0x23
#define FACILTIY_MUI_ERROR_CODE          0xB
#define FACILITY_MONITOR                 0x1D
#define FACILITY_MAXIMUM_VALUE           0x3F
#define FACILITY_IPSEC                   0x36
#define FACILITY_IO_ERROR_CODE           0x4
#define FACILITY_HYPERVISOR              0x35
#define FACILITY_HID_ERROR_CODE          0x11
#define FACILITY_GRAPHICS_KERNEL         0x1E
#define FACILITY_FWP_ERROR_CODE          0x22
#define FACILITY_FVE_ERROR_CODE          0x21
#define FACILITY_FIREWIRE_ERROR_CODE     0x12
#define FACILITY_FILTER_MANAGER          0x1C
#define FACILITY_DRIVER_FRAMEWORK        0x20
#define FACILITY_DIS                     0x3C
#define FACILITY_DEBUGGER                0x1
#define FACILITY_COMMONLOG               0x1A
#define FACILITY_CLUSTER_ERROR_CODE      0x13
#define FACILITY_NTCERT                  0x8
#define FACILITY_BCD_ERROR_CODE          0x39
#define FACILITY_ACPI_ERROR_CODE         0x14

//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING          0x2
#define STATUS_SEVERITY_SUCCESS          0x0
#define STATUS_SEVERITY_INFORMATIONAL    0x1
#define STATUS_SEVERITY_ERROR            0x3

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.