{"id":199,"date":"2010-04-18T00:28:43","date_gmt":"2010-04-18T09:28:43","guid":{"rendered":"\/blog\/?p=199"},"modified":"2023-09-21T09:39:11","modified_gmt":"2023-09-21T00:39:11","slug":"ddk-irp%ea%b0%80-%eb%b9%84%eb%8f%99%ea%b8%b0%ec%a0%81%ec%9c%bc%eb%a1%9c-%ec%b2%98%eb%a6%ac%eb%90%98%ec%96%b4%ec%95%bc-%ed%95%a0%eb%95%8c","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=199","title":{"rendered":"[DDK] IRP\uac00 \ube44\ub3d9\uae30\uc801\uc73c\ub85c \ucc98\ub9ac\ub418\uc5b4\uc57c \ud560\ub54c"},"content":{"rendered":"\n<div class=\"article_post\">\uc694\uc998 \uac01\uc885 \ubc88\uc5ed\uc11c\ub4e4\uc774 \ub9c8\uc74c\uc5d0 \uc548\ub4e4\uc5b4\uc11c DDK\uc640 WDK \ubb38\uc11c\ub97c \ubcf4\uba74\uc11c <br \/><br \/>\uacf5\ubd80\ub97c \ud558\uace0 \n\uc788\ub2e4.<br \/><br \/>\uc601\uc5b4\uae34 \ud55c\ub370, \uac70\ubd80\uac10\uc5c6\uc774 \ubcf4\ub2c8\uae4c \uc601 \uac70\ub9ac\uac00 \uba40\uc9c4 \uc54a\uc740\uac83 \uac19\ub2e4.<br \/><br \/>\uc775\uc219\ud574\uc9c0\uba74 \uc601\uc5b4\ub3c4 \ub298\uace0 \uc88b\uaca0\uc9c0,, - \n_-;<br \/><br \/>\uc77c\ub2e8 \uc815\ub9ac\ud574\ubcf4\uba74, Queuing\uc744 \ud55c\ub2e4.<br \/><br \/>\uc65c\ub0d0? \ube44\ub3d9\uae30\uc801\uc73c\ub85c \ucc98\ub9ac\ud574\uc57c\ud558\uba74 \ud050\uc5d0 \uc313\uc544\ub193\uc558\ub2e4\uac00 \n\ucc98\ub9ac\ud574\uc57c\ud55c\ub2e4.<br \/><br \/>\uadf8\ub7ec\uae30\uc704\ud574\uc11c Queuing\uc744 \ud574\uc57c\ud558\ub294\ub370,<br \/><br \/>\uc77c\ub2e8 \ub0b4\uc6a9\uc744 \ubcf4\uba74 \uc774\ub807\ub2e4. <br \/><br \/><\/div>\n<h1 class=\"article_post\">Force Pending I\/O Requests<\/h1>\n<p class=\"article_post\">The Force Pending I\/O Requests option randomly returns \nSTATUS_PENDING in response to a driver's calls to <mshelp:link tabindex=\"0\" keywords=\"k104_8579a946-2f96-455f-825c-c3f86caba99c.xml\"><b>IoCallDriver<\/b><\/mshelp:link>. \nThis option tests the driver's logic for responding to STATUS_PENDING return \nvalues from <b>IoCallDriver<\/b>.<\/p>\n<p class=\"article_post\">This option is supported only on Windows Vista and later \nversions of the Windows operating system.<\/p>\n<p class=\"note\"><b>Caution<\/b>&nbsp; Do not use this option on a driver unless you have \ndetailed knowledge of the operation of the driver and have verified that the \ndriver is designed to handle STATUS_PENDING return values from <i>all<\/i> of its \ncalls to <b>IoCallDriver<\/b>. Running this option on a driver that is not \ndesigned to handle STATUS_PENDING from all calls can result in crashes, memory \ncorruptions, and unusual system behavior that can be difficult to debug or \ncorrect.<\/p>\n<h4 class=\"article_post\">Why Use Force Pending I\/O Requests?<\/h4>\n<p class=\"article_post\">Higher-level drivers in a driver stack call <mshelp:link tabindex=\"0\" keywords=\"k104_8579a946-2f96-455f-825c-c3f86caba99c.xml\"><b>IoCallDriver<\/b><\/mshelp:link> \nto pass an IRP down to lower-level drivers in the driver stack. The driver \ndispatch routine in the lower-level driver that receives the IRP can either \ncomplete the IRP immediately or return STATUS_PENDING and complete the IRP at a \nlater time. <\/p>\n<p class=\"article_post\">Typically, the caller must be prepared to handle either \noutcome. However, because most dispatch routines handle the IRP immediately, the \nSTATUS_PENDING logic in the caller is not often exercised and serious logic \nerrors might not be detected. The Force Pending I\/O Requests option intercepts \ncalls to <b>IoCallDriver<\/b> and returns STATUS_PENDING to test the calling \ndriver's infrequently used logic.<\/p>\n<h4 class=\"article_post\">When do you use Force Pending I\/O Requests?<\/h4>\n<p class=\"article_post\">Before running this test, review the driver design and \nsource code and confirm that the driver is intended to handle STATUS_PENDING \nfrom <i>all<\/i> of its <mshelp:link tabindex=\"0\" keywords=\"k104_8579a946-2f96-455f-825c-c3f86caba99c.xml\"><b>IoCallDriver<\/b><\/mshelp:link><b> \n<\/b>calls.<\/p>\n<p class=\"article_post\">Many drivers are not designed to handle STATUS_PENDING on \nall calls to <b>IoCallDriver<\/b>. They might be sending the IRP to a particular \nwell-known driver that is guaranteed to complete the IRP immediately. Sending \nSTATUS_PENDING to a driver that does not handle it can cause driver and system \ncrashes and memory corruption.<\/p>\n<h4 class=\"article_post\">How should drivers handle STATUS_PENDING?<\/h4>\n<p class=\"article_post\">The higher-level driver that calls <mshelp:link tabindex=\"0\" keywords=\"k104_8579a946-2f96-455f-825c-c3f86caba99c.xml\"><b>IoCallDriver<\/b><\/mshelp:link><b> \n<\/b>must handle a STATUS_PENDING return value as follows:<\/p>\n<div class=\"article_post\">\n<ul type=\"disc\"><li>Before calling <b>IoCallDriver<\/b>, the driver must call <mshelp:link tabindex=\"0\" keywords=\"k104_94704d64-ce8d-4a4d-82e3-974cda66dd54.xml\"><b>IoBuildSynchronousFsdRequest<\/b><\/mshelp:link> \nto arrange for synchronous processing of the IRP. \n<\/li><li>If <b>IoCallDriver<\/b> returns STATUS_PENDING, the driver must wait for the \ncompletion of the IRP by calling <mshelp:link tabindex=\"0\" keywords=\"k105_de338bec-f7ef-4780-85e6-592a24314145.xml\"><b>KeWaitForSingleObject<\/b><\/mshelp:link> \non the specified event. \n<\/li><li>The driver must anticipate that the IRP might be freed before the I\/O \nManager signals the event. \n<\/li><li>After calling <b>IoCallDriver<\/b>, the caller cannot reference the IRP. \n<\/li><\/ul><\/div>\n<h4>Which Errors Does Force Pending I\/O Request Detect?<\/h4>\n<p>The Force Pending I\/O Request option detects the following errors in the \ndriver that calls <mshelp:link tabindex=\"0\" keywords=\"k104_8579a946-2f96-455f-825c-c3f86caba99c.xml\"><b>IoCallDriver<\/b><\/mshelp:link><b> \n<\/b>and receives a STATUS_PENDING return value:<\/p>\n<ul type=\"disc\"><li>The driver does not call <b>IoBuildSynchronousFsdRequest<\/b> to arrange for \nsynchronous processing. \n<\/li><li>The driver does not call <b>KeWaitForSingleObject<\/b>. \n<\/li><li>The driver references a value in the IRP structure after calling \n<b>IoCallDriver<\/b>. After calling <b>IoCallDriver<\/b>, the higher-level driver \ncannot access the IRP unless it has set a completion routine and then, only when \nall lower-level drivers have completed the IRP. If the IRP is freed, the driver \nwill crash. \n<\/li><li>The driver calls a related function incorrectly. For example, the driver \ncalls <b>KeWaitForSingleObject<\/b> and passes a handle to the event (as the \n<i>Object<\/i> parameter), instead of passing a pointer to an event object. \n<\/li><li>The driver waits for the wrong event. For example, the driver calls \n<b>IoSetCompletionRoutine<\/b>, but waits for an internal event that is signaled \nby its own completion routine, instead of waiting for the IRP event that is \nsignaled by the I\/O Manager when the IRP is complete. <\/li><\/ul>\n<p>\uc774\ub7f0 \uc0c1\ud669\uc77c\ub54c \uc774\ub7f0 \ud568\uc218\ub97c \ud638\ucd9c\ud558\uace0 \uc774\ub7f0\uc0c1\ud669\uc77c\ub54c \uc774\ub7f0 \ud568\uc218\ub97c \ud638\ucd9c\ud558\uace0,<br \/><br \/>\uc774\ub7f0 \ub0b4\uc6a9\uc774\ub2e4.<br \/><br \/><\/p>\n<div class=\"dp-highlighter\">\n<div class=\"bar\">\n<div class=\"tools\"><a class=\"con_link\" href=\"http:\/\/ssmhz.tistory.com\/category\/Kernel%20%26%26%20DDK?page=2#\" target=\"_blank\" rel=\"noopener\"><font color=\"#a0a0a0\">view plain<\/font><\/a><a class=\"con_link\" href=\"http:\/\/ssmhz.tistory.com\/category\/Kernel%20%26%26%20DDK?page=2#\" target=\"_blank\" rel=\"noopener\"><font color=\"#a0a0a0\">copy to clipboard<\/font><\/a><a class=\"con_link\" href=\"http:\/\/ssmhz.tistory.com\/category\/Kernel%20%26%26%20DDK?page=2#\" target=\"_blank\" rel=\"noopener\"><font color=\"#a0a0a0\">print<\/font><\/a><a class=\"con_link\" href=\"http:\/\/ssmhz.tistory.com\/category\/Kernel%20%26%26%20DDK?page=2#\" target=\"_blank\" rel=\"noopener\"><font color=\"#a0a0a0\">?<\/font><\/a><\/div><\/div>\n<ol class=\"dp-cpp\"><li class=\"alt\"><span><span>Irp-&gt;IoStatus.Information =&nbsp;0; &nbsp; <\/span><\/span> \n<\/li><li><span>Irp-&gt;IoStatus.Status =&nbsp;STATUS_PENDING; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>IoMarkIrpPending(Irp); &nbsp; <\/span> \n<\/li><li><span>IoStartPacket(DeviceObject, Irp, NULL, NULL);&nbsp; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span class=\"keyword\"><strong><font color=\"#006699\">return<\/font><\/strong><\/span><span>&nbsp;STATUS_PENDING; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/li><\/ol><\/div>\n<p>&lt;TEXTAREA class=\"cpp\" style=\"DISPLAY: none\" name=code rows=10 \ncols=60&gt;Irp-&gt;IoStatus.Information = 0; Irp-&gt;IoStatus.Status = \nSTATUS_PENDING; IoMarkIrpPending(Irp); IoStartPacket(DeviceObject, Irp, NULL, \nNULL); return STATUS_PENDING; &lt;\/TEXTAREA&gt; <\/p>\n<p>&nbsp;<\/p>\n<p>Queuing\uc744 \ud558\ub294 \ucf54\ub4dc\uc758 \ubaa8\uc2b5\uc774\ub2e4. Queuing\uc744 \ud55c\ub2e4\uace0 Irp\uc5d0 \ub9c8\ud06c\ub97c \ud574\uc8fc\uace0, \uadf8\ub2e4\uc74c\uc5d0 STATUS_PENDING\uc744 \ucc98\ub9ac\ud574\uc900\ub2e4. \n\ud760, \uc73c\ud760, \ub2e4\uc74c\uc5d0\ub294 \ub3d9\uae30\ud654 \ubb38\uc81c\ub97c \uc54c\uc544\ubcf4\uc544\uc57c\ud55c\ub2e4. <\/p>\n<p>&nbsp;<\/p>\ucd9c\ucc98 : <a class=\"con_link\" href=\"http:\/\/ssmhz.tistory.com\/\" target=\"_blank\" rel=\"noopener\">http:\/\/ssmhz.tistory.com<\/a> <br \/>\n","protected":false},"excerpt":{"rendered":"<p>\uc694\uc998 \uac01\uc885 \ubc88\uc5ed\uc11c\ub4e4\uc774 \ub9c8\uc74c\uc5d0 \uc548\ub4e4\uc5b4\uc11c DDK\uc640 WDK \ubb38\uc11c\ub97c \ubcf4\uba74\uc11c \uacf5\ubd80\ub97c \ud558\uace0 \uc788\ub2e4. \uc601\uc5b4\uae34 \ud55c\ub370, \uac70\ubd80\uac10\uc5c6\uc774 \ubcf4\ub2c8\uae4c \uc601 \uac70\ub9ac\uac00 \uba40\uc9c4 \uc54a\uc740\uac83 \uac19\ub2e4. \uc775\uc219\ud574\uc9c0\uba74 \uc601\uc5b4\ub3c4 \ub298\uace0 \uc88b\uaca0\uc9c0,, &#8211; _-; \uc77c\ub2e8 \uc815\ub9ac\ud574\ubcf4\uba74, Queuing\uc744 \ud55c\ub2e4. \uc65c\ub0d0? \ube44\ub3d9\uae30\uc801\uc73c\ub85c \ucc98\ub9ac\ud574\uc57c\ud558\uba74 \ud050\uc5d0 \uc313\uc544\ub193\uc558\ub2e4\uac00 \ucc98\ub9ac\ud574\uc57c\ud55c\ub2e4. \uadf8\ub7ec\uae30\uc704\ud574\uc11c Queuing\uc744 \ud574\uc57c\ud558\ub294\ub370, \uc77c\ub2e8 \ub0b4\uc6a9\uc744 \ubcf4\uba74 \uc774\ub807\ub2e4. Force Pending I\/O Requests The Force Pending I\/O Requests option randomly [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[24],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-development_winddk"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}