<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>My travels with WDF</title><link>http://blogs.msdn.com/888_umdf_4_you/default.aspx</link><description>The continuing story of a boy, 
his dog and their discovery of the world outside...of WDM.</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>We’re gonna need a bigger stick!</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/10/06/9903957.aspx</link><pubDate>Tue, 06 Oct 2009 23:42:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9903957</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9903957.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9903957</wfw:commentRss><description>&lt;p&gt;So, some of you may recognize Eliyas’ name from WinHECs and various other driver dev presentations, but guess what he’s done now?!&amp;#160; &lt;a href="http://blogs.msdn.com/usbcoreblog/" target="_blank"&gt;He’s become a blogger.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Go on feel free to hound him about your USB driver problems. :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9903957" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Random/default.aspx">Random</category></item><item><title>We’ve got more bloggers than we can shake a stick at!</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/09/09/9893327.aspx</link><pubDate>Thu, 10 Sep 2009 00:18:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9893327</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9893327.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9893327</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/nebulut/" target="_blank"&gt;Welcome to the blog-o-sphere Neslihan&lt;/a&gt;.&amp;#160; She’s our resident WLK guru, so you guys and gals can go pester here with all your WDF logo questions. :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9893327" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Random/default.aspx">Random</category></item><item><title>I/O Queues and You</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/08/24/9882882.aspx</link><pubDate>Mon, 24 Aug 2009 21:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9882882</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9882882.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9882882</wfw:commentRss><description>&lt;P&gt;I got an interesting question via mail recently, “Do I really need to create a queue object in my UMDF driver?”&amp;nbsp; Well, this is another one of those, “only if” type questions. &lt;/P&gt;
&lt;P&gt;For instance - Only if your driver is not handling any I/O from a top edge method which results in the I/O manager being involved in talking to the UMDF driver for those operations.&amp;nbsp; At that point you don’t need to create a queue object.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Example - &lt;/P&gt;
&lt;P&gt;The UMDF driver wants to send I/O to a KM driver in another stack based on some form of simple event being raised and consumed by the UMDF device.&amp;nbsp; Provided you have a handle open to that KM stack and have created the I/O target object (all shown &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2009/08/16/9871800.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2009/08/16/9871800.aspx"&gt;here&lt;/A&gt;) you can simply create and format a request, and then send that request to the target.&lt;/P&gt;
&lt;P&gt;Should you want to send requests asynchronously and need a completion callback, you can still do so with out requiring a queue.&amp;nbsp; The driver will have to implement a &lt;A href="http://msdn.microsoft.com/en-us/library/dd183989.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd183989.aspx"&gt;IRequestCallbackRequestCompletion::OnCompletion&lt;/A&gt; method.&amp;nbsp; And during the packing of the request to submit, invoke the request’s &lt;A href="http://msdn.microsoft.com/en-us/library/dd183976.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd183976.aspx"&gt;SetCompletionCallback&lt;/A&gt; prior to invoking the FormatRequest&lt;EM&gt;xxx&lt;/EM&gt; method. &lt;/P&gt;
&lt;P&gt;Once the lower driver has completed the request, the OnCompletion method will be invoked.&amp;nbsp; Voilà.&lt;/P&gt;
&lt;P&gt;There’s one little caveat around UMDF completion routines that &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/10/02/5246740.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/10/02/5246740.aspx"&gt;I talked about a while ago&lt;/A&gt; and I should bring it up here; you can only define one OnCompetion method per device object.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9882882" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category></item><item><title>Cross stack communications</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/08/16/9871800.aspx</link><pubDate>Sun, 16 Aug 2009 23:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9871800</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9871800.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9871800</wfw:commentRss><description>&lt;P&gt;The subject of how to talk to another device stack has come up again, and since I only briefly touched on it a &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2008/01/29/7312079.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2008/01/29/7312079.aspx"&gt;year ago&lt;/A&gt;, I thought it would be good provide some code snippets and a little more background on how to accomplish such a feat.&amp;nbsp; The gist of what we are trying to do here is load a UMDF based driver for one device, open a handle to a different device stack and submit I/O to that stack.&amp;nbsp; To do that in UMDF we need to establish a UMDF I/O target and the foundation of that I/O target object is a file handle.&lt;/P&gt;
&lt;P&gt;So the basic building blocks are as follows;&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;// Add these to your base class&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
    IWDFIoTarget m_ExternalTarget;
    HANDLE m_ExternalHandle;&lt;/PRE&gt;
&lt;P&gt;You can add these to any of your existing classes, but it probably serves best to house these elements in your Device or Queue classes.&amp;nbsp; They are tied to the lifetime of the I/O you are sending to the external target, so where you house them is really down to your design and implementation.&lt;/P&gt;
&lt;P&gt;Based on your needs and how you design your driver, you will need to determine when you proceed with the following sections.&amp;nbsp; For simplicity, I’ll establish the connection to the remote stack in the Device Initialization routine, but the same can be done at just about any other point of initialization or even during a later phase of driver operations.&lt;/P&gt;&lt;PRE class=csharpcode&gt;    IWDFFileHandleTargetFactory * pFileHandleTargetFactory = NULL;

   &lt;SPAN class=rem&gt;// .......&lt;/SPAN&gt;
   &lt;SPAN class=rem&gt;// abstracted device init code for brevity&lt;/SPAN&gt;
   &lt;SPAN class=rem&gt;// ........&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (SUCCEEDED (hr)) 
    {
        m_FxDevice = fxDevice;

        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// We can release the reference as the lifespan is tied to the &lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;// framework object.&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;//&lt;/SPAN&gt;
        fxDevice-&amp;gt;Release();
    }

    &lt;SPAN class=rem&gt;// Open the device and get the handle.&lt;/SPAN&gt;

    m_ExternalHandle = CreateFile (
        DeviceStack,  &lt;SPAN class=rem&gt;// path device stack to open&lt;/SPAN&gt;
        GENERIC_READ | GENERIC_WRITE, &lt;SPAN class=rem&gt;// these flags are driven more by the target stack.&lt;/SPAN&gt;
        FILE_SHARE_READ | FILE_SHARE_WRITE, 
        NULL,         
        OPEN_EXISTING,
        FILE_FLAG_OVERLAPPED, &lt;SPAN class=rem&gt;// You must open the handle with this flag&lt;/SPAN&gt;
        NULL);        



    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (INVALID_HANDLE_VALUE == m_ExternalHandle) 
    {
        DWORD err = GetLastError();

        TraceEvents(
            TRACE_LEVEL_ERROR, 
            TEST_TRACE_DEVICE, 
            &lt;SPAN class=str&gt;"%!FUNC! Cannot open handle to device %!winerr!"&lt;/SPAN&gt;,
            err);

        hr = HRESULT_FROM_WIN32(err);
    }

    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (SUCCEEDED(hr)) 
    {
        hr = m_FxDevice-&amp;gt;QueryInterface(IID_PPV_ARGS(&amp;amp;pFileHandleTargetFactory));

        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (FAILED(hr))
        {
            TraceEvents(
                TRACE_LEVEL_ERROR, 
                TEST_TRACE_DEVICE, 
                L&lt;SPAN class=str&gt;"ERROR: Unable to obtain target factory for creating FileHandle based I/O target %!hresult!"&lt;/SPAN&gt;,
                hr);
        }
    }

    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (SUCCEEDED(hr)) 
    {
        hr = pFileHandleTargetFactory-&amp;gt;CreateFileHandleTarget(m_ExternalHandle, &amp;amp;m_ExternalTarget);
    }&lt;/PRE&gt;
&lt;P&gt;You’ll need to release the reference to the &lt;STRONG&gt;&lt;FONT face="Courier New"&gt;pFileHandleTargetFactory&lt;/FONT&gt; &lt;/STRONG&gt;object, either by a SAFE_RELEASE macro, direct call to the Release(); method, or by using a &lt;A href="http://msdn.microsoft.com/en-us/library/ezzw7k98.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ezzw7k98.aspx"&gt;CComPtr /CComQIPtr&lt;/A&gt;&amp;nbsp; class wrapper on the object on declaration.&amp;nbsp; You’ll also need to clean up the Windows file handle when it is no longer needed.&amp;nbsp; And &lt;STRONG&gt;&lt;EM&gt;IF &lt;/EM&gt;&lt;/STRONG&gt;the IWDFIoTarget object's lifetime scope is&amp;nbsp;narrower than the device object's lifetime, you will need to call &lt;FONT face="Courier "&gt;&lt;STRONG&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd163486.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd163486.aspx"&gt;DeleteWdfObject&lt;/A&gt;&lt;/STRONG&gt; &lt;/FONT&gt;method on &lt;FONT face="Courier New"&gt;&lt;STRONG&gt;m_ExternalTarget.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;At this point, you have your remote target object to use in sending I/O to that secondary device stack.&lt;/P&gt;
&lt;P&gt;What I’ll cover next is going to be some hefty theory on when you should and don’t need to use queue objects and how to send I/O to an external stack based on whether you have a queue or not.&amp;nbsp; Fun! ;)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9871800" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category></item><item><title>The feline, it has escaped the fabric based containment pouch!</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/08/04/9857391.aspx</link><pubDate>Tue, 04 Aug 2009 23:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857391</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9857391.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9857391</wfw:commentRss><description>&lt;P&gt;One of the things I’ve been wanting to do for a while is put &lt;A href="http://msdn.microsoft.com/en-us/library/ms789415.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms789415.aspx"&gt;Isochronous&lt;/A&gt; transfer support back in to the 1394 Hybrid sample.&amp;nbsp; Now that Windows 7 has shipped and we’re picking up projects we want to do during this period of product transitions, I felt the time was right to start this up.&amp;nbsp; All happened to dove tail nicely with the implementation of &lt;A href="http://msdn.microsoft.com/en-us/library/dd445738.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd445738.aspx"&gt;Direct I/O&lt;/A&gt; support which was added to UMDF 1.9 in the end, allowing me to essentially kill two birds with one stone.&amp;nbsp; What we’ll end up with is a demonstration for various methods of I/O flow through this hybrid driver stack as well as having another&amp;nbsp;demonstration of Isochronous transfers for 1394 devices again.&amp;nbsp; Hooray us!&lt;/P&gt;
&lt;P&gt;So, I’m happy to report that work has begun on said project, and as a result I’ll have some tidbits, details and follies to present to you along this path of coding fun in the coming weeks.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Now Playing&lt;EM&gt; – &lt;/EM&gt;Geddy Lee&lt;EM&gt; My Favorite Headache&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857391" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/KMDF/default.aspx">KMDF</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/WDF/default.aspx">WDF</category></item><item><title>Standing by for Eagle</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/07/20/9842222.aspx</link><pubDate>Mon, 20 Jul 2009 23:04:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9842222</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9842222.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9842222</wfw:commentRss><description>&lt;p&gt;Two things are celebrating 40th anniversaries this year.&amp;#160; One is me (okay it’s not until October) and the more significant &lt;em&gt;thing&lt;/em&gt; is Apollo 11 landing on the moon. :)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.nasa.gov/mission_pages/apollo/apollo11_40th.html" target="_blank"&gt;Like any of you really needed to be reminded.&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;Still to this day, my favorite bit of trivia from Apollo 11 is that none of the Astronauts names appear on the mission patch.&amp;#160; And it was the only Apollo mission to have such a patch.&lt;/p&gt;  &lt;p&gt;I didn’t have anything else of driver value for you today other than a Happy Anniversary Apollo 11.&amp;#160; I’ll be back later with some driver related stuff later.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Currently playing; “Live” restream of Apollo 11 mission.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9842222" width="1" height="1"&gt;</description></item><item><title>House cleaning</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/06/30/9809936.aspx</link><pubDate>Tue, 30 Jun 2009 22:13:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9809936</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9809936.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9809936</wfw:commentRss><description>&lt;p&gt;The fourth part of Abhishek’s online UMDF debugging tutorials is up now. :)&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/whdc/devtools/debugging/umdftraining.mspx" href="http://www.microsoft.com/whdc/devtools/debugging/umdftraining.mspx"&gt;http://www.microsoft.com/whdc/devtools/debugging/umdftraining.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next up, those of you playing with Windows 7 may have noticed that the “Found New Hardware” wizard is gone!&amp;#160; This in itself is not that big a deal, but it does mean that some of the WDK sample installation instructions are no longer valid.&amp;#160; &lt;/p&gt;  &lt;p&gt;Simple fix at the end of the day, the device will come up as an “Unknown Device” within Device Manager, choose “Update Driver” from the right click context menu for that device and then follow the directions to point it to the driver(s) you need!&lt;/p&gt;  &lt;p&gt;That’s all for today, those of you in the U.S. enjoy your 4th of July weekend.&amp;#160; And just remember, light fuse then &lt;em&gt;run away&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;*Currently Playing - Dream Theater&lt;em&gt; Light Fuse and Get Away&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9809936" width="1" height="1"&gt;</description></item><item><title>Intellisense, the Musical part 3</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/06/03/9698411.aspx</link><pubDate>Thu, 04 Jun 2009 08:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9698411</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9698411.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9698411</wfw:commentRss><description>&lt;P&gt;Like all good stories, sometimes the 2nd act is the hardest to follow.&amp;nbsp; In this case it was simply a matter of other things coming up rather than writers block. :)&lt;/P&gt;
&lt;P&gt;What kicked me in the rump to get this next part up was a few more questions about driver writing, WDK integration into Visual Studio and Intellisense.&amp;nbsp; One of the very cool features of Visual Studio 2008 is the ability to make a project from existing code.&lt;/P&gt;
&lt;P&gt;The end result can look something like this (warning, this is a 1920x1200 resolution PNG *g*)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/teaser_2.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/teaser_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; MARGIN-LEFT: 0px; BORDER-TOP: 0px; MARGIN-RIGHT: 0px; BORDER-RIGHT: 0px" title=teaser border=0 alt=teaser src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/teaser_thumb.png" width=644 height=404 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/teaser_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;I’ll walk you through this using the “a picture is worth a thousand words” mentality;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/Part1_2.png" mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/Part1_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=Part1 border=0 alt=Part1 src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/Part1_thumb.png" width=457 height=363 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/Part1_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part2_2.png" mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part2_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=part2 border=0 alt=part2 src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part2_thumb.png" width=675 height=599 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part2_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Select “Next”&lt;/P&gt;
&lt;P&gt;Then point it to the root of the WDK installation.&amp;nbsp; Pointing it to the root rather than right at the src folder will save you some intellsense headaches later on, sure you’ll get inclusion of all the WDK folders, but it’s actually not a bad thing in the end;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part3_2.png" mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part3_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=part3 border=0 alt=part3 src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part3_thumb.png" width=675 height=599 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part3_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select “Next”&lt;/P&gt;
&lt;P&gt;Then;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part4_2.png" mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part4_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=part4 border=0 alt=part4 src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part4_thumb.png" width=675 height=599 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part4_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select “Finish” from here.&amp;nbsp; We’re still not going to use Visual Studio to do any building for now, partly because I refuse to give up all command windows in my life and also because I’m still tinkering with all the settings required to use the WDK build environments under Visual Studio.&lt;/P&gt;
&lt;P&gt;Now your Solution Explorer will probably look like a mess of files listed alphabetically.&amp;nbsp; Simply hover over the “Show All Files” button at the top and toggle it until you get an Explorer like layout of the samples sources structure.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part6_2.png" mce_href="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part6_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=part6 border=0 alt=part6 src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part6_thumb.png" width=465 height=1060 mce_src="http://blogs.msdn.com/blogfiles/888_umdf_4_you/WindowsLiveWriter/IntellisensetheMusicalpart3_14082/part6_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you have pointer to the first picture in the blog post. :)&lt;/P&gt;
&lt;P&gt;As a side note to any Microsoft Employees who may actually read my blog – Yes, you can do the same thing with our Source&amp;nbsp;Control Enlistments (I have a VS project for each branch I work out of).&amp;nbsp; And if you have&amp;nbsp;one of the&amp;nbsp;Source Control plugs in for Visual Studio, you can also have all the check in / check out / history that&amp;nbsp;our source control&amp;nbsp;provides.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9698411" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/VisualStudio/default.aspx">VisualStudio</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/WDF/default.aspx">WDF</category></item><item><title>UMDF Debugging talks online</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/05/06/9591944.aspx</link><pubDate>Wed, 06 May 2009 23:01:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9591944</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9591944.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9591944</wfw:commentRss><description>&lt;p&gt;Our wondrous Abhishek did a series of Debugging UMDF driver talks and I’m happy to say we now have the first three live on line!&lt;/p&gt;  &lt;p&gt;In these he covers some of the basics; where to find and how to use WDFVerifier, how to use some of the UMDF Debugger extensions and some basic debugging UMDF scenarios.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/whdc/devtools/debugging/umdftraining.mspx"&gt;http://www.microsoft.com/whdc/devtools/debugging/umdftraining.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As always, any feedback or questions you guys may have, feel free to ping me!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9591944" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category></item><item><title>Double filtered for added UMDF flavor.</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/27/9571980.aspx</link><pubDate>Mon, 27 Apr 2009 23:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9571980</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9571980.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9571980</wfw:commentRss><description>&lt;P&gt;In my &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/15/9551857.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/15/9551857.aspx"&gt;previous post about Filter Drivers&lt;/A&gt;, I mentioned that this time I would focus on a more UMDF centric stack.&amp;nbsp; This one is pretty simple.&lt;/P&gt;
&lt;P&gt;For UMDF only based driver stacks, the single most important directive is the &lt;STRONG&gt;UmdfServiceOrder&lt;/STRONG&gt; INF directvie.&amp;nbsp; As I mentioned last post, that directive is a left to right list determining load order for the drivers contained in the device stack.&amp;nbsp; With the&amp;nbsp;right most element in that list being the the lowest driver loaded.&lt;/P&gt;
&lt;P&gt;Here are two examples – First a UMDF two driver stack with an upper filter;&lt;/P&gt;&lt;PRE class=csharpcode&gt;[&amp;lt;mydriver&amp;gt;_Install.NT.Wdf]
UmdfService=UMDFFunction,WUDFFuncDriver_Install
UmdfService=UMDFFilter,UMDFFilter_Install
UmdfServiceOrder=UMDFFilter, UMDFFunction&lt;/PRE&gt;
&lt;P&gt;Now to install a lower filter, simply flip the order in that directive;&lt;/P&gt;&lt;PRE class=csharpcode&gt;[&amp;lt;mydriver&amp;gt;_Install.NT.Wdf]
UmdfService=UMDFFunction,WUDFFuncDriver_Install
UmdfService=UMDFFilter,UMDFFilter_Install
UmdfServiceOrder=UMDFFunction, UMDFFilter&lt;/PRE&gt;
&lt;P&gt;The last tidbits here are; for a device stack that only contains UMDF drivers, there is &lt;EM&gt;&lt;STRONG&gt;no need&lt;/STRONG&gt;&lt;/EM&gt; to add any of these settings in the INF;&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;STRIKE&gt;[&amp;lt;mydriver&amp;gt;_Device_AddReg]
; Load the redirector &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; an upperfilter on &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt; specific device.
; 0x00010008 - FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
HKR,,&lt;SPAN class=str&gt;"UpperFilters"&lt;/SPAN&gt;,0x00010008,&lt;SPAN class=str&gt;"WUDFRd"&lt;/SPAN&gt;&lt;/STRIKE&gt; &lt;/PRE&gt;
&lt;P&gt;And also as before, the filter driver needs to be a good citizen on the stack, pass on requests it does not own to the next driver and don’t touch anything unless you must.&amp;nbsp; The previous code samples I’ve posted all still apply, but the basics are; &lt;A href="http://msdn.microsoft.com/en-us/library/dd163498.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd163498.aspx"&gt;GetDefaultIoTarget&lt;/A&gt;, &lt;A href="http://msdn.microsoft.com/en-us/library/dd183998.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd183998.aspx"&gt;FormatUsingCurrentType&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/library/dd184004.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd184004.aspx"&gt;Send&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;There’s no need to change any code for a basic filter driver based on its load order (upper or lower filter).&amp;nbsp; As you get in to more advanced driver functionality you may find a need to change default behaviors.&amp;nbsp; For those cases, you can always send us mail. :)&lt;/P&gt;
&lt;P&gt;There was also some questions about why would you want or need to be an upper or lower filter driver.&amp;nbsp; That one gets in to a bit more of a “it’s up to you”&amp;nbsp; but the core logic that applies to &lt;A href="http://msdn.microsoft.com/en-us/library/aa490242.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/aa490242.aspx"&gt;WDM / KMDF drivers&lt;/A&gt; applies to UMDF drivers (save the parts about bus drivers *g*). &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9571980" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category></item><item><title>There goes the Sun...there goes the sun and I say...</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/20/9556833.aspx</link><pubDate>Mon, 20 Apr 2009 18:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9556833</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9556833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9556833</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://www.gearlog.com/2009/04/oracle_buys_sun.php" mce_href="http://www.gearlog.com/2009/04/oracle_buys_sun.php"&gt;Oracle Buys Sun - Gearlog&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I’m not sure how to feel about this.&amp;nbsp; I know it probably went under a lot of people’s radar, but it almost feels like the passing of a rival.&amp;nbsp; Something you wished would happen earlier, but not something you really &lt;EM&gt;wanted&lt;/EM&gt; to happen because they made life interesting.&amp;nbsp; Scott McNealy’s keynote blastings of Microsoft were legendary and at times very humorous.&amp;nbsp; The “we’re the dot, in dot com” ads always gave me a chuckle.&amp;nbsp; Yup, they part of what made being an employee of Microsoft during the late 90s and early 2000s fun.&lt;/P&gt;
&lt;P&gt;It wasn’t all about the products, they made hockey interesting as well.&amp;nbsp; There were a few charity Sun v. Microsoft hockey games played through the early part of this decade.&amp;nbsp; They ended up being events all to themselves.&amp;nbsp; A good way to let out some frustrations and have some fun with your rivals at the same time.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;All in all it was a good little feud, some barbs, a little blood (very little at a hockey game) and a lawsuit here and there.&amp;nbsp; But as a good feud should do, it drove of us to make our products better in the end.&lt;/P&gt;
&lt;P&gt;Bon chance Sun.&lt;/P&gt;
&lt;P&gt;That said, ol’ Larry Ellison has never been a close friend of Microsoft either. :)&lt;/P&gt;
&lt;P&gt;I’ll have the next part in the UMDF Filter series later this week.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9556833" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Random/default.aspx">Random</category></item><item><title>Genuine UMDF filtered drivers</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/15/9551857.aspx</link><pubDate>Thu, 16 Apr 2009 03:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9551857</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9551857.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9551857</wfw:commentRss><description>&lt;P&gt;Filter drivers have come up in conversations recently (both internal and external), so I wanted to take some time here to address some of the issues that were brought up with regards to UMDF filter drivers and how to make them.&amp;nbsp; Note: I’m not going to cover all the configuration dynamics available for UMDF filter drivers in this one post simply to avoid the risk information overload and clutter, so expect a couple of posts on this subject.&lt;/P&gt;
&lt;P&gt;Let’s start with some basics, we’ll simply demonstrate how to configure and load a UMDF Filter as an upper filter driver to a kernel mode driver (KMDF or WDM) in the same INF-&lt;/P&gt;
&lt;P&gt;As some of you may remember from &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/08/08/4297434.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/08/08/4297434.aspx"&gt;my earlier posts&lt;/A&gt;, a UMDF filter driver&amp;nbsp;should use the&amp;nbsp;&lt;A class="" href="http://msdn.microsoft.com/en-us/library/dd183838.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd183838.aspx"&gt;SetFilter();&lt;/A&gt;&amp;nbsp;property in the DeviceInitialization routine. This tells the Framework to do a couple of things for us automatically:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Send I/O for which the Filter has not registered a callback for to the next logical driver in the stack.&amp;nbsp; Example: Your filter driver registers a DeviceIoctl callback method, but not read or write.&amp;nbsp; As a result your filter driver will only see IOCTLs&lt;/LI&gt;
&lt;LI&gt;Automatically forward file create cleanup and close so there is no need to invoke the AutoForwardCreateCleanupClose method.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;That covers the really basic code required at driver / device initialization time.&amp;nbsp; Now we need to add the pertinent sections to the INF file.&amp;nbsp; As we’re going to focus on being an upper filter for this example, you need to make the following modifications to your INF (in addition to the normal UMDF specific sections);&lt;/P&gt;&lt;PRE class=csharpcode&gt;[&amp;lt;mydriver&amp;gt;.NT.Wdf]
UmdfService = &lt;SPAN class=str&gt;"&amp;lt;mydriver&amp;gt;"&lt;/SPAN&gt;, &amp;lt;mydriver&amp;gt;_Install
UmdfServiceOrder = &amp;lt;mydriver&amp;gt;

