{"id":837,"date":"2012-06-25T20:31:00","date_gmt":"2012-06-25T12:31:00","guid":{"rendered":"http:\/\/blog.dynox.cn\/?p=837"},"modified":"2012-06-26T11:36:09","modified_gmt":"2012-06-26T03:36:09","slug":"%e9%98%b4%e6%b2%9f%e9%87%8c%e7%bf%bb%e8%88%b9%e4%b9%8bkesetevent","status":"publish","type":"post","link":"https:\/\/blog.dynox.cn\/?p=837","title":{"rendered":"\u9634\u6c9f\u91cc\u7ffb\u8239\u4e4bKeSetEvent"},"content":{"rendered":"<div class=\"gruber-markdown\"><p><font size=\"2\">KeSetEvent\u662f\u4e2a\u4f7f\u7528\u9891\u7387\u5f88\u9ad8\u7684\u5185\u6838\u652f\u6301\u51fd\u6570\uff0c\u4f46\u7ecf\u5e38\u4f7f\u7528\u672a\u5fc5\u610f\u5473\u7740\u786e\u5b9e\u4e86\u89e3\u5b83\u3002\u4e0a\u5468\u5c31\u66fe\u9047\u5230\u4e00\u4ef6\u602a\u4e8b\uff0c\u7cfb\u7edf\u7ebf\u7a0b\u5728\u8c03\u7528KeSetEvent\u540e\u7ebf\u7a0bIRQL\u7adf\u7136\u4ecePASSIVE_LEVEL\u63d0\u5347\u81f3DISPATCH_LEVEL\uff0c\u4ee5\u81f3\u540e\u7eed\u7684\u64cd\u4f5c\u51fa\u9519\uff1aBug Check 0xA: IRQL_NOT_LESS_OR_EQUAL\u3002<\/font><\/p>  <p><font size=\"2\">\u5148\u770b\u770b\u5b83\u7684\u51fd\u6570\u58f0\u660e\uff1a<\/font><\/p>  <blockquote>   <p>LONG      <br \/><strong>KeSetEvent<\/strong>(      <br \/>&#160;&#160;&#160; IN PRKEVENT <a href=\"ms-help:\/\/ms.wdk.v10.7600.091201\/Kernel_r\/hh\/Kernel_r\">Event<\/a>,      <br \/>&#160;&#160;&#160; IN KPRIORITY <a href=\"ms-help:\/\/ms.wdk.v10.7600.091201\/Kernel_r\/hh\/Kernel_r\">Increment<\/a>,      <br \/>&#160;&#160;&#160; IN BOOLEAN <a href=\"ms-help:\/\/ms.wdk.v10.7600.091201\/Kernel_r\/hh\/Kernel_r\">Wait<\/a>      <br \/>);<\/p> <\/blockquote>  <p><font size=\"2\">\u6bd4\u8f83\u7b80\u5355\uff0c\u4e00\u5171\u53ea\u67093\u4e2a\u53c2\u6570\uff1a<\/font><\/p>  <ul>   <li><font size=\"2\"><strong>Event<\/strong>: \u51c6\u5907\u88ab\u6fc0\u6d3b\u7684\u4e8b\u4ef6<\/font><\/li>    <li><font size=\"2\"><strong>Increment<\/strong>: \u9884\u5907\u7ed9\u88ab\u5524\u9192\u7ebf\u7a0b\u4e34\u65f6\u63d0\u5347\u7ebf\u7a0b\u4f18\u5148\u7ea7\u7684\u589e\u91cf\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u5747\u4e3a0\uff0c\u4f46\u9488\u5bf9\u4e0d\u540c\u7684\u5b50\u7cfb\u7edf\u53ca\u5bf9\u54cd\u5e94\u5feb\u6162\u7684\u4e0d\u540c\u8981\u6c42\uff0c\u4f1a\u6709\u4e0d\u540c\u7684\u53d6\u503c\u3002\u5982\u7f51\u7edc\u76f8\u5173\uff1aIO_NETWORK_INCREMENT=2\uff1b\u952e\u76d8\u3001\u9f20\u6807\u6d89\u53ca\u7528\u6237\u754c\u9762\u4ea4\u4e92\u90e8\u5206\uff1a\u53d6\u503c\u4e3a6 \uff08IO_KEYBOARD_INCREMENT\uff0c IO_MOUSE_INCREMENT\uff09\uff1b\u58f0\u97f3\u76f8\u5173\uff0cIO_SOUND_INCREMENT=8<\/font><\/li>    <li><font size=\"2\"><strong>Wait<\/strong>: \u8fd9\u4e2a\u53c2\u6570\u540d\u5b57\u8d77\u7684\u592a\u4e0d\u59a5\u8d34\uff0c\u975e\u5e38\u5bb9\u6613\u8bef\u5bfc\u3002\u6211\u5c31\u66fe\u4ee5\u4e3a\u5c06\u6b64\u53c2\u6570\u8bbe\u4e3aTRUE\u8868\u793aKeSetEvent\u5c06\u7b49\u5f85\u7761\u7720\u5728\u6b64Event\u4e0a\u7684\u7ebf\u7a0b\u88ab\u5524\u9192\uff0c\u76f4\u5230KeWaitForXXXObject\u8fd4\u56de\u3002\u73b0\u5728\u770b\u6765\u8fd9\u79cd\u81ea\u4ee5\u4e3a\u662f\u7684\u9ed8\u8ba4\u662f\u5168\u7136\u6ca1\u6709\u6839\u636e\u7684\u3002\u5148\u770bDDK\u4e2d\u600e\u4e48\u8bf4\u8fd9\u4e2a\u53c2\u6570\u5427\uff1a<\/font><\/li>    <p><font size=\"2\">Specifies whether the call to KeSetEvent is to be followed immediately by a call to one of the KeWaitXxx routines. If TRUE, the KeSetEvent call must be followed by a call to KeWaitForMultipleObjects, KeWaitForMutexObject, or KeWaitForSingleObject.<\/font><\/p>    <p><font size=\"2\">\u7531\u6b64\u6765\u770b\uff0c\u6b64\u53c2\u6570\u5c31\u662f\u4e3a\u4e86\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u9501\u5f00\u9500\u53ca\u53ef\u80fd\u7684\u7ebf\u7a0b\u8c03\u5ea6\u5f00\u9500\u3002\u4f60\u53ef\u80fd\u4f1a\u8ba4\u4e3a\uff0c\u8c03\u7528\u8005\u5148\u8c03\u7528KeSetEvent(Event, 0, TRUE)\uff0c\u7136\u540e\u76f4\u63a5\u8ddf\u4e0a\u4e86KeWaitForXXXObject(Event \u2026)\uff0c\u90a3\u5c82\u4e0d\u662f\u591a\u6b64\u4e00\u4e3e\uff1f\u63a7\u5236\u6743\u672c\u5c31\u5728\u81ea\u5df1\u624b\u4e2d\uff0c\u4f55\u5fc5\u518d\u641e\u4e2a\u5047\u653e\u6743\u771f\u593a\u6743\u7684\u65e0\u7528\u529f\u5462\uff1f\u518d\u8bf4\u5373\u4fbf\u662f\u6709\u7528\u529f\uff0c\u4e5f\u6709\u70b9\u4efb\u4eba\u552f\u4eb2\u6216\u80a5\u6c34\u4e0d\u6d41\u5916\u4eba\u7530\u7684\u5acc\u7591\u5427\uff1f<\/font><\/p>    <p><font size=\"2\">\u4f46\u53cd\u8fc7\u6765\u60f3\u60f3\uff0c\u5982\u679cKeSetEvent\u548cKeWaitForXXXObject\u6240\u64cd\u4f5c\u7684Event\u5bf9\u8c61\u4e0d\u662f\u540c\u4e00\u4e2a\u7684\u8bdd\uff0c\u90a3\u6240\u6709\u7684\u7591\u60d1\u4fbf\u90fd\u5f97\u5230\u89e3\u7b54\u4e86\uff1a\u653e\u7684\u662f\u6743A\uff0c\u8981\u593a\u7684\u5219\u662f\u6743B \uff0c\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u4f5c\u4e3a\u7279\u6743\u4e00\u5c42\uff0c\u8fd8\u662f\u53ef\u4ee5\u4eab\u53d7\u4e9b\u4f18\u5f85\u7684\uff0c\u81f3\u5c11\u8fdb\u5165\u6743B\u4e89\u593a\u4e4b\u95e8\u65f6\u4e0d\u7528\u518d\u53bb\u6392\u961f\u4e86\u3002\u81f3\u4e8e\u4ec0\u4e48\u65f6\u95f4\u80fd\u5f97\u5230\u6743B\uff0c\u90a3\u662f\u8c03\u5ea6\u5668\u8bf4\u4e86\u624d\u7b97\u7684\uff0c\u4f60\u6216\u8bb8\u4e0d\u7531\u5f97\u53bb\u60f3\uff0c\u82e5\u53bb\u516c\u5173\u8c03\u5ea6\u5668\u8bdd\uff0c\u90a3\u540e\u95e8\u8be5\u5982\u4f55\u8d70\u5462\uff1f\uff01<\/font><\/p>    <p><font size=\"2\">\u81f3\u6b64\uff0c\u5c31Wait\u53c2\u6570\u7684\u4f7f\u7528\u4e0a\uff0c\u5e94\u8be5\u4e0d\u4f1a\u518d\u6709\u201dTo be or not to be, that\u2019s a question\u201d\u7684\u7591\u60d1\u4e86\u5427\uff1f<\/font><\/p> <\/ul>  <p><font size=\"2\">\u8bf4\u4e86\u8fd9\u4e48\u591a\uff0c\u4f46\u5bf9KeSetEvent\u4e3a\u4ec0\u4e48\u4f1a\u5bfc\u81f4IRQL\u7684\u63d0\u5347\u8fd8\u6ca1\u6709\u89e3\u7b54\uff0c\u4f46\u5176\u5b9e\u7b54\u6848\u5df2\u7ecf\u660e\u4e86\uff1aKeSetEvent\u6267\u884c\u65f6\u9996\u5148\u4f1a\u8c03\u7528KiLockDispatcherDatabase()\u6765\u63d0\u5347IRQL\u4ee5\u963b\u6b62\u8c03\u5ea6\u5668\u7684\u8c03\u5ea6\uff0c\u5728Wait = TRUE\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd4\u56de\u65f6KeSetEvent\u4f1a\u4fdd\u6301\u7740\u9ad8IRQL\uff0c\u800c\u964d\u4f4eIRQL\u7684\u5de5\u4f5c\u5c06\u7531\u540e\u7eed\u7684KeWaitForXXXObject\u6765\u505a\u3002\u8003\u8651\u5230\u4e24\u4e2a\u51fd\u6570\u6240\u64cd\u4f5c\u7684Event\u5bf9\u8c61\u5e76\u4e0d\u4e00\u5b9a\u662f\u540c\u4e00\u4e2a\uff0c\u6240\u4ee5\u4e8c\u8005\u90fd\u8981\u901a\u7ebf\u7a0b\u7ed3\u6784(KTHREAD)\u6765\u8fdb\u884c\u901a\u8baf\u3002<\/font><\/p>  <p><font size=\"2\">\u6700\u540e\u518d\u8bf4\u8bf4\u8fd4\u56de\u503c\u5427\uff0cDDK\u4e2d\u662f\u8fd9\u6837\u8bf4\u7684\uff1aIf the previous state of the event object was signaled, a nonzero value is returned. \u8fd9\u53e5\u8bdd\u8bf4\u5f97\u8fd8\u8981\u8ba9\u4f60\u73a9\u201c\u6211\u731c\u731c\u201d\uff0c\u5176<\/font><font size=\"2\">\u9690\u542b\u7684\u610f\u601d\u5c31\u662f\u8bf4\u5982\u679c\u6b64Event\u5148\u524d\u6ca1\u6709\u88ab\u6fc0\u6d3b\uff0c\u5219\u8fd4\u56de0\u503c\u3002\u6240\u4ee5\uff0c\u7b80\u8a00\u4e4b\uff0cKeSetEvent\u7684\u8fd4\u56de\u503c\u5c31\u662f\u6b64Event\u5148\u524d\u7684\u72b6\u6001\uff1aSignaled or Not Signaled !<\/font><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>KeSetEvent\u662f\u4e2a\u4f7f\u7528\u9891\u7387\u5f88\u9ad8\u7684\u5185\u6838\u652f\u6301\u51fd\u6570\uff0c\u4f46\u7ecf\u5e38\u4f7f\u7528\u672a\u5fc5\u610f\u5473\u7740\u786e\u5b9e\u4e86\u89e3\u5b83\u3002\u4e0a\u5468\u5c31\u66fe\u9047\u5230\u4e00\u4ef6\u602a\u4e8b\uff0c\u7cfb\u7edf [&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":[392,393,394],"views":9275,"_links":{"self":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/837"}],"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=837"}],"version-history":[{"count":1,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions"}],"predecessor-version":[{"id":838,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions\/838"}],"wp:attachment":[{"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dynox.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}