<?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 : KMDF</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/tags/KMDF/default.aspx</link><description>Tags: KMDF</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>And here you thought I had a cloaking device</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2009/12/01/9931159.aspx</link><pubDate>Tue, 01 Dec 2009 23:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931159</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/9931159.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=9931159</wfw:commentRss><description>&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;</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>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>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><item><title>How to find the droids you might be looking for</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2008/09/29/8969553.aspx</link><pubDate>Tue, 30 Sep 2008 01:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8969553</guid><dc:creator>patman</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/8969553.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=8969553</wfw:commentRss><description>&lt;P&gt;Most of you at the DDC will notice that I'm not at the DDC.&amp;nbsp; I'm guessing that makes me one of the "juniors" that &lt;A href="http://blogs.msdn.com/bobkjelgaard/archive/2008/09/29/ddc-starts-in-less-than-an-hour.aspx" target=_blank mce_href="http://blogs.msdn.com/bobkjelgaard/archive/2008/09/29/ddc-starts-in-less-than-an-hour.aspx"&gt;Bob&lt;/A&gt; was referring to. ;)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4.)&amp;nbsp; How do you build debugging techniques into your driver?&amp;nbsp; Ie, DbgBreakPoint, ASSERT, etc - which is best in various situations?&lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This is one of those personal preference type questions.&amp;nbsp; For the sake of lineal chatter, I'll just use ASSERT in my commentary.&amp;nbsp; But when I say "ASSERT" you can make the determination on which one to use given your own working methods.&lt;/P&gt;
&lt;P&gt;So that preamble aside, it's on with the show.&amp;nbsp; I like to have staged text output via a debug trace level as a first tier technique.&amp;nbsp; Something along these lines;&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; FILTERNAME        TEXT(&lt;SPAN class=str&gt;"mydriver"&lt;/SPAN&gt;)
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DRIVERNAME        FILTERNAME TEXT(&lt;SPAN class=str&gt;".sys"&lt;/SPAN&gt;)
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DRIVERNAME_DBGOUT FILTERNAME TEXT(&lt;SPAN class=str&gt;": "&lt;/SPAN&gt;)

&lt;SPAN class=preproc&gt;#if&lt;/SPAN&gt; DBG
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_TRACE_VERBOSE      0
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_TRACE_MINIMAL      1
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_WARNING            2
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_ERROR              3
&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_FATAL              4 

&lt;SPAN class=kwrd&gt;extern&lt;/SPAN&gt; unsigned &lt;SPAN class=kwrd&gt;char&lt;/SPAN&gt; DebugLevel;

&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_PRINT( l, _x_ )                   \
    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt;( (l) &amp;gt;= DebugLevel )      \
    {                                         \
      KdPrint((DRIVERNAME_DBGOUT));         \
      KdPrint( _x_ );                       \
    }
&lt;SPAN class=preproc&gt;#else&lt;/SPAN&gt;  &lt;SPAN class=rem&gt;// DBG&lt;/SPAN&gt;

&lt;SPAN class=preproc&gt;#define&lt;/SPAN&gt; DBG_PRINT( l,_x_ )&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size=1&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;That allows me to compartmentalize failures and thusly allows me to build handlers for each.&amp;nbsp; The question of what to do in each of those situations is another personal preference. As you can see from the error levels above, I follow patterns of building in handlers that fall in to - &lt;EM&gt;terminal&lt;/EM&gt;, &lt;EM&gt;really annoying&lt;/EM&gt;, &lt;EM&gt;nuisance&lt;/EM&gt;, &lt;EM&gt;does it work&lt;/EM&gt; and &lt;EM&gt;assuage&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;I'll ASSERT more frequently for the nuisance issues, but also for the terminal, and some of the really annoying issues.&amp;nbsp; Nuisance issues such as that HANDLE disappeared while I was using it, better ASSERT. This is usually when I find that the other thread using that handle wasn't synch'd properly...laugh all you want, you've done it too. :)&lt;/P&gt;
&lt;P&gt;Using those levels as a guide, I craft an appropriate follow up action.&amp;nbsp; But here I let the driver tell me what to do and it does that based on its end usage.&amp;nbsp; For example;&lt;/P&gt;&lt;PRE class=csharpcode&gt;  Status = IoCreateDevice (
      DriverObject, 
      &lt;SPAN class=kwrd&gt;sizeof&lt;/SPAN&gt; (DEVICE_EXTENSION), 
      &amp;amp;DriverName,
      FILE_DEVICE_UNKNOWN, 
      DeviceType, 
      FALSE, 
      &amp;amp;DeviceObject);
  &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (!NT_SUCCESS (Status)) 
  {
    DBG_PRINT (DBG_FATAL, TEXT((&lt;SPAN class=str&gt;"Failed IoCreateDevice: 0x%x\n"&lt;/SPAN&gt;, Status)));
    ASSERT (DeviceObject);
    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; Status;
  }&lt;/PRE&gt;