[&amp;lt;mydriver&amp;gt;_Device_AddReg]
; Load the redirector &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; an upperfilter on &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt; specific device.
; 0x00010008 - FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND
HKR,,&lt;SPAN class=str&gt;"UpperFilters"&lt;/SPAN&gt;,0x00010008,&lt;SPAN class=str&gt;"WUDFRd"&lt;/SPAN&gt; &lt;/PRE&gt;
&lt;P&gt;So a couple of things to note here -&lt;/P&gt;
&lt;P&gt;One is the UmdfServiceOrder directive, this is load order specific.&amp;nbsp;&amp;nbsp; I’ll address a more UMDF centric stack in the next post, but for those of you who like to work ahead, this is a left to right reading list to determine stack order.&lt;/P&gt;
&lt;P&gt;Second thing is the registry key addition section.&amp;nbsp; As WUDFRd is the kernel mode transport service for UMDF drivers,&amp;nbsp;WUDFRd is the upper level filter driver to a kernel mode driver.&lt;/P&gt;
&lt;P&gt;Now that your driver is loaded as an upper filter, what should your driver do in order to be a good citizen in the stack?&amp;nbsp; Short answer is, as little as possible.&amp;nbsp; You perform the same steps for handling PnP and Power as you would for any basic UMDF driver (one that lets the framework handle the heavy lifting for those two).&amp;nbsp; You register your I/O callback routines and build your queues just like any normal UMDF driver, the only additional requirement here is to forward I/O requests as required.&lt;/P&gt;
&lt;P&gt;For this example, let’s just demonstrate using a fairly simple pass through driver.&amp;nbsp; How you actually implement this is up to you, but the basic requirements here are - as your driver receives the request on&amp;nbsp;the queue,&amp;nbsp;it needs to pas&amp;nbsp;pass it on to the next driver in the stack.&amp;nbsp; So first you need to get the default I/O target (next driver in the stack).&amp;nbsp; Next, format the request using the same type and&amp;nbsp;then finally, send the request.&amp;nbsp; A condensed version would be something along these lines;&lt;/P&gt;&lt;PRE class=csharpcode&gt;    IWDFIoTarget * kmdfIoTarget = NULL;
    
    &lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;-&amp;gt;GetFxDevice()-&amp;gt;GetDefaultIoTarget (&amp;amp;kmdfIoTarget);

    Request-&amp;gt;FormatUsingCurrentType();

    hr = Request-&amp;gt;Send (
        kmdfIoTarget, 
        0,  &lt;SPAN class=rem&gt;// 0 Submits Asynchronous else use WDF_REQUEST_SEND_OPTION_SYNCHRONOUS&lt;/SPAN&gt;
        0);&lt;/PRE&gt;
