{"id":203,"date":"2010-04-18T00:31:45","date_gmt":"2010-04-18T09:31:45","guid":{"rendered":"\/blog\/?p=203"},"modified":"2023-09-21T09:39:11","modified_gmt":"2023-09-21T00:39:11","slug":"ddk-undocument-%ed%95%a8%ec%88%98%eb%a5%bc-%ec%9d%b4%ec%9a%a9%ed%95%9c-driver-object-pointer-%ea%b5%ac%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=203","title":{"rendered":"[DDK] Undocument \ud568\uc218\ub97c \uc774\uc6a9\ud55c Driver Object Pointer \uad6c\ud558\uae30"},"content":{"rendered":"\n\ub4dc\ub77c\uc774\ubc84\ub97c \uc791\uc131\ud558\ub2e4\ubcf4\uba74, \ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uac00\uc9c0\uace0 DriverObject\ub97c \uc5bb\uace0 \uc2f6\uc744 \ub54c\uac00 \uc788\uc2b5\ub2c8\ub2e4.<br \/>DeviceObject\uc758 \uacbd\uc6b0\uc5d0\ub294 \nDocument\ub41c \ud568\uc218\ub97c \uc774\uc6a9\ud558\uba74 \ub418\uc9c0\ub9cc, DriverObject\ub97c \uc774\ub984\uc744 \uc774\uc6a9\ud558\uc5ec<br \/>\uc5bb\uc5b4\uc624\ub294 \ud568\uc218\ub294 Document\ub418\uc5b4 \uc788\uc9c0 \n\uc54a\uc8e0...<br \/><br \/><strong><font color=\"#0000ff\">ObReferenceObjectByName<\/font><\/strong> \n\ud568\uc218\ub97c \uc774\uc6a9\ud558\uba74, DriverObject\ub3c4 \uc774\ub984\uc73c\ub85c \uc5bb\uc5b4\uc62c\uc218 \uc788\uc8e0..<br \/><br \/>\uc544\ub798\uc640 \uac19\uc774 \ud568\uc218\ub97c \ub9cc\ub4e4\uc5b4 \ub193\uc73c\uba74 \n\uc88b\uc2b5\ub2c8\ub2e4.<br \/><br \/><span style=\"font-weight: bold;\">[function \nprototype]<\/span><br \/><br \/><font color=\"#0000ff\">NTSTATUS<\/font><br \/><font color=\"#d41a01\">ObReferenceObjectByName<\/font>(<br \/>IN <font color=\"#0000ff\">PUNICODE_STRING<\/font> ObjectName,<br \/>IN <font color=\"#0000ff\">ULONG<\/font> Attributes,<br \/>IN <font color=\"#0000ff\">PACCESS_STATE<\/font> PassedAccessState OPTIONAL,<br \/>IN <font color=\"#0000ff\">ACCESS_MASK<\/font> DesiredAccess OPTIONAL,<br \/>IN <font color=\"#0000ff\">POBJECT_TYPE<\/font> ObjectType,<br \/>IN <font color=\"#0000ff\">KPROCESSOR_MODE<\/font> AccessMode,<br \/>IN OUT <font color=\"#0000ff\">PVOID<\/font> ParseContext OPTIONAL,<br \/>OUT <font color=\"#0000ff\">PVOID<\/font> *Object<br \/>);<br \/><br \/><span style=\"font-weight: bold;\">[function definition]<\/span><br \/>\n<div class=\"dp-highlighter\">\n<div class=\"bar\">\n<div class=\"tools\">&nbsp;<\/div><\/div>\n<ol class=\"dp-c\"><li class=\"alt\"><span><span class=\"keyword\"><strong><font color=\"#006699\">extern<\/font><\/strong><\/span><span>&nbsp;POBJECT_TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *IoDriverObjectType; \n &nbsp;<\/span><\/span> \n<\/li><li><span>&nbsp; <\/span> \n<\/li><li class=\"alt\"><span>PDRIVER_OBJECT GetDriverObject( WCHAR* DeviceName ) \n &nbsp;<\/span> \n<\/li><li><span>{ &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp;UNICODE_STRING uniDriverName; &nbsp; <\/span> \n<\/li><li><span>&nbsp;PVOID &nbsp;pDriverObj; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp;NTSTATUS status;&nbsp; &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; <\/span> \n<\/li><li><span>&nbsp;RtlInitUnicodeString( &amp;uniDriverName, &nbsp;DeviceName);&nbsp; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; <\/span> \n<\/li><li><span>&nbsp;status =&nbsp;ObReferenceObjectByName( &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; &amp;uniDriverName, &nbsp; &nbsp;<\/span><span class=\"comment\"><font color=\"#008200\">\/\/ IN PUNICODE_STRING ObjectName \n<\/font><\/span><span>&nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; OBJ_CASE_INSENSITIVE, &nbsp;<\/span><span class=\"comment\"><font color=\"#008200\">\/\/ IN ULONG Attributes <\/font><\/span><span>&nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; NULL, &nbsp; &nbsp; &nbsp;<\/span><span class=\"comment\"><font color=\"#008200\">\/\/ IN PACCESS_STATE PassedAccessState OPTIONAL,&nbsp; \n<\/font><\/span><span>&nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; (ACCESS_MASK)0L, &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; *IoDriverObjectType, &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; KernelMode, &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; NULL, &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &amp;pDriverObj &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; &nbsp; &nbsp; ); &nbsp; <\/span> \n<\/li><li><span>&nbsp; &nbsp; &nbsp; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp; <\/span> \n<\/li><li><span>&nbsp;<\/span><span class=\"keyword\"><strong><font color=\"#006699\">if<\/font><\/strong><\/span><span>( NT_SUCCESS(status)) \n &nbsp;<\/span> \n<\/li><li class=\"alt\"><span>&nbsp;{ &nbsp; <\/span> \n<\/li><li><span>&nbsp; KdPrint((<\/span><span class=\"string\"><font color=\"#0000ff\">\"DEVGURU :: DeviceName ==&gt; %ws, DriverObject =&nbsp;0x%x \\n\"<\/font><\/span><span>, &nbsp;DeviceName, pDriverObj )); \n &nbsp;<\/span> \n<\/li><li class=\"alt\"><span>&nbsp; ObDereferenceObject(pDriverObj); &nbsp; <\/span> \n<\/li><li><span>&nbsp; <\/span><span class=\"keyword\"><strong><font color=\"#006699\">return<\/font><\/strong><\/span><span>&nbsp;(PDRIVER_OBJECT)pDriverObj; \n &nbsp;<\/span> \n<\/li><li class=\"alt\"><span>&nbsp;} &nbsp; <\/span> \n<\/li><li><span>&nbsp;&nbsp; &nbsp; <\/span> \n<\/li><li class=\"alt\"><span>&nbsp;<\/span><span class=\"keyword\"><strong><font color=\"#006699\">return<\/font><\/strong><\/span><span>&nbsp;(PDRIVER_OBJECT)0; \n &nbsp;<\/span> \n<\/li><li><span>} &nbsp;<\/span><\/li><\/ol><\/div>&lt;TEXTAREA class=\"c#\" style=\"DISPLAY: \nnone\" name=code rows=10 cols=60&gt;extern POBJECT_TYPE *IoDriverObjectType; \nPDRIVER_OBJECT GetDriverObject( WCHAR* DeviceName ) { UNICODE_STRING \nuniDriverName; PVOID pDriverObj; NTSTATUS status; RtlInitUnicodeString( \n&amp;uniDriverName, DeviceName); status = ObReferenceObjectByName( \n&amp;uniDriverName, \/\/ IN PUNICODE_STRING ObjectName OBJ_CASE_INSENSITIVE, \/\/ IN \nULONG Attributes NULL, \/\/ IN PACCESS_STATE PassedAccessState OPTIONAL, \n(ACCESS_MASK)0L, *IoDriverObjectType, KernelMode, NULL, &amp;pDriverObj ); if( \nNT_SUCCESS(status)) { KdPrint((\"DEVGURU :: DeviceName ==&gt; %ws, DriverObject = \n0x%x \\n\", DeviceName, pDriverObj )); ObDereferenceObject(pDriverObj); return \n(PDRIVER_OBJECT)pDriverObj; } return (PDRIVER_OBJECT)0; } &lt;\/TEXTAREA&gt; \n<p><br \/><br \/>ex) GetDriverObject( L<a class=\"con_link\" href=\"\/\/\/\" target=\"_blank\" rel=\"noopener\"><font color=\"#af3281\">\\\\Driver\\\\TaejinDriver<\/font><\/a>);<br \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub4dc\ub77c\uc774\ubc84\ub97c \uc791\uc131\ud558\ub2e4\ubcf4\uba74, \ub4dc\ub77c\uc774\ubc84 \uc774\ub984\uc744 \uac00\uc9c0\uace0 DriverObject\ub97c \uc5bb\uace0 \uc2f6\uc744 \ub54c\uac00 \uc788\uc2b5\ub2c8\ub2e4.DeviceObject\uc758 \uacbd\uc6b0\uc5d0\ub294 Document\ub41c \ud568\uc218\ub97c \uc774\uc6a9\ud558\uba74 \ub418\uc9c0\ub9cc, DriverObject\ub97c \uc774\ub984\uc744 \uc774\uc6a9\ud558\uc5ec\uc5bb\uc5b4\uc624\ub294 \ud568\uc218\ub294 Document\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc8e0&#8230; ObReferenceObjectByName \ud568\uc218\ub97c \uc774\uc6a9\ud558\uba74, DriverObject\ub3c4 \uc774\ub984\uc73c\ub85c \uc5bb\uc5b4\uc62c\uc218 \uc788\uc8e0.. \uc544\ub798\uc640 \uac19\uc774 \ud568\uc218\ub97c \ub9cc\ub4e4\uc5b4 \ub193\uc73c\uba74 \uc88b\uc2b5\ub2c8\ub2e4. [function prototype] NTSTATUSObReferenceObjectByName(IN PUNICODE_STRING ObjectName,IN ULONG Attributes,IN PACCESS_STATE PassedAccessState OPTIONAL,IN ACCESS_MASK DesiredAccess OPTIONAL,IN POBJECT_TYPE ObjectType,IN KPROCESSOR_MODE AccessMode,IN OUT PVOID ParseContext [&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-203","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\/203","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=203"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}