&lt;P&gt;Would I use that ASSERT in a test driver?&amp;nbsp; Not likely, all too often our test cases attempt to invoke failures in just those sort of areas and we run chk (debug, no_opt, etc.) builds in our labs frequently. So that ASSERT would be triggered constantly.&amp;nbsp; You could also argue that in a shipping driver you would hit it in a lab under low resource simulation testing, but unless you plan on running low resource simulation 24/7, the nuisance factor is diminished greatly.&amp;nbsp; But having the debug print there is a means for you to see if something happened in a retail / fre build of the driver.&amp;nbsp; You can also wrap Windows logging methods with the same mentality such as &lt;A href="http://msdn.microsoft.com/en-us/library/ms793164.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms793164.aspx"&gt;WPP&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/magazine/cc163437.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/magazine/cc163437.aspx"&gt;ETW&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;All of the above starts with the driver though.&amp;nbsp; The more complex the driver, the more robust the debugging logic, so some of my internal test drivers have one or two ASSERT calls and maybe a couple of lines of debug print statements.&amp;nbsp; So if you peek at the 1394vdev hybrid sample you can get a better idea of my patterning.&amp;nbsp; The lack of ASSERT calls was a design choice based on the pattern established by the previous versions of that sample driver.&lt;/P&gt;
&lt;P&gt;So for those of you at the DDC, enjoy the DDC!&amp;nbsp; If you feel like making Peter laugh, ask him why I'm such a dork.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;*Currently playing - &lt;EM&gt;Gravity Eyelids &lt;/EM&gt;Porcupine Tree&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8969553" 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>It's flick, then swish</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2008/09/11/8945381.aspx</link><pubDate>Thu, 11 Sep 2008 23:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8945381</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/8945381.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=8945381</wfw:commentRss><description>&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;So the next part of the little Q&amp;amp;A series on...well, QA;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3.) What security considerations do you take into account when designing and developing a kernel mode driver? &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Validate user mode pointers and check the buffers to and from user mode. ;)&lt;/P&gt;
&lt;P&gt;That was a little inside joke for the person who asked the question.&amp;nbsp; Seriously security and kernel mode are almost at odds with one another when you really think about it.&amp;nbsp; Kernel mode is implied to be a trustworthy environment so anybody that's down there with you is expected to behave like a good citizen.&amp;nbsp; And anybody that can talk to you from the nether region (user mode) should be treated as an enemy.&amp;nbsp; As security for kernel mode drivers is something of a loaded question in the end, the best advice I can offer here is; Anything that can be accessed by anybody outside your driver should have some form of defense built in to it.&amp;nbsp; I.e. if you have an external callback, think about how that that could be used as an attack entry point.&amp;nbsp; Could somebody float recursive calls to that callback and cause a stack over flow?&lt;/P&gt;
&lt;P&gt;That's about the only weird tip I can give other than using what's published &lt;A href="http://msdn.microsoft.com/en-us/library/ms791667.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms791667.aspx"&gt;here&lt;/A&gt; and &lt;A href="http://www.microsoft.com/mspress/books/5957.aspx" target=_blank mce_href="http://www.microsoft.com/mspress/books/5957.aspx"&gt;here&lt;/A&gt; as a base.&lt;/P&gt;
&lt;P&gt;And finally, my apologize to Bob, &lt;A href="http://blogs.msdn.com/bobkjelgaard/archive/2008/09/10/looking-ahead-conferences.aspx" target=_blank mce_href="http://blogs.msdn.com/bobkjelgaard/archive/2008/09/10/looking-ahead-conferences.aspx"&gt;I guess I stole some of his thunder&lt;/A&gt;. :)&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;*Currently playing - Rush &lt;EM&gt;Faithless&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8945381" 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/Random/default.aspx">Random</category></item><item><title>It's all in the wrists</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2008/09/03/8922376.aspx</link><pubDate>Wed, 03 Sep 2008 20:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8922376</guid><dc:creator>patman</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/8922376.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=8922376</wfw:commentRss><description>&lt;P&gt;I got a few interesting questions recently, which was helpful because I was having a tough time finding good material for you guys and gals of late.&amp;nbsp; That's the problem with working on the next Operating System, I can't tell you about all the cool stuff yet. *g*&lt;/P&gt;
&lt;P&gt;So here's today's question (in two parts);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.) Do you use a single system to code, compile, verify and test a kernel driver?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Nope, pretty much, kinda sorta and nope.&amp;nbsp; We're actually pretty wide open as far as coding environments around here.&amp;nbsp; Across this team alone you'll find Visual Studio, gVIM, Slick Edit and probably 2 or 3 other IDEs in use (I've actually even seen notepad used once).&amp;nbsp; The only coding requirements are really based around formatting, naming convention(s) and the like.&amp;nbsp; Which is really fun when you get somebody who crafts a build script that goes out and checks for tabs rather than spaces in source code. ;)&lt;/P&gt;
&lt;P&gt;Our compiler is a different story, pretty much everything we build is done so in very much the same environment shipped in the WDK.&amp;nbsp; Yes there are some caveats, but that's only because I can't speak for every team and some of our internal process isn't really meant for general consumption.&amp;nbsp; But our compiler is linked to our source control environment which makes wrapping a full one stop shopping coding / compiling / source control environment more of a challenge.&amp;nbsp; There are a lot of great tools internally to get most of it done depending on your IDE of choice.&amp;nbsp; Personally (if you haven't figured it out yet), I use Visual Studio as my source editor, a couple of internal tools to manage source control from within Visual Studio and then build in that external razzle environment.&amp;nbsp; Like I said before, I'm still not prone to giving up some of my past. :)&lt;/P&gt;
&lt;P&gt;Verification is another tricky question (somewhat open ended really).&amp;nbsp; If we're talking about compile time code verification, then yes we do have a somewhat unified system in place.&amp;nbsp; We use the same tools we ship in the WDK, &lt;A href="http://www.microsoft.com/whdc/DevTools/tools/default.mspx" target=_blank mce_href="http://www.microsoft.com/whdc/DevTools/tools/default.mspx"&gt;PREfast and Static Driver Verifier&lt;/A&gt;.&amp;nbsp; Our internal build system actually runs PREfast for us as a post build process.&lt;/P&gt;
&lt;P&gt;Finally our testing is a real Pandora's Box type question.&amp;nbsp; We do use the same tools we ship externally, Application Verifier, Driver Verifier and WDF Verifier, but we also develop other tools internally to cover scenarios we just can't reach using those tools.&amp;nbsp; Here again, it's not a one stop shopping system across the Windows teams, but for those of you going to the DDC, Bob, Shyamal and Wei will be giving a shared secrets talk which will cover some more of what we do internally.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.) How do you use virtualization software in the test and dev process?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This is my favorite one, I've been on a big push around here to get more people using virtual environments. Personally I've been using Virtual PC since 2005, I did some test work for them on that release, so I got in on the ground floor somewhat.&amp;nbsp; Anyway, I use VMs to extend test coverage primarily on down level OSes.&amp;nbsp; I keep "clean" installations of Windows XP SP1, SP2, SP3, Server 2003, Vista and Vista SP1 and some variants of those on my system.&amp;nbsp; A lot more people are starting to use HyperV and Virtual PC around here, but given some of the limitations of those environments (e.g. inability to map USB hardware) and other little nuisances we can't use them for a full end to end test beds, this is a little more intrusive on the kernel side where you may require a piece of hardware.&amp;nbsp; I know there are other virtual environments out there that do allow these features, but we're kind of prone to using our own products. :)&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;*Currently playing - King's X&lt;EM&gt; Alone&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8922376" 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/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>Blue Moon, you saw me standing alone.....</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2008/04/04/8357821.aspx</link><pubDate>Fri, 04 Apr 2008 21:28:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8357821</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/8357821.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=8357821</wfw:commentRss><description>&lt;p&gt;I love sharing simple mistakes for some reason.&amp;nbsp; I think it's because we're all prone to searching for how to do something simple, like handle METHOD_NEITHER requests in our KMDF driver, and only read the documentation on how to initialize that ability,&amp;nbsp;but not remembering all the little rules&amp;nbsp;that govern the surrounding&amp;nbsp;APIs.&amp;nbsp; Oft leaving us with a series of bug checks,&amp;nbsp;driver load failures&amp;nbsp;or head scratching "huh" scenarios.&lt;/p&gt; &lt;p&gt;This not so good - &lt;/p&gt;&lt;pre class="csharpcode"&gt;    status = WdfDeviceCreate(&amp;amp;DeviceInit, &amp;amp;deviceAttributes, &amp;amp;device);
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!NT_SUCCESS(status)) 
    {
        KdPrint( (&lt;span class="str"&gt;"WdfDeviceCreate failed with status code 0x%x\n"&lt;/span&gt;, status));
        &lt;span class="kwrd"&gt;return&lt;/span&gt; status;
    }
    &amp;lt;...some other code went here...&amp;gt;
    WdfDeviceInitSetIoInCallerContextCallback (
        DeviceInit,
        SomeEvtInContextCallBack);