&lt;P&gt;I also have some more basic code &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/09/26/5154139.aspx" target=_blank mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/09/26/5154139.aspx"&gt;here for you to peruse&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;So now we have a basic UMDF upper filter driver on top of a kernel mode driver.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Now Playing &lt;EM&gt;Capitals v. Rangers&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9551857" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/WDF/default.aspx">WDF</category></item><item><title>Okay I know I said I was going to have a &amp;quot;tech&amp;quot; post next...</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/04/08/9538791.aspx</link><pubDate>Wed, 08 Apr 2009 22:18:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9538791</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9538791.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9538791</wfw:commentRss><description>&lt;p&gt;But this is too Astro-cool. :) &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sciam.com/blog/60-second-science/post.cfm?id=kepler-spacecraft-open-for-business-2009-04-08"&gt;Kepler spacecraft open for business: Scientific American Blog&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9538791" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Astronomy/default.aspx">Astronomy</category></item><item><title>It's full of stars...</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/03/25/9507911.aspx</link><pubDate>Wed, 25 Mar 2009 20:36:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9507911</guid><dc:creator>patman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9507911.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9507911</wfw:commentRss><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Yes, I'm alive, and in perfect hibernation, well not even in the same time zone as hibernation, but you get the joke hopefully. :)&lt;/p&gt;  &lt;p&gt;I just had to share this little ditty with you all because it's very cool.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://news.cnet.com/8301-17939_109-10203360-2.html"&gt;Microsoft, NASA put universe back on the Web | Webware - CNET&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I will resume regular technical type blogging shortly.&amp;#160; Enjoy!&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;*Currently playing - Porcupine Tree &lt;em&gt;Signify&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9507911" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Astronomy/default.aspx">Astronomy</category></item><item><title>Think globally, lock at the smallest scope possible.</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/01/23/9373349.aspx</link><pubDate>Sat, 24 Jan 2009 02:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9373349</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9373349.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9373349</wfw:commentRss><description>&lt;p&gt;Yes, I know that's a rip off of a &lt;a href="http://www.thinkgeek.com/tshirts-apparel/unisex/itdepartment/a882/" target="_blank" mce_href="http://www.thinkgeek.com/tshirts-apparel/unisex/itdepartment/a882/"&gt;ThinkGeek&lt;/a&gt; shirt (which I own). &lt;/p&gt;  &lt;p&gt;Well, this is going to be my &lt;a href="http://blogs.msdn.com/888_umdf_4_you/archive/2006/11/06/1004439.aspx" target="_blank" mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2006/11/06/1004439.aspx"&gt;second post on this topic&lt;/a&gt; (okay, &lt;a href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/02/23/1749739.aspx" target="_blank" mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/02/23/1749739.aspx"&gt;third&lt;/a&gt;), but as it managed to rear its head again recently, what better time to blog.&amp;#160; And I'm going to also blog it simply to prove to Doron that I can provide something other than comic relief.&lt;/p&gt;  &lt;p&gt;You'll notice a few of the existing UMDF samples have their locking constraint set to WdfDeviceLevel in their Device Initialization routines and some others don't set it at all, which defaults to WdfDeviceLevel.&lt;/p&gt;  &lt;p&gt;So, what is the problem with doing it the way some of those samples are?&amp;#160; Well, it does put the widest locking scope on all your objects that the device holds, meaning the device framework acquires a device presentation lock before passing some I/O to their driver callbacks.&amp;#160; This results in serialized calls to that callback for your file and queue operations which is really unnecessary.&amp;#160; There's a really good table in the Windows Driver Foundation book (pg 390) that shows what callbacks are serialized when using the Device Scope level.&amp;#160; And to save some of you looking it up, I'll tell you now that yes, OnDeviceIoControl, OnRead, and OnWrite will get serialized if you set the locking constraint to Device Level.&lt;/p&gt;  &lt;p&gt;So unless your driver really requires a synchronization scope that wide, initialize that constraint to None; &lt;/p&gt;  &lt;pre class="csharpcode"&gt;HRESULT
CVDevDevice::Initialize ( 
                         __in IWDFDriver           * FxDriver,
                         __in IWDFDeviceInitialize * FxDeviceInit)
{
    IWDFDevice * fxDevice = NULL;

    HRESULT hr = S_OK;

    FxDeviceInit-&amp;gt;SetLockingConstraint (None);

    {
        IUnknown * unknown = &lt;span class="kwrd"&gt;this&lt;/span&gt;-&amp;gt;QueryIUnknown ();

        hr = FxDriver-&amp;gt;CreateDevice (FxDeviceInit, unknown, &amp;amp;fxDevice);

        unknown-&amp;gt;Release ();
    }

    &lt;span class="kwrd"&gt;if&lt;/span&gt; (SUCCEEDED (hr)) 
    {
        m_FxDevice = fxDevice;
        fxDevice-&amp;gt;Release();
    }

    &lt;span class="kwrd"&gt;return&lt;/span&gt; hr;
}&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The primary differences here between KMDF and UMDF are UMDF doesn't set an execution level, so the likely hood of you bug checking by screwing this up is greatly reduced. :)&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Edit: For those on RSS, sorry about the embedded style sheet nonsense, I keep forgetting to clear that tick box&lt;/p&gt;

&lt;p&gt;&lt;font size="1"&gt;*Currently playing - King's X &lt;em&gt;Silent Wind&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9373349" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/UMDF/default.aspx">UMDF</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/KMDF/default.aspx">KMDF</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/WDF/default.aspx">WDF</category></item></channel></rss>