{"id":5091,"date":"2014-07-11T12:00:00","date_gmt":"2014-07-11T03:00:00","guid":{"rendered":"https:\/\/mimumimu.net\/blog\/?p=5091"},"modified":"2014-07-09T16:47:38","modified_gmt":"2014-07-09T07:47:38","slug":"exqueueworkitem-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6-irql-passive_level-%e3%81%a7%e5%91%bd%e4%bb%a4%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99%e3%80%82","status":"publish","type":"post","link":"https:\/\/mimumimu.net\/blog\/2014\/07\/11\/exqueueworkitem-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6-irql-passive_level-%e3%81%a7%e5%91%bd%e4%bb%a4%e3%82%92%e5%91%bc%e3%81%b3%e5%87%ba%e3%81%99%e3%80%82\/","title":{"rendered":"ExQueueWorkItem \u3092\u4f7f\u3063\u3066 PASSIVE_LEVEL \u3067\u547c\u3073\u51fa\u305b\u308b\u547d\u4ee4\u3092\u4ed6\u306e IRQL \u304b\u3089\u5b9f\u884c\u3055\u305b\u308b\u3002"},"content":{"rendered":"<p>\u3069\u3046\u3082\u307f\u3080\u3089\u3067\u3059\u3002<\/p>\n<p>&#160;<\/p>\n<p>\u6700\u8fd1\u3068\u3042\u308b\u7528\u304c\u3042\u3063\u3066\u30ab\u30fc\u30cd\u30eb\u30e2\u30fc\u30c9\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u304f\u3053\u3068\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002    <br \/>\u306a\u3093\u3060\u304b\u3093\u3060\u3001Linux \u7528\u306e\u30c9\u30e9\u30a4\u30d0\u3082 Windows \u7528\u306e\u30c9\u30e9\u30a4\u30d0\u3082\u6163\u308c\u308b\u3068\u697d\u3057\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\uff08\u30d6\u30eb\u30fc\u30b9\u30af\u30ea\u30fc\u30f3\u306b\u884c\u304b\u306a\u3044\u3088\u3046\u306b\u8003\u3048\u306a\u304c\u3089\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u306e\u304c\u826f\u3044\u611f\u3058\u306b\u8133\u307f\u305d\u306e\u4f53\u64cd\u306b\u306a\u3063\u3066\u3068\u3063\u3066\u3082\u697d\u3057\u3044\u3067\u3059\u3002 \u6c17\u3092\u629c\u304f\u3068\u3059\u3050\u306b\u30d6\u30eb\u30fc\u30b9\u30af\u30ea\u30fc\u30f3\u306b\u306a\u308a\u307e\u3059\u3057\u3002\uff09<\/p>\n<p>&#160;<\/p>\n<p>\u3055\u3066\u3055\u3066\u3002<\/p>\n<p>Windows \u306a\u30ab\u30fc\u30cd\u30eb\u30e2\u30fc\u30c9\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u3044\u3066\u3044\u308b\u4e0a\u3067\u306a\u304b\u306a\u304b\u306b\u554f\u984c\u306b\u306a\u308b\u3053\u3068\u306e\u4e00\u3064\u306b    <br \/>IRQL \u306e\u8a71\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u8a73\u3057\u304f\u306f\u3053\u3061\u3089\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306b\u8a73\u3057\u304f\u307e\u3068\u3081\u3089\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u305d\u3061\u3089\u306b\u304a\u4efb\u305b\u3059\u308b\u3068\u3057\u3066\u3002    <br \/><a title=\"http:\/\/d241445.hosting-sv.jp\/community\/report\/report11.html\" href=\"http:\/\/d241445.hosting-sv.jp\/community\/report\/report11.html\">http:\/\/d241445.hosting-sv.jp\/community\/report\/report11.html<\/a><\/p>\n<p>\u8981\u306f\u5404\u5272\u308a\u8fbc\u307f\u306b\u512a\u5148\u5ea6\u3092\u4ed8\u3051\u3066\u3001\u3059\u3050\u306b\u884c\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3084\u3064\u3092\u3059\u3050\u306b\u884c\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u30fb\u30fb\u3068    <br \/>\u304a\u304a\u3056\u3063\u3071\u3067\u3059\u304c\u305d\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>&#160;<\/p>\n<p>\u307e\u305f\u5404 IRQL \u306b\u3088\u3063\u3066\u5b9f\u884c\u53ef\u80fd\u306a API \u304c\u9650\u3089\u308c\u3066\u304a\u308a\u3001    <br \/>\u3082\u3057\u305d\u308c\u3092\u7121\u8996\u3057\u3066\u5b9f\u884c\u3059\u308b\u3068<\/p>\n<p><a href=\"http:\/\/mimumimu.net\/blog\/wp-content\/uploads\/2014\/05\/image18.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/mimumimu.net\/blog\/wp-content\/uploads\/2014\/05\/image_thumb18.png\" width=\"565\" height=\"425\" \/><\/a><\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001 \u201cIRQL_NOT_LESS_OR_EQUAL\u201d \u306a BSoD \u304c\u767a\u751f\u3057\u307e\u3059\u3002    <br \/>\uff08\u3061\u306a\u307f\u306b\u3053\u308c\u306f KeBugCheckEx \u306b 0xA \u3068\u9069\u5f53\uff08\uff1f\uff09\u306a\u6570\u5b57\u3092\u8a2d\u5b9a\u3057\u3066\u547c\u3073\u51fa\u3057\u307e\u3057\u305f\u3002\uff09<\/p>\n<p>&#160;<\/p>\n<p>\u5404\u7a2e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u306f DISPATCH_LEVEL \u3067\u3084\u3063\u3066\u304f\u308b\u30b1\u30fc\u30b9\u3082\u3042\u308a\u3001    <br \/>PASSIVE_LEVEL \u3067\u306e\u307f\u547c\u3073\u51fa\u305b\u308b\u95a2\u6570\u3092\u3069\u3046\u3084\u3063\u3066\u547c\u3073\u51fa\u3059\u304b\u3002<\/p>\n<hr \/>\n<p>\u4eca\u56de\u306e\u4e00\u4ef6\u306f\u3001    <br \/>\u30d5\u30a3\u30eb\u30bf\u3092\u631f\u307f\u8fbc\u3093\u3067\u30c7\u30fc\u30bf\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3059\u3068\u3044\u3046\u3088\u3046\u306a\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u3044\u3066\u3044\u3066\u3001     <br \/>\u3069\u3053\u304b\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u66f8\u304d\u51fa\u305b\u308c\u3070\u3044\u3044\u3068\u8003\u3048\u3066\u3001<\/p>\n<p><strong>ExQueueWorkItem \u3092 DelayedWorkQueue \u3067\u547c\u3073\u51fa\u3057<\/strong>\u3066\u3001     <br \/>\u547c\u3073\u51fa\u3057\u5148\u306b\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u8fbc\u307f\u3092\u66f8\u304f\u30fb\u30fb\u3068\u3044\u3046\u65b9\u6cd5\u3067\u5bfe\u51e6\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>&#160;<\/p>\n<p>\u30b3\u30fc\u30c9\u3068\u3057\u3066\u306f\u3053\u3093\u306a\u611f\u3058<\/p>\n<div id=\"scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c3fbc68f-86d3-4d2f-9dab-491180baa49e\" class=\"wlWriterEditableSmartContent\" style=\"float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px\">\n<pre class=\"brush: c;\">#include &lt;Ntifs.h&gt;\n#include &lt;ntddk.h&gt;\n#include &lt;Ntstrsafe.h&gt;\n\n#define STR_LENGTH 0x1000\n\ntypedef struct _DATA\n{\n\tLARGE_INTEGER time;\n\twchar_t str[STR_LENGTH];\n} DATA, *PDATA;\n\nvoid _PassiveWrite(PDATA);\n\n\/* \u5916\u90e8\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u308b\u95a2\u6570\u3002\u3053\u3053\u306f IRQL &lt;= DISPATCH_LEVEL \u3067\u3042\u308c\u3070\u5b9f\u884c\u53ef\u80fd *\/\nvoid Write(PDATA d)\n{\n\tWORK_QUEUE_ITEM workitem;\n\tPDATA data;\n\n\t\/* \u975e\u30da\u30fc\u30b8\u30d7\u30fc\u30eb\u4e0a\u306b\u9818\u57df\u3092\u78ba\u4fdd\u3059\u308b *\/\n\tdata = (PDATA)ExAllocatePoolWithTag(NonPagedPool, sizeof(DATA), 0x0616);\n\tif(data == NULL)\n\t\treturn;\n\n\t\/* \u30c7\u30fc\u30bf\u3092\u6e96\u5099\u3059\u308b\u3002 *\/\n\tExInitalizeWorkItem(&amp;workitem,_PassiveWrite,data);\n\tmemcpy_s(data,sizeof(DATA),d,sizeof(DATA));\n\n\t\/* Queue \u306b\u767b\u9332\u3059\u308b *\/\n\tExQueueWorkItem(&amp;workitem, DelayedWorkQueue);\n}\n\n\/*\nExQueueWorkItem \u306b\u3088\u3063\u3066\u767b\u9332\u3055\u308c\u3001\u5b9f\u884c\u53ef\u80fd\u306b\u306a\u3063\u305f\u6642\u306b\u547c\u3073\u51fa\u3055\u308c\u308b\u3002 \n\u3053\u3053\u306e IRQL \u306f PASSIVE_LEVEL \u306b\u306a\u308b\n*\/\nvoid _PassiveWrite(PDATA data)\n{\n\tHANDLE handle;\n\tNTSTATUS status;\n\tUNICODE_STRING str;\n\tIO_STATUS_BLOCK statusblock = {0};\n\n\t\/* \u30d5\u30a1\u30a4\u30eb\u30aa\u30fc\u30d7\u30f3 *\/\n\t{\n\t\tUNICODE_STRING path;\n\t\tOBJECT_ATTRIBUTES attr = {0};\n\n\t\tRtlInitUnicodeString(&amp;path, L\"\\\\??\\\\C:\\\\Logs\\\\nonohara.log\");\n\t\tInitializeObjectAttributes(&amp;attr,&amp;path,\n\t\t\tOBJ_CASE_INSENSITIVE | \n\t\t\tOBJ_KERNEL_HANDLE |\n\t\t\tOBJ_FORCE_ACCESS_CHECK,\n\t\t\tNULL, NULL);\n\n\t\tstatus = ZwCreateFile(\n\t\t\t&amp;handle,FILE_APPEND_DATA,\n\t\t\t&amp;attr,&amp;statusblock,NULL,\n\t\t\tFILE_ATTRIBUTE_NORMAL,\n\t\t\t0,FILE_OPEN_IF,\n\t\t\tFILE_SYNCHRONOUS_IO_NONALERT,\n\t\t\tNULL,0\n\t\t);\n\t\t\n\t}\n\n\tif(!NT_SUCCESS(status))\n\t{\n\t\tExFreePoolWithTag(data,0x0616);\n\t\treturn;\n\t}\n\n\t\/* \u66f8\u304d\u8fbc\u3080\u6587\u5b57\u5217\u3092\u4f5c\u308b *\/\n\tstr.Buffer = ExAllocatePoolWithTag(NonPagedPool,STR_LENGTH*2,0x1133);\n\tstr.MaximumLength = STR_LENGTH*2;\n\tstr.Length = 0;\n\n\tRtlUnicodeStringPrintf(&amp;str,L\"%I64u,%s\\r\\n\",\n\t\tdata-&gt;time,\n\t\tdata-&gt;str\n\t);\n\n\t\/* \u66f8\u304d\u8fbc\u3080 *\/\n\tZwWriteFile(handle, NULL, NULL, NULL, \n\t\t&amp;statusblock, str.Buffer, str.Length, NULL, NULL);\n\n\t\/* \u30d0\u30c3\u30d5\u30a1\u30fc\u3092\u30af\u30ea\u30a2\u3059\u308b *\/\n\tZwFlushBuffersFile(handle,&amp;statusblock);\n\tZwClose(handle);\n\n\t\/* \u30e1\u30e2\u30ea\u3092\u89e3\u653e\u3059\u308b *\/\n\tExFreePoolWithTag(str.Buffer, 0x1133);\n\tExFreePoolWithTag(data, 0x0616);\n}<\/pre>\n<\/div>\n<p>&#160;<\/p>\n<p>\u305f\u3068\u3048\u3070\u3053\u308c\u3092\u5fdc\u7528\u3057\u3066\u3001<br \/>\n  <br \/>\u30c9\u30e9\u30a4\u30d0\u3092\u958b\u59cb\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u30cf\u30f3\u30c9\u30eb\u3092\u63e1\u3063\u3066\u304a\u304d <\/p>\n<p>\uff08\u305d\u306e\u9593\u3001\u5171\u6709\u72b6\u614b\u3067 CreateFile \u3092\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u4ed6\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u304c\u30ed\u30c3\u30af\u3055\u308c\u308b\u3002\uff09 <\/p>\n<p>\u30c9\u30e9\u30a4\u30d0\u304c\u505c\u6b62\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30d0\u30c3\u30d5\u30a1\u3092\u30d5\u30e9\u30c3\u30b7\u30e5\u3057\u3066\u30af\u30ed\u30fc\u30ba\u3059\u308b\u30fb\u30fb\u3068\u304b\u3002 <\/p>\n<p>\uff08\u305d\u306e\u9593\u30d0\u30c3\u30d5\u30a1\u30ea\u30f3\u30b0\u304c\u52b9\u304f\u306e\u3067\u3001\u305f\u3076\u3093\u826f\u3044\u611f\u3058\u306b\u306a\u308b\u30fb\u30fb\u306f\u305a\uff09<\/p>\n<p>&#160;<\/p>\n<p>\u5f8c\u306f\u4f55\u304b\u3001\u7279\u5b9a\u306e\u52d5\u4f5c\u304c\u3042\u3063\u305f\u5834\u5408\u306b\u4f55\u304b\u3092\u547c\u3073\u51fa\u3059\u3068\u304b\u305d\u3046\u3044\u3046\u306e\u304c\u66f8\u3051\u307e\u3059\u3002<\/p>\n<p>&#160;<\/p>\n<p>\u30fb\u30fb\u30fb\u3068\u308a\u3042\u3048\u305a\u3001\u500b\u4eba\u7684\u306a\u30e1\u30e2\u3002<\/p>\n<p>\u8ab0\u304b\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u3044\u3066\u3044\u3066\u3053\u306e\u8a18\u4e8b\u3067\u89e3\u6c7a\u3059\u308b\u3053\u3068\u304c\u3042\u308c\u3070\u30fb\u30fb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3046\u3082\u307f\u3080\u3089\u3067\u3059\u3002 &#160; \u6700\u8fd1\u3068\u3042\u308b\u7528\u304c\u3042\u3063\u3066\u30ab\u30fc\u30cd\u30eb\u30e2\u30fc\u30c9\u30c9\u30e9\u30a4\u30d0\u3092\u66f8\u304f\u3053\u3068\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002 \u306a\u3093\u3060\u304b\u3093\u3060\u3001Linux \u7528\u306e\u30c9\u30e9\u30a4\u30d0\u3082 Windows \u7528\u306e\u30c9\u30e9\u30a4\u30d0\u3082\u6163\u308c\u308b\u3068\u697d\u3057\u3044\u3067\u3059\u306d\u3002 \uff08\u30d6\u30eb\u30fc\u30b9\u30af\u30ea\u30fc\u30f3\u306b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,15,142],"tags":[519,520,521,522],"class_list":["post-5091","post","type-post","status-publish","format-standard","hentry","category-c_cpp","category-windows","category-windows-8","tag-exqueueworkitem","tag-irql","tag-passive_level","tag-522"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/posts\/5091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/comments?post=5091"}],"version-history":[{"count":0,"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/posts\/5091\/revisions"}],"wp:attachment":[{"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/media?parent=5091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/categories?post=5091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mimumimu.net\/blog\/wp-json\/wp\/v2\/tags?post=5091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}