&lt;/pre&gt;
&lt;p&gt;This&amp;nbsp;good -&amp;nbsp;&lt;/p&gt;&lt;pre class="csharpcode"&gt;    WdfDeviceInitSetIoInCallerContextCallback (
        DeviceInit,
        SomeEvtInContextCallBack);

    status = WdfDeviceCreate(&amp;amp;DeviceInit, &amp;amp;deviceAttributes, &amp;amp;device);
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!NT_SUCCESS(status)) 
    {
        KdPrint( (&lt;span class="str"&gt;"WdfDeviceCreate failed with status code 0x%x\n"&lt;/span&gt;, status));
        &lt;span class="kwrd"&gt;return&lt;/span&gt; status;
    }&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See, at some point in history, I had paged out of my grey matter memory module&amp;nbsp;that tidbit in the MSDN documentation for &lt;a href="http://msdn2.microsoft.com/en-us/library/aa491109.aspx" target="_blank"&gt;WdfDeviceCreate&lt;/a&gt;&amp;nbsp;which says; &lt;em&gt;After the driver calls &lt;b&gt;WdfDeviceCreate&lt;/b&gt;, it can no longer access the WDFDEVICE_INIT structure.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Boy oh boy you sure can't access it afterwards, that bad boy is a glorious, awe inspiring, blue screening NULL after WdfDeviceCreate is through!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8357821" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/KMDF/default.aspx">KMDF</category></item><item><title>How to jiggle the handle(s) and get your 1.7 to work in Vista</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2008/03/05/8054677.aspx</link><pubDate>Wed, 05 Mar 2008 23:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8054677</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/8054677.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=8054677</wfw:commentRss><description>&lt;P&gt;As people who write drivers are something of a rare breed, I know we probably share a lot of common readers between our Driver blogs and via the OSR boards, but just in case the three or four of you who read my blog haven't seen this, I wanted to make sure it got out there.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/bobkjelgaard/archive/2008/03/04/why-doesn-t-my-kmdf-1-7-driver-install-on-windows-vista.aspx" target=_blank mce_href="http://blogs.msdn.com/bobkjelgaard/archive/2008/03/04/why-doesn-t-my-kmdf-1-7-driver-install-on-windows-vista.aspx"&gt;We had a bit of a stumble with the 1.7 coinstaller package that went out with the WDK recently.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;We're pretty close to being done with a fix as Bob said, so fret not.&amp;nbsp; I'd like to thank those who pestered me about the issue for helping narrow it down, and also those who pestered the external boards and email alias.&lt;/P&gt;
