<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">My travels with WDF</title><subtitle type="html">The continuing story of a boy, 
his dog and their discovery of the world outside...of WDM.</subtitle><id>http://blogs.msdn.com/b/888_umdf_4_you/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/888_umdf_4_you/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2009-04-15T17:30:00Z</updated><entry><title>Where have you been?!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2012/10/15/10359807.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2012/10/15/10359807.aspx</id><published>2012-10-15T21:24:53Z</published><updated>2012-10-15T21:24:53Z</updated><content type="html">&lt;p&gt;Well, as you could probably guess, I haven't had much to say for a while for a couple of reasons -&amp;nbsp;first and foremost, the&amp;nbsp;Windows&amp;nbsp;8 product cycle was really intense.&amp;nbsp; A lot&amp;nbsp;of changes&amp;nbsp;under the hood came down the pipe, so with the&amp;nbsp;big additions to WDF (UMDF&amp;nbsp;especially)&amp;nbsp;we&amp;nbsp;really had&amp;nbsp;a ton of work to&amp;nbsp;do!&amp;nbsp; Secondly I really couldn't talk about a lot of what was coming and a lot of the issues I would like to have made topics about I couldn't. :)&lt;/p&gt;
&lt;p&gt;But thanks to everybody who provided feedback on the WDK integration with Visual Studio!&amp;nbsp; I hope those changes that&amp;nbsp;did get in helped, and I know they'll be looking at those other suggestions going forward.&amp;nbsp; And a big thank you to all who emailed me asking questions.&amp;nbsp; Hopefully we got your drivers up and running and we look forward to having more driver writers moving over to UMDF, especially now that it supports hardware interrupts!&lt;/p&gt;
&lt;p&gt;The last thing for today is - with some sadness, I'm leaving the WDF team and moving over to the Hardware Certification Kits team!&amp;nbsp; It's a big change for me actually.&amp;nbsp; I've worked with kernel mode device drivers and technologies&amp;nbsp;since Windows 98 (USB,1394 then to WDF), only venturing outside of kernel mode to write tests cases and 99.99999...% of those were in C/C++.&amp;nbsp; So this move is actually really exciting as I'll be "forced" to write more using "modern"&amp;nbsp;languages. :)&lt;/p&gt;
&lt;p&gt;Not that the blog has been &lt;em&gt;really &lt;/em&gt;active for a while for the aforementioned reasons, but I have been getting questions and requests for help during that downtime, so I'm really happy that I (we) were able to provide some help to you guys that&amp;nbsp; you might not have been able to get elsewhere!&amp;nbsp; And the biggest impact I think we had (you and I) was there were bugs that we found in the Frameworks along the way and we were able to fix those for UMDF 1.11!&lt;/p&gt;
&lt;p&gt;Thanks everybody!&amp;nbsp; And keep writing those drivers!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-patrick&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10359807" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="Random" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/Random/" /><category term="VisualStudio" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/VisualStudio/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>You’ve had the time, let’s hear the feedback.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/12/02/10243809.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/12/02/10243809.aspx</id><published>2011-12-02T19:40:57Z</published><updated>2011-12-02T19:40:57Z</updated><content type="html">&lt;p&gt;&lt;font size="3"&gt;I hope those of you who are using the new Visual Studio 2011 with the WDK integration are having some fun, even if it’s just been wandering around and &lt;em&gt;playing.&amp;#160; &lt;/em&gt;What, if anything, are you &lt;u&gt;not&lt;/u&gt; liking about it?&amp;#160; Anything that’s unintuitive or confusing?&amp;#160; What do you like about it, but would like to maybe see tweaked?&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;Now that I finally have my VS 2010 plug-ins to fixed to work with VS 2011 (real subtle changes as all these two plug-ins are wholly internal tools) and have been using it exclusively for the last few weeks.&amp;#160; In particular, how have the KMDF / UMDF templates been working out?&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;So, either use the “send feedback” option or leave a comment – I’ll post them so long as you’re not screaming at me *g*.&amp;#160; I have got direct line of access to the team(s) involved in these projects, so your feedback won’t go off in to the vapor. :)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Now listening to: &lt;em&gt;Caravan &lt;/em&gt;by Rush&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10243809" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="VisualStudio" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/VisualStudio/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>Well, you can kind of see why we’ve been quiet around here…</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/09/15/10211842.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/09/15/10211842.aspx</id><published>2011-09-15T17:12:00Z</published><updated>2011-09-15T17:12:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re watching what&amp;rsquo;s going on at //BUILD (and why wouldn&amp;rsquo;t you be?), you may have seen that UMDF now supports hardware access (via ports and registers) and interrupt handling!&amp;nbsp; If you haven&amp;rsquo;t seen it, &lt;a href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh439560(v=VS.85).aspx" target="_blank"&gt;you can go read more here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And the other big one.&amp;nbsp; Something I&amp;rsquo;ve been begging to get done for years and believe me in all my years at Microsoft it&amp;rsquo;s been one of, if not&amp;nbsp;the most, commonly requested thing I&amp;rsquo;ve heard at all the WinHECs, Developer Conferences, Trade Association meetings, etc from you guys. &amp;ndash; &lt;a href="http://msdn.microsoft.com/en-us/library/windows/hardware/gg490655.aspx" target="_blank"&gt;Visual Studio integration of the WDK&lt;/a&gt;.&amp;nbsp; Even down to templates for &lt;a href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh439659(v=VS.85).aspx" target="_blank"&gt;UMDF&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh439654(v=VS.85).aspx" target="_blank"&gt;KMDF&lt;/a&gt; drivers!&amp;nbsp; You know what that means, native Intellisense (&lt;a href="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/visualstudio/" target="_blank"&gt;not that we haven&amp;rsquo;t figured out how to do that already&lt;/a&gt;), but more importantly, the one thing I couldn&amp;rsquo;t give you (partly because I couldn&amp;rsquo;t get the plug in to work across all VS editions) integrated WDK build support. :D&lt;/p&gt;
&lt;p&gt;There are still a couple of other very cool things in the UMDF / KMDF space we&amp;rsquo;ll get to start talking about pretty soon, and for sure I&amp;rsquo;ll start digging more in to these two as we move closer to the Windows 8 / WDF 1.11 release timeline.&lt;/p&gt;
&lt;p&gt;So the blog will be spooling back up with some fun posts in the coming months.&lt;/p&gt;
&lt;p&gt;Let me know if you have any questions or comments!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-p&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10211842" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="VisualStudio" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/VisualStudio/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>The sounds of silence.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/06/17/10176379.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/06/17/10176379.aspx</id><published>2011-06-17T18:48:34Z</published><updated>2011-06-17T18:48:34Z</updated><content type="html">&lt;p&gt;Greetings one and all (who may be only one left reading at this point *g*).&amp;#160; Some cool things are happening here which is why I’ve been heads down working.&amp;#160; And I can’t tell you about them &lt;em&gt;just&lt;/em&gt; yet – pretty soon though..&amp;#160; But one of the cool things I can tell you about, if you haven’t seen it already - the Kinect SDK has been released.&amp;#160; And I’m very proud to say – it’s using a KMDF driver.&lt;/p&gt;  &lt;p&gt;In addition to that we’ve seen an increase of new WDF based drivers coming from some of you readers.&amp;#160; A few I have helped get their drivers up and running, and others my teammates have been helping.&amp;#160; It’s so nice to see the adoption rates really starting to pick up!&amp;#160; I know refactoring / writing new drivers is a hard sell to some companies, but when the upside is that increased stability and reduction in support costs, it makes that sell a lot easier.&lt;/p&gt;  &lt;p&gt;We’ll be churning up the blog posts again, so stay tuned for more tidbits and tales from the driver side.&lt;/p&gt;  &lt;p&gt;Thanks again everybody – and keep firing questions my way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10176379" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The WDF book is back in print…</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/01/05/10112262.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2011/01/05/10112262.aspx</id><published>2011-01-05T23:40:59Z</published><updated>2011-01-05T23:40:59Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.amazon.com/Developing-Drivers-Windows-Foundation-Developer/dp/0735623740/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1294270728&amp;amp;sr=8-1" href="http://www.amazon.com/Developing-Drivers-Windows-Foundation-Developer/dp/0735623740/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1294270728&amp;amp;sr=8-1"&gt;http://www.amazon.com/Developing-Drivers-Windows-Foundation-Developer/dp/0735623740/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1294270728&amp;amp;sr=8-1&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://oreilly.com/catalog/9780735623743/" href="http://oreilly.com/catalog/9780735623743/"&gt;http://oreilly.com/catalog/9780735623743/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;We now return you to your normally scheduled programming. &lt;img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-72-88-metablogapi/1263.wlEmoticon_2D00_smile_5F00_2.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope you all had a great holiday season and safe New Years!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10112262" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>How active are you?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/10/07/10072863.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/10/07/10072863.aspx</id><published>2010-10-07T17:59:00Z</published><updated>2010-10-07T17:59:00Z</updated><content type="html">&lt;p&gt;Was pondering a few questions the last few days.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;How many of you UMDF writers use &lt;a href="http://msdn.microsoft.com/en-us/library/3ax346b7(VS.80).aspx" target="_blank"&gt;ATL&lt;/a&gt; in your drivers? &lt;/li&gt;    &lt;li&gt;If you do, do you have more of a kernel driver background or a user mode background? &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Since UMDF works on an object model very similar to COM, the ATL does provide a lot of useful object lifetime management functions and interface implementation (&lt;a href="http://msdn.microsoft.com/en-us/library/6bwekse3(VS.80).aspx" target="_blank"&gt;BEGIN_COM_MAP / COM_INTERFACE_ENTRY&lt;/a&gt;).&amp;#160; &lt;/p&gt;  &lt;p&gt;Like I said, just some curious questions for the group.&amp;#160; Post comments or send me an email if you feel like chiming in.&amp;#160; I’m thinking if enough people are interested in using ATL, I could do a series of how to migrate non-ATL drivers to ATL drivers.&lt;/p&gt;  &lt;p&gt;Currently playing: &lt;em&gt;nothing&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10072863" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>Because inquiring minds want to know</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/09/10/10060388.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/09/10/10060388.aspx</id><published>2010-09-10T17:22:25Z</published><updated>2010-09-10T17:22:25Z</updated><content type="html">&lt;p&gt;A follow up question was posed from my last post about the WDF book no longer being in print and I thought it would be better to do a post so it will show up in RSS feeds;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000" size="4" face="Vrinda"&gt;&lt;strong&gt;&lt;em&gt;Q&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;: &lt;em&gt;Any idea what triggered this? I realize that our technology area doesn't sell as much as others, but seems strange to pull the only book on the topic.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Inquiring minds...&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;-scott&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;font color="#ff0000" size="4" face="Vrinda"&gt;A&lt;/font&gt;&lt;/strong&gt;: We’re digging around to find an answer for you all.&amp;#160; The digital versions are still available though so all hope is not lost.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10060388" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Heads up!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/08/26/10054734.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/08/26/10054734.aspx</id><published>2010-08-26T18:14:05Z</published><updated>2010-08-26T18:14:05Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Sharing a cross post that is of interest to you WDF users;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/b/doronh/archive/2010/08/25/developing-drivers-with-the-windows-174-driver-foundation-i-e-the-wdf-book-is-apparently-out-of-print.aspx?wa=wsignin1.0" href="http://blogs.msdn.com/b/doronh/archive/2010/08/25/developing-drivers-with-the-windows-174-driver-foundation-i-e-the-wdf-book-is-apparently-out-of-print.aspx?wa=wsignin1.0"&gt;http://blogs.msdn.com/b/doronh/archive/2010/08/25/developing-drivers-with-the-windows-174-driver-foundation-i-e-the-wdf-book-is-apparently-out-of-print.aspx?wa=wsignin1.0&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10054734" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Time keeps on slippin’</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/08/03/10045592.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/08/03/10045592.aspx</id><published>2010-08-03T21:15:48Z</published><updated>2010-08-03T21:15:48Z</updated><content type="html">&lt;p&gt;Greetings one and all!&amp;#160; Been heads down on some work around here and haven’t been able to post an update in a while.&lt;/p&gt;  &lt;p&gt;A couple of real good case studies have come up recently with regards to driver stability and effective testing of those drivers.&amp;#160; So I want to call out some processes we’ve been presenting in our talks and slide decks to you folks for a while, but they are things we do internally as well.&amp;#160; &lt;/p&gt;  &lt;p&gt;One of the things we are always using in office and test labs are the &lt;a href="http://msdn.microsoft.com/en-us/library/ff554593(VS.85).aspx" target="_blank"&gt;Object Tracking and Reference History tracking features in UMDF&lt;/a&gt;.&amp;#160; Cleaning up and maintaining proper lifetime scope of UMDF objects is a real must.&amp;#160; Plus we like to make sure the documentation for those DDIs and objects calls out that you need to release a reference once you’ve finished using the object.&amp;#160; And we really like to have those trackers on when running negative path testing.&amp;#160; Hitting functional code blocks is nice, but we also want to make sure we’re hitting those negative cases as hard, and ideally, harder.&amp;#160; It’s never what you expect to work that kills your driver’s resource management. ;)&lt;/p&gt;  &lt;p&gt;One easy way to get that extra coverage for negative path testing is to use &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=C4A25AB9-649D-4A1B-B4A7-C9D8B095DF18&amp;amp;displaylang=en" target="_blank"&gt;Application Verifier with its fault injection engine running&lt;/a&gt;.&amp;#160; I’ve been able to find quite a few fun bugs in code using that little trick.&amp;#160; Another bonus you get from Application Verifier is the object leak mechanisms.&amp;#160; We’ve all been prone to forgetting to delete objects (mostly handles *g*) and having these caught at incident time makes them easier to track down and in the end, that makes everybody happier.&lt;/p&gt;  &lt;p&gt;I know there are some good questions out there, so please feel free to speak up!&amp;#160; I love hearing from you all with good case studies or blog fodder.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;Now Playing – Charlie Parker &lt;em&gt;Easy to Love&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10045592" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>A funny thing happened on the way to the keyboard</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/05/28/10017056.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/05/28/10017056.aspx</id><published>2010-05-28T19:04:19Z</published><updated>2010-05-28T19:04:19Z</updated><content type="html">&lt;p&gt;So as I was crafting some UMDF HID driver code for your consumption, and I was working with one of you (and you know who you are *g*) during some of that time frame, we sort of discovered everything already exists between my earlier blog posts and some of the WDK samples.&amp;#160; So rather than reinvent the wheel and the internal combustion engine, let’s just dump all that information in a blog post.&lt;/p&gt;  &lt;p&gt;First up, I touched upon &lt;a href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/24/9984502.aspx" target="_blank"&gt;secure HID stacks and how to get your UMDF HID Collection Filter driver working in them&lt;/a&gt; and a little on how to use impersonation.&amp;#160; And in retrospect, the 30 second and little technical extension in that post are really all that was / is required for getting a basic driver up and running.&amp;#160; Make a note that not all HID stacks require secure connection, so you kind of have to do some debugging or digging around to determine those requirements for your own driver.&amp;#160; Sorry. :)&amp;#160; &lt;/p&gt;  &lt;p&gt;The second part was to alleviate the issues with &lt;a href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/31/9988431.aspx" target="_blank"&gt;Windows session spaces&lt;/a&gt; in order to access some Win32 desktop APIs.&amp;#160; As one of the driving forces to craft a HID Collection filter in UMDF is to have access to those APIs, that session work around is vital.&lt;/p&gt;  &lt;p&gt;The last part is proper implementation required for a secure HID stack is using &lt;a href="http://msdn.microsoft.com/en-us/library/ff554916(VS.85).aspx" target="_blank"&gt;IImpersonateCallback::OnImpersonate&lt;/a&gt; method and its invocation from the &lt;a href="http://msdn.microsoft.com/en-us/library/ff559136(VS.85).aspx" target="_blank"&gt;IWDFIoRequest::Impersonate&lt;/a&gt; method.&amp;#160; Turns out one of the existing samples available in the WDK has a really good implementation; src\usb\osrusbfx2\umdf\fx2_driver\impersonation\&lt;/p&gt;  &lt;p&gt;Put all that together and you can easily craft a HID collection filter driver for the majority of HID devices. Remember though, UMDF cannot be used to filter keyboard and mouse collections.&amp;#160; But you can go crazy writing drivers for a load of other HID devices.&lt;/p&gt;  &lt;p&gt;As always, feel free to ask me questions if you run in to any road blocks.&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;Now Playing – Rush &lt;em&gt;Show Don’t Tell&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10017056" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="HID" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/HID/" /></entry><entry><title>0 and 1 are not just numbers, they’re spaces!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/31/9988431.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/31/9988431.aspx</id><published>2010-03-31T22:33:31Z</published><updated>2010-03-31T22:33:31Z</updated><content type="html">&lt;p&gt;Again, thanks to our intrepid explorer Ilia S. for helping uncover some more traps in the UMDF HID Collection Filter journey.&lt;/p&gt;  &lt;p&gt;Two things to keep in mind as you’re creating your driver:&lt;/p&gt;  &lt;p&gt;1. UMDF drivers are hosted in a Session 0 based executable on Vista and above -&lt;/p&gt;  &lt;p&gt; - and -&lt;/p&gt;  &lt;p&gt;2. A lot of Win32 APIs for controlling desktop and user interactions on the desktop are exclusive to user sessions (anything 1 and above) because Session 0 technically doesn’t have a desktop and is intended to be a protected space.&lt;/p&gt;  &lt;p&gt;So those of you who are wanting / trying to get HID Collection Filter drivers running in UMDF so you can do some magic on the desktop, you will need to do some of the following:&lt;/p&gt;  &lt;p&gt;A Session 0 overview for you with some tips, hints and tricks on how to “exit out” to user desktop sessions.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb756986.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb756986.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;But focus more on this portion;&lt;/p&gt;  &lt;p&gt;Leverage Windows 7, Windows Vista and Windows Server 2008 capability: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Use client or server mechanisms such as remote procedure call (RPC) or named pipes to communicate between services and applications. &lt;/li&gt;    &lt;li&gt;Use the WTSSendMessage function to create a simple message box on the user’s desktop. This allows the service to give the user a notification and request a simple response. &lt;/li&gt;    &lt;li&gt;For more complex UI, use the &lt;a name="OLE_LINK3"&gt;&lt;/a&gt;&lt;a name="OLE_LINK4"&gt;&lt;/a&gt;CreateProcessAsUser function to create a process in the user's session. &lt;/li&gt;    &lt;li&gt;Explicitly choose either the Local\ or Global\ namespace for any named objects, such as events or mapped memory that the service makes available. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And a good tutorial on how to make an application using those patterns (this does require the Platform SDK)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa379010(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa379010(VS.85).aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And finally for today, I am still working on getting you some sample code for a UMDF HID Collection Filter driver, but life decided it needed some attention last week so I’m a tad behind on that. :)&lt;/p&gt;  &lt;p&gt;And a thank you to one of our developers, Kumar for pointing me to those Session 0 links and tips!&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;Now playing – Transatlantic &lt;em&gt;The Whirlwind&lt;/em&gt;&amp;#160; (yes, I do love my prog rock)&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9988431" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="HID" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/HID/" /></entry><entry><title>How to avoid getting a HID to the head (a guide to making a UMDF - HID collection filter)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/24/9984502.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/24/9984502.aspx</id><published>2010-03-24T17:38:00Z</published><updated>2010-03-24T17:38:00Z</updated><content type="html">&lt;P&gt;First of all, HUGE thanks to Ilia S. for helping to track down this little trap.&amp;nbsp; I’m glad we finally got your driver up and running!&amp;nbsp; Nothing like having an 8 hour time difference to slow things down. :)&lt;/P&gt;
&lt;P&gt;For those of you who like the 30 second version;&lt;/P&gt;
&lt;P&gt;If you need to use &lt;A href="http://msdn.microsoft.com/en-us/library/aa511032.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/aa511032.aspx"&gt;Impersonation&lt;/A&gt; in a UMDF driver, regardless of being a filter or a function driver, you cannot have &lt;A href="http://msdn.microsoft.com/en-us/library/dd183835.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd183835.aspx"&gt;AutoForwardCreateCleanupClose&lt;/A&gt; set to &lt;STRONG&gt;WdfTrue&lt;/STRONG&gt;.&amp;nbsp; For filter drivers this means you must invoke &lt;STRONG&gt;AutoForwardCreateCleanupClose&lt;/STRONG&gt; with &lt;STRONG&gt;WdfFalse&lt;/STRONG&gt; &lt;EM&gt;&lt;U&gt;AFTER&lt;/U&gt;&lt;/EM&gt; you call &lt;A 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; and &lt;EM&gt;&lt;U&gt;BEFORE&lt;/U&gt;&lt;/EM&gt; you call CreateDevice and then follow all the rules for &lt;A href="http://msdn.microsoft.com/en-us/library/aa939053.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/aa939053.aspx"&gt;balancing Create and Close&lt;/A&gt; and handling Impersonation (same link as above for impersonation).&amp;nbsp; Easy enough? :)&lt;/P&gt;
&lt;P&gt;For those of you who like long winded technical posts, I am going to do a write up on how to get a UMDF driver to sit on top of a HID collection.&lt;/P&gt;
&lt;P&gt;And for those of you who like to work ahead and start digging around on your own, you first need to match your INF section for HWID to HID\VID_&amp;lt;&lt;EM&gt;nnnn&lt;/EM&gt;&amp;gt;&amp;amp;PID_&amp;lt;&lt;EM&gt;nnnn&lt;/EM&gt;&amp;gt;&amp;amp;&lt;EM&gt;XX&lt;/EM&gt;_&lt;EM&gt;xx&lt;/EM&gt;&amp;amp;&amp;amp;Col&lt;EM&gt;NN.&amp;nbsp; &lt;/EM&gt;Second install WUDFRd as an upper filter to that HWID.&amp;nbsp; Now, if your collection has &lt;A href="http://msdn.microsoft.com/en-us/library/ms789914.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms789914.aspx"&gt;enforced secure read&lt;/A&gt;, you’re going to need that little tip above.&lt;/P&gt;
&lt;P&gt;I’ll work on getting the first part of the write up done this week and posted by early next week.&amp;nbsp; I need to do a little code work on a sample for you faithful readers. *thumbs up*&lt;/P&gt;
&lt;P&gt;As always, fire off any questions you have!&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Now Playing – Stone Temple Pilots &lt;EM&gt;Trippin’ on a hole in a paper heart&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9984502" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="HID" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/HID/" /></entry><entry><title>It’s time to party!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/02/9971880.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/03/02/9971880.aspx</id><published>2010-03-03T00:20:17Z</published><updated>2010-03-03T00:20:17Z</updated><content type="html">&lt;p&gt;Fresh from the oven, Windows Driver Kit (WDK) 7.1.0 is ready for your consumption!&lt;/p&gt;  &lt;p&gt;You can get it from the Download Center;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/downloads/en/results.aspx?freetext=WDK&amp;amp;displaylang=en&amp;amp;stype=s_basic" href="http://www.microsoft.com/downloads/en/results.aspx?freetext=WDK&amp;amp;displaylang=en&amp;amp;stype=s_basic"&gt;http://www.microsoft.com/downloads/en/results.aspx?freetext=WDK&amp;amp;displaylang=en&amp;amp;stype=s_basic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Or off Microsoft Connect (remember, you have to be signed in to your connect account).&lt;/p&gt;  &lt;p&gt;&lt;a title="https://connect.microsoft.com/site148" href="https://connect.microsoft.com/site148"&gt;https://connect.microsoft.com/site148&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, go forth and code!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9971880" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>It’s a bird, it’s a plane..</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/02/16/9964555.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/02/16/9964555.aspx</id><published>2010-02-16T19:36:24Z</published><updated>2010-02-16T19:36:24Z</updated><content type="html">&lt;p&gt;Just wanted to make sure you all saw this great guest post on Doron’s blog from Jake Oshins.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/doronh/archive/2010/02/02/what-is-irql.aspx" href="http://blogs.msdn.com/doronh/archive/2010/02/02/what-is-irql.aspx"&gt;http://blogs.msdn.com/doronh/archive/2010/02/02/what-is-irql.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s all for today.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9964555" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="Random" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/Random/" /></entry><entry><title>Housekeeping</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/01/21/9951619.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/01/21/9951619.aspx</id><published>2010-01-21T20:39:40Z</published><updated>2010-01-21T20:39:40Z</updated><content type="html">&lt;p&gt;There have been a couple of asks recently, in various forums, on how to build drivers using Visual Studio. I thought since I had shown you how to make &lt;a href="http://blogs.msdn.com/888_umdf_4_you/archive/tags/VisualStudio/default.aspx" target="_blank"&gt;better use of Visual Studio as an IDE for driver writing&lt;/a&gt;, I better share the last yard of how people are integrating the WDK build environment(s) in to Visual Studio.&lt;/p&gt;  &lt;p&gt;For those of you who don’t already know about or already use them, there are two commonly used tools to integrate the WDK build environment in to Visual Studio.&amp;#160; Please note that these are not Microsoft supported solutions by any means and any support questions should be directed towards the tool owners, not me.&amp;#160; I don’t use these tools internally.&amp;#160; I have some other voodoo that I use. :)&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.osronline.com/article.cfm?article=43" href="http://www.osronline.com/article.cfm?article=43"&gt;http://www.osronline.com/article.cfm?article=43&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.hollistech.com/resources.htm" href="http://www.hollistech.com/resources.htm"&gt;http://www.hollistech.com/resources.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Speaking of Visual Studio, I’ve been using VS 2010 for the last few weeks and there is one SWEET addition I have to share with the group (again, some of you probably know about it already) -&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;You can undock source tabs and float them across your desktop(s)! &lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;That makes for a happy Patrick when I can span code modules across my two 24” monitors all from one IDE. *g*&amp;#160; All of that awesomeness goes along with some nice performance increases in the IDE and the pretty new blue UI.&amp;#160; I’m sure there’s some other big ticket stuff the Visual Studio Team is just as jazzed about with 2010 edition. ;)&lt;/p&gt;  &lt;p&gt;But don’t just take my word for it, go give it a spin for yourself;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;Now Playing – Transatlantic &lt;em&gt;My New World&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9951619" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="VisualStudio" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/VisualStudio/" /></entry><entry><title>It’s okay to assert yourself, just be careful how forcefully you do it. (Op. Ed.)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/01/12/9947401.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2010/01/12/9947401.aspx</id><published>2010-01-12T23:39:00Z</published><updated>2010-01-12T23:39:00Z</updated><content type="html">&lt;P&gt;We recently had a good discussion internally about the nature of ASSERTs in code.&amp;nbsp; I, being the rebel that I am, took the time honored stance of, “if you’ve hit it, you’ve triaged it and changed to code to handle that condition gracefully (at least as gracefully as possible), it’s safe to remove that assert.”&amp;nbsp;&amp;nbsp; The other camp had a few different views, but the basis of their retort was, “just because you hit it, doesn’t mean that you’ve covered all scenarios in which that particular condition can be triggered, and removing it lessens the ability to catch those scenarios”.&amp;nbsp; Which is a very valid argument as well, but my problem with that stance starts simply at the entry.&amp;nbsp; The scope of an ASSERT should be as narrow as possible, ASSERTs should not be there to validate that each caller does not trigger that particular condition.&amp;nbsp; If the changes made to handle the condition gracefully cause that calling function to fail, or misbehave in some other fashion, it’s up to them to fix their code.&amp;nbsp; If it happens to be another block of your code, c’est la vie.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I’ve been there, as I’m sure all of you have as well.&amp;nbsp; But my point being, the removal of an ASSERT should only happen if that condition is now handled AND that condition has been; invoked, triaged and&amp;nbsp;understood.&amp;nbsp; And hopefully all of the aforementioned comes from a well defined test case triggering the ASSERT.&amp;nbsp; Here again, the counter-argument provided, “the retention of the ASSERT provides another layer to protect against regressions in the callers as the immediacy of the regression is felt when the ASSERT is triggered.”&amp;nbsp; I would simply contest that by saying, the test is just as immediate of a regression trap, and will also be caught under both FRE and CHK builds.&amp;nbsp; Sure there is a chance that the nature of the test case will change where it will cease to act as a valid regression test, but the onus should be on the owner of the tests to ensure that any changes made does not remove or redefine those test cases.&lt;/P&gt;
&lt;P&gt;Both sides of the debate sound reasonable no matter what your preference for using ASSERTs.&amp;nbsp; And I’d agree with you 50% of the time on either side. :)&lt;/P&gt;
&lt;P&gt;Now, there are two extra data points that may or may not sway you to either side of this discussion and these lend themselves to reaffirming that there is something to break every rule;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The tests triggering these ASSERTs are run as part of an automated test pass and as such, will trigger this ASSERT 100% of the time.&amp;nbsp; Yup, there’s a debug break provided for us every time we run the test under a CHK build environment.&amp;nbsp; That’s kind of contrary to automation. :)&lt;/LI&gt;
&lt;LI&gt;The test triggering this ASSERT is part of a super secret set of tests that actually replaces an inbox binary with a private version in order to provide an additional attack surface to a second target binary.&amp;nbsp; So in this case, the reality is simple – should this ASSERT be triggered “in the wild” it would represent a valid bug in the primary component which is being replaced at test time.&amp;nbsp; And thus we are presented a valid case where by the ASSERT in the underlying target component can provide a safety net against real regression and real bugs in the primary component.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Why am I bringing this all up?&amp;nbsp; Well primarily, I haven’t blogged in a while (*g*).&amp;nbsp; But it was a good go around amongst us and it also opened up some more possibilities for test tools and test cases through this discussion.&amp;nbsp; So even though the two sides of this debate agreed to disagree, the end result is that we’ve identified more areas to improve existing tests and toolsets to allow developers the means to choose what they feel is best for the product and not block test automation in the process.&lt;/P&gt;
&lt;P&gt;See, there is no such thing as a “failed experiment” in science. ;)&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Now Playing – Jonathan Coulton &lt;EM&gt;Skullcrusher Mountain&lt;/EM&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9947401" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="Random" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/Random/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>And here you thought I had a cloaking device</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/12/01/9931159.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/12/01/9931159.aspx</id><published>2009-12-01T23:48:00Z</published><updated>2009-12-01T23:48:00Z</updated><content type="html">&lt;P&gt;Got a good one to share with the group;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: Can I make a kernel mode driver that opens a handle and talks to a UMDF based driver in another device stack?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Why yes you can!&amp;nbsp; Quite simply done provide you &lt;A href="http://msdn.microsoft.com/en-us/library/dd568189.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/dd568189.aspx"&gt;follow all the rules&lt;/A&gt;. This is a variant of the UMDF initiated cross stack communication we talked about a while ago, but KMDF, being a DF (driver framework) supports essentially the same &lt;A href="http://msdn.microsoft.com/en-us/library/aa490265.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/aa490265.aspx"&gt;IoTarget&lt;/A&gt; model that UMDF does.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;Now Playing –&amp;nbsp;Rush &lt;EM&gt;Far Cry&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931159" width="1" height="1"&gt;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>We’re gonna need a bigger stick!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/10/06/9903957.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/10/06/9903957.aspx</id><published>2009-10-06T23:42:17Z</published><updated>2009-10-06T23:42:17Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="Random" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/Random/" /></entry><entry><title>I/O Queues and You</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/08/24/9882882.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/08/24/9882882.aspx</id><published>2009-08-24T21:48:00Z</published><updated>2009-08-24T21:48:00Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>Cross stack communications</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/08/16/9871800.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/08/16/9871800.aspx</id><published>2009-08-16T23:57:00Z</published><updated>2009-08-16T23:57:00Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>House cleaning</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/06/30/9809936.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/06/30/9809936.aspx</id><published>2009-06-30T22:13:49Z</published><updated>2009-06-30T22:13:49Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="KMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/KMDF/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>Intellisense, the Musical part 3</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/06/03/9698411.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/06/03/9698411.aspx</id><published>2009-06-04T08:47:00Z</published><updated>2009-06-04T08:47:00Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="VisualStudio" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/VisualStudio/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry><entry><title>UMDF Debugging talks online</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/05/06/9591944.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/05/06/9591944.aspx</id><published>2009-05-06T23:01:38Z</published><updated>2009-05-06T23:01:38Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>Double filtered for added UMDF flavor.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/04/27/9571980.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/04/27/9571980.aspx</id><published>2009-04-27T20:54:00Z</published><updated>2009-04-27T20:54:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;UPDATED: 9-March-2010 Astute readers noted that I had the incorrect driver load order when talking about the UmdfServiceOrder directive. :)&amp;nbsp; It &lt;EM&gt;&lt;U&gt;IS&lt;/U&gt;&lt;/EM&gt; left to right reading and the&amp;nbsp;&lt;EM&gt;&lt;U&gt;LEFT&lt;/U&gt;&lt;/EM&gt; most driver is the lowest driver.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&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;left 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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /></entry><entry><title>Genuine UMDF filtered drivers</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/04/15/9551857.aspx" /><id>http://blogs.msdn.com/b/888_umdf_4_you/archive/2009/04/15/9551857.aspx</id><published>2009-04-16T03:30:00Z</published><updated>2009-04-16T03:30:00Z</updated><content type="html">&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;</content><author><name>pat.man</name><uri>http://blogs.msdn.com/patman/ProfileUrlRedirect.ashx</uri></author><category term="UMDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/UMDF/" /><category term="WDF" scheme="http://blogs.msdn.com/b/888_umdf_4_you/archive/tags/WDF/" /></entry></feed>