{"id":1550,"date":"2017-01-19T19:09:34","date_gmt":"2017-01-19T11:09:34","guid":{"rendered":"http:\/\/blog.dynox.cn\/?p=1550"},"modified":"2017-01-19T22:15:23","modified_gmt":"2017-01-19T14:15:23","slug":"windows%e5%86%85%e6%a0%b8%e5%bc%80%e5%8f%91%e9%99%b7%e9%98%b1-ntstatus","status":"publish","type":"post","link":"https:\/\/blog.dynox.cn\/?p=1550","title":{"rendered":"Windows\u5185\u6838\u5f00\u53d1\u9677\u9631 &#8211; NTSTATUS"},"content":{"rendered":"<div class=\"gruber-markdown\"><h4>STATUS_REPARSE\u4e0d\u662f\u201c\u5931\u8d25\u201d<\/h4>\n<p>\u66fe\u7ecf\u5728\u8fc7\u6ee4\u9a71\u52a8\u4e2d\u60f3\u9488\u5bf9REPARSE\u7684\u60c5\u51b5\u505a\u7279\u6b8a\u5904\u7406\uff0c\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"prettyprint\">if (NT_SUCCESS(status)) {\n    \/* file created *\/\n} else if (STATUS_REPARSE == status) {\n    \/* to be repared  *\/\n} else {\n    ...\n}<\/code><\/pre>\n<p>\u7ed3\u679c\u4ee3\u7801\u8fd0\u884c\u6ca1\u8fbe\u6709\u9884\u671f\u6548\u679c\uff0c\u624b\u5de5\u8c03\u8bd5\u65f6\u624d\u53d1\u73b0\u4ee3\u7801\u8fdb\u5165\u4e86NT_SUCCESS(status)\u5206\u652f\u3002STATUS_REPARSE\u7adf\u7136\u8868\u793a\u662f\u201c\u6210\u529f\u201d\u7684\uff01<\/p>\n<p>\u8fd9\u4ef6\u4e8b\u540e\u624d\u771f\u6b63\u6ce8\u610f\u5230status\u7684\u95ee\u9898\uff0c\u867d\u7136\u5728\u5b66\u4e60\u5185\u6838\u53ca\u9a71\u52a8\u7f16\u7a0b\u7684\u65f6\u5019\u4e66\u4e0a\u90fd\u6709\u76f8\u5173\u4ecb\u7ecd\uff0c\u4f46\u8fd9\u4e9b\u57fa\u7840\u7ae0\u8282\u5e76\u6ca1\u6709\u5f15\u8d77\u91cd\u89c6\u5c31\u76f4\u63a5\u8df3\u8fc7\u4e86\u3002\u4f46\u662f\u50cfSTATS_REPARSE\u8fd9\u6837\u7684\u7279\u4f8b\u5e76\u4e0d\u662f\u5c11\u6570\uff0c\u5982STATUS_PENDING\u3001STATUS_TIMEOUT\u7b49\u3002<\/p>\n<h4>NTSTATUS\u7684\u5b9a\u4e49<\/h4>\n<p>\u518d\u56de\u987e\u4e00\u4e0bNTSTATUS\u7684\u5b9a\u4e49: NTSTATUS\u662f\u4e00\u4e2a32\u4f4d\u957f\u7684\u6709\u7b26\u53f7\u6574\u578b\u6570\uff0c\u5373LONG\u578b\u3002\u5176\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"prettyprint\">  3                   2                   1                   0\n1 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\n---+-+-+-----------------------+-------------------------------\nS  |C|N|    Facility           |               Code              \n---------------------------------------------------------------<\/code><\/pre>\n<p>\u5404\u90e8\u5206\u7684\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th style=\"text-align: center;\">\u4f4d\u6570<\/th>\n<th>\u6ce8\u89e3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>S<\/td>\n<td style=\"text-align: center;\">2<\/td>\n<td>Severity: \u52064\u4e2a\u7b49\u7ea7(Success, Informational, Warning, Error)<\/td>\n<\/tr>\n<tr>\n<td>C<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td>1\uff1a\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u503c 0\uff1a\u9ed8\u8ba4\u4e3a\u7cfb\u7edf\u5b9a\u4e49(Microsoft)<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td>\u4fdd\u7559\u4f4d\uff0c\u59cb\u7ec8\u4e3a0\u503c<\/td>\n<\/tr>\n<tr>\n<td>Facility<\/td>\n<td style=\"text-align: center;\">12<\/td>\n<td>\u9519\u8bef\u7c7b\u522b\u6216\u5b50\u7cfb\u7edf\u7684\u5212\u5206<\/td>\n<\/tr>\n<tr>\n<td>Code<\/td>\n<td style=\"text-align: center;\">16<\/td>\n<td>\u5177\u4f53\u9519\u8bef\u4ee3\u7801<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Severity\u76844\u4e2a\u7b49\u7ea7\u7684\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"prettyprint\">00 - Success\n01 - Informational\n10 - Warning\n11 - Error<\/code><\/pre>\n<h4>NT_XXXX\u5b8f\u5206\u6790<\/h4>\n<p>\u5f15\u7528WDK\u4ee3\u7801\uff08ntdef.h\uff09:<\/p>\n<pre><code class=\"prettyprint\">\/\/\n\/\/ Generic test for success on any status value (non-negative numbers\n\/\/ indicate success).\n\/\/\n\n#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) &gt;= 0)\n\n\/\/\n\/\/ Generic test for information on any status value.\n\/\/\n\n#define NT_INFORMATION(Status) ((((ULONG)(Status)) &gt;&gt; 30) == 1)\n\n\/\/\n\/\/ Generic test for warning on any status value.\n\/\/\n\n#define NT_WARNING(Status) ((((ULONG)(Status)) &gt;&gt; 30) == 2)\n\n\/\/\n\/\/ Generic test for error on any status value.\n\/\/\n\n#define NT_ERROR(Status) ((((ULONG)(Status)) &gt;&gt; 30) == 3)<\/code><\/pre>\n<p>\u7531\u5b9a\u4e49\u53ef\u4ee5\u770b\u51fa\u81f3\u5c11\u4e24\u70b9\uff1a<\/p>\n<ol>\n<li>\n<p>NT_SUCCESS\u7684\u5b9a\u4e49\u548c\u5176\u5b83\u4e09\u8005\u662f\u6709\u533a\u522b\u7684\uff0c\u5e76\u4e0d\u662f\u6839\u636eSeverity\u7684\u503c\u6765\u5224\u65ad\u7684\u3002NT_SUCCESS(status)\u5176\u5b9e\u5305\u542b\u4e86Severity == 0\u53caSeverity == 1\u7684\u60c5\u5f62\u3002<\/p>\n<\/li>\n<li>NT_SUCCESS\u4e0eNT_ERROR\u4e0d\u662f\u5355\u7eaf\u7684\u975e\u9ed1\u5373\u767d\u7684\u5173\u7cfb\u3002\u65b0\u624b\u5e38\u72af\u7684\u9519\u8bef\u5c31\u662f\u4e3b\u89c2\u4e0a\u8ba4\u4e3aNT_SUCCESS()\u4e0e!NT_ERROR()\uff0c\u6216\u8005NT_ERROR()\u4e0e!NT_SUCCESS()\u662f\u7b49\u4ef7\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u60f3\u786e\u4fdd\u4e00\u4e2airp\u786e\u5b9e\u662f\u201c\u6210\u529f\u201d\u5b8c\u6210\u4e86\uff0c\u5c31\u8981\u4e25\u683c\u7528STATUS_SUCCESS\u6765\u5224\u65ad\uff0c\u800c\u4e0d\u662fNT_SUCCESS()\u3002\u7c7b\u4f3c\u5730\uff0c\u7528NT_ERROR()\u53ef\u4ee5\u4fdd\u8bc1\u4ee3\u7801\u7684\u6267\u884c\u786e\u5b9e\u51fa\u73b0\u4e86\u9519\u8bef\uff0c\u4f46\u662fNT_WARNING()\u7684\u60c5\u51b5\u5373\u88ab\u6f0f\u6389\u4e86\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u5fc5\u8981\u7684\u57fa\u672c\u529f\u59cb\u7ec8\u662f\u4e0d\u53ef\u5c11\u7684\uff0c\u50cf\u719f\u6089\u5f00\u53d1\u573a\u666f\u76f8\u5173\u7684\u8fd4\u56de\u503c\u5e76\u5f04\u61c2\u8fd9\u4e9b\u8fd4\u56de\u503c\u7684\u786e\u5207\u542b\u4e49\u7b49\u6b64\u7c7b\u7684\u82e6\u6d3b\u7d2f\u6d3b\u662f\u5fc5\u987b\u8981\u505a\u4e14\u8981\u505a\u597d\u7684\u3002<\/p>\n<h4>\u53c2\u8003\u94fe\u63a5<\/h4>\n<ol>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/cc231196.aspx\">[MS-ERREF]: Windows Error Codes<\/a><\/li>\n<li><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/hardware\/ff557573(v=vs.85).aspx\">Windows Driver Kit (WDK)<\/a><\/li>\n<\/ol>\n<p>&lt;\u672c\u6587\u7528\u65f62\u5c0f\u65f6\uff0c\u5b57\u4f53\u53ca\u8868\u683c\u8c03\u6574\u82b1\u65f6\u8f83\u591a\u3002&gt;<\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>STATUS_REPARSE\u4e0d\u662f\u201c\u5931\u8d25\u201d \u66fe\u7ecf\u5728\u8fc7\u6ee4\u9a71\u52a8\u4e2d\u60f3\u9488\u5bf9REPARSE\u7684\u60c5\u51b5\u505a\u7279\u6b8a\u5904\u7406\uff0c\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[9],"tags":[594,593,595,592,597,596,598,394],"views":2306,"_links":{"self":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/1550"}],"collection":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1550"}],"version-history":[{"count":5,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/1550\/revisions"}],"predecessor-version":[{"id":1560,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/1550\/revisions\/1560"}],"wp:attachment":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}