&lt;P&gt;Now, if we could all join hands around the camp fire and sing "row, row, row your boat" to complete this little moment of community unity.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Still working on the Visual Studio stuff, but those of you with free time are more than welcome &lt;A href="http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.vcclcompilertool.additionalincludedirectories.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.vcclcompilertool.additionalincludedirectories.aspx"&gt;to skip ahead&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;&lt;FONT size=1&gt;*Currently&amp;nbsp;playing - Not a single thing...&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8054677" 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/VisualStudio/default.aspx">VisualStudio</category></item><item><title>d'OH-nuts</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/12/10/6726959.aspx</link><pubDate>Mon, 10 Dec 2007 23:21:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6726959</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/6726959.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=6726959</wfw:commentRss><description>&lt;p&gt;As promised here is the correction to the hybrid INF file you'll need to make.&lt;/p&gt; &lt;p&gt;[SourceDisksFiles]&lt;br&gt;kmdf1394vdev.sys=1&lt;br&gt;umdf1394vdev.dll=1&lt;br&gt;WudfUpdate_01007.dll=1&lt;br&gt;&lt;strike&gt;WdfCoInstaller01005.dll=1&lt;/strike&gt; &lt;strong&gt;&lt;font color="#ff0000"&gt;WdfCoInstaller01007.dll=1&lt;/font&gt;&lt;/strong&gt; &lt;p&gt;....&lt;/p&gt; &lt;p&gt;[CoInstaller_CopyFiles]&lt;br&gt;&lt;strike&gt;wdfcoinstaller01007.dll&lt;/strike&gt; &lt;strong&gt;&lt;font color="#ff0000"&gt;wdfcoinstaller01007.dll&lt;/font&gt;&lt;/strong&gt;&lt;br&gt;WudfUpdate_01007.dll &lt;p&gt;... &lt;p&gt;[CoInstaller_AddReg]&lt;br&gt;HKR,,CoInstallers32,0x00010000,"&lt;strike&gt;wdfcoinstaller01005.dll&lt;/strike&gt;,WdfCoInstaller","WUDFUpdate_01007.dll" &lt;strong&gt;&lt;font color="#ff0000"&gt;wdfcoinstaller01007.dll&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;...&lt;/p&gt; &lt;p&gt;[KMDF1394VDEV_wdfsect]&lt;br&gt;KmdfLibraryVersion = &lt;strike&gt;1.5 &lt;/strike&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;1.7&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;&lt;/font&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Apologies for letting that get out in the wild. :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6726959" 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></item><item><title>it's full of stars....</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/09/20/5021200.aspx</link><pubDate>Fri, 21 Sep 2007 02:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5021200</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/5021200.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=5021200</wfw:commentRss><description>&lt;P&gt;First thing is first, NHL '08 is miserable on Superstar mode.&amp;nbsp; You actually have to play hockey defense.&amp;nbsp; Not just jump up and slam somebody in to the boards.&amp;nbsp; And whatever you do, don't make any mistakes passing in your defensive zone.&amp;nbsp; 99.99999999% of them end up in the back of your net.&lt;/P&gt;
&lt;P&gt;Second thing would be, well, second.&amp;nbsp; Astronomy is brutal to your pocket book.&amp;nbsp; I recently acquired a Meade® 8" LX200®R telescope and after talking to a few friends who are further down that slippery slope, it's become apparent that I may need to sell almost everything else to continue this habit.&amp;nbsp; And here I thought photography was bad.&amp;nbsp; Try Astrophotography, which I think is an acronym for&amp;nbsp;Astronomically expensive Photography, it was very cool seeing some of the&amp;nbsp;larger bands on Jupiter and the 4 primary Moons on that first night, but I'm not sure I'm ready to give up my house, yet.&lt;/P&gt;
&lt;P&gt;On with our normal show.&lt;/P&gt;
&lt;P&gt;I wanted to&amp;nbsp;answer part of&amp;nbsp;a question that has been thrown around by a few people; &lt;EM&gt;Why can't you do&amp;nbsp;the 1394 virtual device or&amp;nbsp;a 1394 function&amp;nbsp;driver as a full UMDF driver?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Well the biggy right now is really the 1394 I/O Request Block (&lt;A href="http://msdn2.microsoft.com/en-us/library/ms789496.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms789496.aspx"&gt;IRB&lt;/A&gt;)&amp;nbsp;prevents us from doing so.&amp;nbsp; Since the individual 1394 Bus I/O requests are tied in the union within the IRB, we are bound to use that structure.&amp;nbsp; Not such a big deal for UMDF drivers really,&amp;nbsp;until you dig&amp;nbsp;deeper&amp;nbsp;in to&amp;nbsp;the nested elements of the specific requests.&amp;nbsp; Let's take &lt;A href="http://msdn2.microsoft.com/en-us/library/ms789453.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms789453.aspx"&gt;REQUEST_ALLOCATE_ADDRESS_RANGE&lt;/A&gt;.&amp;nbsp; That first element in the structure is gonna kill any hope for UMDF right now.&amp;nbsp; MDLs.&amp;nbsp; It is&amp;nbsp;something we plan on addressing, but for right now, we're kind of at an impasse for using IRBs.&lt;/P&gt;
&lt;P&gt;So what you'll see in the sample (and in the current 1394 vdev samples as well) are those I/O request structures replicated&amp;nbsp;with&amp;nbsp;33% more&amp;nbsp;User Mode&amp;nbsp;compliant objects at no additional cost to you!&lt;/P&gt;
&lt;P&gt;The same is sort of true for&amp;nbsp;USB which uses nested elements within an&amp;nbsp;URB.&lt;/P&gt;
&lt;P&gt;Now&amp;nbsp;isn't this fun? IRB, URB, IRP, MDL.&amp;nbsp; I'm sure &lt;A href="http://blogs.msdn.com/peterwie/archive/2007/09/20/where-is-peter.aspx" mce_href="http://blogs.msdn.com/peterwie/archive/2007/09/20/where-is-peter.aspx"&gt;Peter&lt;/A&gt; has been hearing some of terms these from his newborn, but probably just before a giggle or a burp happens. ;)&lt;/P&gt;
&lt;P&gt;And in closing,&amp;nbsp;your "ha-ha" moment to live by today.&amp;nbsp; Apparently &lt;A href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/08/08/4297434.aspx" mce_href="http://blogs.msdn.com/888_umdf_4_you/archive/2007/08/08/4297434.aspx"&gt;comments&lt;/A&gt; have formed an alliance w/ the ASCII character "Space".&amp;nbsp; A simple script copied a file to a location in a post build operation.&amp;nbsp; Except it prepended the file name with a space.&amp;nbsp; The post-post build script kept generating errors which caused much consternation in my office, yet again.&amp;nbsp; LUCKILY being a devoted command window user, when I attempted to open the file in notepad with the quick insert command, I noticed the file name was in quotes with that leading space.&lt;/P&gt;
&lt;P&gt;It's now a full two pronged attack against me from&amp;nbsp;comments and the Space key.&amp;nbsp; If they manage to&amp;nbsp;ally themselves with&amp;nbsp;the semi-colon, our world may be at risk.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5021200" 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/Random/default.aspx">Random</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Astronomy/default.aspx">Astronomy</category></item><item><title>That boy's not right in the head</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/09/11/4868870.aspx</link><pubDate>Tue, 11 Sep 2007 22:18:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4868870</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/4868870.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=4868870</wfw:commentRss><description>&lt;p&gt;Holy jumpin'!&amp;nbsp; Some of you might be thinking, &lt;em&gt;"Another blog post this month?" &lt;/em&gt;Yessir, I've got another one, and yes,&amp;nbsp;it's another rambler.&amp;nbsp; &lt;/p&gt; &lt;p&gt;See I was pondering last night while watching &lt;a href="http://www.history.com/shows.do?episodeId=242353&amp;amp;action=detail" target="_blank"&gt;The Universe: Beyond the Big Bang&lt;/a&gt;&amp;nbsp;on my&amp;nbsp;DVR and much like last week, I had something of an epiphany.&amp;nbsp; I started this blog with the intent of publishing entries about the&amp;nbsp;gotchas, snake pits and falling rocks of a WDF newbie writing a WDF hybrid sample driver for the &lt;em&gt;Windows Driver Kit.&amp;nbsp; &lt;/em&gt;&lt;/p&gt; &lt;p&gt;I guess I had expected there to be a few more of these along the way, and thankfully, or sadly depending on how you look at it,&amp;nbsp;I really didn't find &lt;em&gt;that &lt;/em&gt;many which were not my own fault (curse you and your fuzzy green code, commenting!).&amp;nbsp;&amp;nbsp;So in&amp;nbsp;something of a pre-post mortem, I&amp;nbsp;wanted to determine why that might&amp;nbsp;be; Some of it is down to the driver not exploring the&amp;nbsp;really dark recesses of the Frameworks space as yet, and some of it is down to the Frameworks being really easy to use in the context I was using them in.&lt;/p&gt; &lt;p&gt;In the end, I kind of feel bad that to this point that my blog wasn't filled more with entries detailing those little bumps and bruises we all experience while programming something beyond "Hello World".&amp;nbsp; But in a weird&amp;nbsp;way, it&amp;nbsp;also makes me happy there wasn't more I had to write.&amp;nbsp;&amp;nbsp; And as some of you have determined by now, yes, I am crazy in that manner.&amp;nbsp; So let's think of this little blog as something of a Voyager (or &lt;a href="http://en.wikipedia.org/wiki/V'ger" target="_blank"&gt;V'ger&lt;/a&gt; if you're so inclined.&amp;nbsp; Sorry, is my geek showing through these glasses?).&lt;/p&gt; &lt;p&gt;So going forward, I'll be taking those questions you all toss at me and sharing&amp;nbsp;the answers with the group, and sharing those tidbits of deeper WDF exploration as we all dive further in to what the WDF really is capable of providing.&amp;nbsp; There will be no shortage of driver "stuff" for me to blog on going forward, that's for sure.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Maybe we can also&amp;nbsp;pool our resources and&amp;nbsp;send&amp;nbsp;&lt;a href="http://blogs.msdn.com/bobkjelgaard/default.aspx" target="_blank"&gt;Bob&lt;/a&gt;&amp;nbsp;some real out there issues to debug, or pester &lt;a href="http://blogs.msdn.com/doronh/default.aspx" target="_blank"&gt;Doron&lt;/a&gt;&amp;nbsp;with more "why did you do this like this" questions.&amp;nbsp; Because as soon as NHL '08 is released, I'm sure you'll not hear from me for a week or two. :)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;UPDATE:&amp;nbsp; I'd like to say a "So long and thanks for all the&amp;nbsp;Bulk, Isoch and Interrupt"&amp;nbsp;as the computing world&amp;nbsp;lost a great engineer recently, &lt;a href="http://www.oregonlive.com/obituaries/argus/index.ssf?/base/obituaries/1189183928320810.xml&amp;amp;coll=6"&gt;Brad Hosler&lt;/a&gt;.&amp;nbsp; &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;For those of of you who don't know, Brad was a driving force in the creation of USB 1.0, the original&amp;nbsp;USB Logo Compliance program, as well as a founding&amp;nbsp;father of USB 2.0 and Wireless USB.&amp;nbsp; He was also a part of the team that defined PCI and served as Chair of the PCI-SIG Serial Working Group.&amp;nbsp; He&amp;nbsp;was very much a key figure in enabling such rapid and stable&amp;nbsp;adoption of USB across the industry and his talks at USB events&amp;nbsp;were always fun. :)&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4868870" 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/Random/default.aspx">Random</category></item><item><title>When comments attack</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/08/08/4297434.aspx</link><pubDate>Wed, 08 Aug 2007 23:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4297434</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/4297434.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=4297434</wfw:commentRss><description>&lt;P&gt;First, let's&amp;nbsp;say hello to &lt;A href="http://blogs.msdn.com/bobkjelgaard/" mce_href="http://blogs.msdn.com/bobkjelgaard/"&gt;BOB!&lt;/A&gt;&amp;nbsp; Bob's from the KMDF side of the fence, but I still have to yell at him to get off my lawn from time to time.&amp;nbsp; *shakes fist*&lt;/P&gt;
&lt;P&gt;Secondly, another 'ha-ha' moment for you live by;&amp;nbsp; I've been testing the hybrid driver as individual elements, just to get some error path coverage because I'm weird like that.&amp;nbsp; That means I was installing the KMDF driver on its own and running unit tests against it, then I was installing the UMDF driver on its own and running unit test against that.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;To do that I had commented out some device initialization&amp;nbsp;elements in the UMDF object.&amp;nbsp; Primarily the SetFilter(); property.&amp;nbsp; Not setting that property tells the framework to handle a CreateFile(); request with out sending it down to any subsequent kernel driver...not so good when your KMDF object&amp;nbsp;is a function driver.&lt;/P&gt;
&lt;P&gt;This caused a little consternation on my part when I put the two drivers together for the last rounds of testing.&amp;nbsp; All my request&amp;nbsp;submission from the UMDF driver were being bounced back by the framework with an "invalid handle" error message.&amp;nbsp; I spent a fair bit of time digging for answers on this problem; some fun debugging, some &lt;EM&gt;R&lt;/EM&gt; rated tirades and such, only to have somebody point out the obvious in the end.&amp;nbsp; "Did you set the SetFilter(); property?"&lt;/P&gt;
&lt;P&gt;So be wary, they may seem like timid, friedly little lines of green code, but comments&amp;nbsp;can also be&amp;nbsp;silent killers...(cue -&amp;nbsp;Theme to Jaws).&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;*edit because I just realized I used the same joke twice! *&lt;EM&gt;hangs head in shame*&lt;/EM&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4297434" 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></item><item><title>An inf in the hand is worth two in the bush.</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/03/28/1978871.aspx</link><pubDate>Wed, 28 Mar 2007 19:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1978871</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/1978871.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=1978871</wfw:commentRss><description>&lt;P&gt;A laurel and hearty hello to all of you (2 points if you get the reference).&lt;/P&gt;
&lt;P&gt;Before I start on the meat of the post,&amp;nbsp;I want to cover something that came up in conversation recently in regards to creating hybrid driver stacks using UMDF;&amp;nbsp; Your kernel mode object does not&amp;nbsp;have to be KMDF.&amp;nbsp; You can use an existing WDM driver just as easily with out any modifications to the driver.&lt;/P&gt;
&lt;P&gt;Now, on w/ the show, I wanted to cover some really geeky code stuff in this post, but it's not quite ready for prime time so you'll have to suffer with a post about inf files.&lt;/P&gt;
&lt;P&gt;The first hurdle to really cover in&amp;nbsp;getting this&amp;nbsp;sample driver off the ground is figuring out what&amp;nbsp;goes where in&amp;nbsp;our good friend, the INF file.&amp;nbsp;&amp;nbsp;For the 1394 virtual device hybrid driver, I'm going to install the kmdf stub, then attach the umdf stub as an upper filter to that "device".&amp;nbsp;&amp;nbsp;I am breaking the inf file included w/ the sample in to&amp;nbsp;sections to hopefully make it easier to read.&amp;nbsp; And in doing so it should show better&amp;nbsp;where all the installation magic happens.&amp;nbsp; So&amp;nbsp;the first&amp;nbsp;thing to&amp;nbsp;do is the normal stuff for installing the &lt;EM&gt;kmdf1394vdev.sys&lt;/EM&gt; file, your standard inf will serve as a basis.&amp;nbsp; We just need to&amp;nbsp;set Redirector / Reflector / Redefelctor&amp;nbsp;object as an upper filter to that device (yes, I fully expect somebody to talk to me&amp;nbsp;about the&amp;nbsp;additional&amp;nbsp;name *g*).&lt;/P&gt;
&lt;P&gt;We'll add the necessary registry and service entries to the non-WDF installation section, so I'm only going&amp;nbsp;to highlight the additions / changes to a normal inf&amp;nbsp;and I'll be using the model of the UMDF being an upper filter driver;&lt;/P&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;[kmdfvdev.NT.HW]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;AddReg=kmdfvdev_AddReg&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;[kmdfvdev.NT.Services]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;AddSerivce=umdfvdev, ,umdfvdev_ServiceInstall&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;[kmdfvdev_AddReg]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;; Load the UMDF Redirector as our upper filter&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;HKR,,"UpperFilters",0x00010008, "WUDFRd"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;[umdfvdev_ServiceInstall]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;;Make sure to create a unique display name for the redirector service&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;DisplayName = %WUDFRd_SvcDesc%&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;ServiceType = 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;StartType = 3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;ErrorControl = 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face="Courier New"&gt;ServiceBinary = %12%\WUDFRd.sys&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Pretty straight forward so far, next are the&amp;nbsp;additions for the WDF installer section;&lt;/P&gt;&lt;FONT face="Courier New"&gt;
&lt;DIV&gt;
&lt;P mce_keep="true"&gt;[kmdfvdev.NT.Wdf]&lt;/P&gt;
&lt;P mce_keep="true"&gt;UmdfService=umdfvdev,umdfvdev_Install&lt;/P&gt;
&lt;P mce_keep="true"&gt;UmdfServiceOrder=umdfvdev&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;[umdfvdev_Install]&lt;/P&gt;
&lt;P mce_keep="true"&gt;UmdfLibraryVersion=$UMDFVERSION$&lt;/P&gt;
&lt;P mce_keep="true"&gt;DriverCLSID= ;generate a class GUID&lt;/P&gt;
&lt;P mce_keep="true"&gt;ServiceBinary=%12%\UMDF\umdfvdev.dll&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;*Currently Playing&amp;nbsp;- Spock's Beard &lt;EM&gt;As Far as the Mind Can See: Pt. 3 They Know We Know&lt;/EM&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1978871" 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/Spock_2700_s+Beard/default.aspx">Spock's Beard</category></item><item><title>And the winner is...</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2006/11/10/1054857.aspx</link><pubDate>Fri, 10 Nov 2006 20:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1054857</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/1054857.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=1054857</wfw:commentRss><description>&lt;P&gt;Well fellow travellers, it looks as though I'm going to port the wonderful 1394 Virtual Device Driver (1394vdev.sys) in to a hybrid driver.&amp;nbsp; I was pushing for this as the project for a number of reasons.&amp;nbsp; I'm familiar w/ it having supported it while working for the 1394 team.&amp;nbsp; It's been in the WDK / DDK / LDK&amp;nbsp;in WDM form, it was migrated to a KMDF driver recently and I think it would be a great show of progression to finish that link of WDF usage.&lt;/P&gt;
&lt;P&gt;I'm opening the comment flood gates to a degree so any question you have fire them off!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1054857" 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></item><item><title>Synchratic Method (yes, I know it's not a word).</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2006/11/06/1004439.aspx</link><pubDate>Mon, 06 Nov 2006 23:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1004439</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/1004439.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=1004439</wfw:commentRss><description>&lt;P&gt;As promised here is an update.&amp;nbsp; I'm still trying to nail down a sample hybrid driver for you all to play with. We've narrowed the contestants to two, and after the talent and judges interview&amp;nbsp;portions of the show&amp;nbsp;we should have a winner.&lt;/P&gt;So rather than let a blog post go to waste by prattling on about my dog or my signed copies of &lt;A href="http://www.generationxwing.members.winisp.net/images/IMG_0573_SM.jpg" target=_blank mce_href="http://www.generationxwing.members.winisp.net/images/IMG_0573_SM.jpg"&gt;&lt;EM&gt;Parallel Worlds and Hyperspace&lt;/EM&gt;&lt;/A&gt;, I thought&amp;nbsp;it&amp;nbsp;would be best served to share a&amp;nbsp;"&lt;EM&gt;well, fancy that"&lt;/EM&gt; moment&amp;nbsp;I discovered while creating a KMDF test driver. 
&lt;P&gt;&lt;STRONG&gt;Synchronization scope in KMDF, the key word...scope.&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;See what I did (and we learn best by laughing at other's mistakes) is to set my &lt;FONT face="courier new"&gt;WDF_OBJECT_ATTRIBUTES&lt;/FONT&gt; for the device object with the synchronization scope level of &lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfSynchronizationScopeDevice&lt;/STRONG&gt;&lt;/FONT&gt;.&amp;nbsp; I had also initialized the &lt;FONT face="courier new"&gt;&lt;STRONG&gt;ExecutionLevel&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; to&amp;nbsp;&lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfExecutionLevelPassive&lt;/STRONG&gt;&lt;/FONT&gt; thinking it would establish the execution of the object's event callback functions to passive.&amp;nbsp; I then intended to establish the &lt;FONT face="courier new"&gt;WDF_OBJECT_ATTRIBUTES&lt;/FONT&gt; for my queue object with the scope level of&amp;nbsp;&lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfSynchronizationScopeNone&lt;/STRONG&gt;&lt;/FONT&gt; to ensure that I had better control over the IRQ levels in my callbacks.&amp;nbsp; Sounded like a great plan to me!&lt;/P&gt;
&lt;P&gt;A few BSODs later, I found out it doesn't quite work as I thought it would.&amp;nbsp; When using the &lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfSynchronizationScopeDevice &lt;/STRONG&gt;&lt;/FONT&gt;as&amp;nbsp;the scope level on the device object, even if I attempted to specify my queue object at the &lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfSynchronizationScopeNone&lt;/STRONG&gt;&lt;STRONG&gt;, &lt;/STRONG&gt;&lt;/FONT&gt;the queue was inheriting the device object's synchronization scope.&amp;nbsp;&amp;nbsp; So everything in my queue&amp;nbsp;was running at&amp;nbsp;&lt;FONT face="courier new"&gt;DISPATCH_LEVEL.&amp;nbsp; &lt;/FONT&gt;And we all have probably found out at one time or another, some things in the kernel&amp;nbsp;world don't like being called a &lt;FONT face="courier new"&gt;DISPATCH_LEVEL&lt;/FONT&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;So after some debugging, and then running around talking to&amp;nbsp;some KMDF guys, I found the cure to my woes was to establish my device object scope level attributes to &lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfSynchronizationScopeNone. &lt;/STRONG&gt;&lt;/FONT&gt;I'm still also setting the execution level&amp;nbsp;in the device object attributes&amp;nbsp;to &lt;FONT face="courier new"&gt;&lt;STRONG&gt;WdfExecutionLevelPassive, &lt;/STRONG&gt;&lt;/FONT&gt;but I'm not establishing any scope on the queue object at creation,&amp;nbsp;so I'm letting the natural order of synchronization objects within the&amp;nbsp;callbacks manage the IRQ levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thus ends my, "Why in the name of Jacques Lemaire is this thing&amp;nbsp;always coming in&amp;nbsp;at &lt;FONT face="Courier New"&gt;DISPATCH_LEVEL&lt;/FONT&gt;!?" adventure for the week.&amp;nbsp; If you want some more info on this, go bug &lt;A href="http://blogs.msdn.com/doronh/"&gt;Doron&lt;/A&gt;.&amp;nbsp; He loves when you pester him about this,&amp;nbsp;really he does. &amp;gt;:)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1004439" 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/Michio+Kaku/default.aspx">Michio Kaku</category></item></channel></rss>