<?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 : Halo</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/tags/Halo/default.aspx</link><description>Tags: Halo</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>of queues, cues and q-s</title><link>http://blogs.msdn.com/888_umdf_4_you/archive/2007/09/26/5154139.aspx</link><pubDate>Thu, 27 Sep 2007 01:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5154139</guid><dc:creator>patman</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/888_umdf_4_you/comments/5154139.aspx</comments><wfw:commentRss>http://blogs.msdn.com/888_umdf_4_you/commentrss.aspx?PostID=5154139</wfw:commentRss><description>&lt;P&gt;Apparently Bungie released a game this week.&amp;nbsp; This caused something of a massive line to form around the company store on Tuesday.&amp;nbsp; And in a first for the physical company store, they opened the store at 7am to help handle the load.&amp;nbsp; That means they shot down my suggestion of catapulting copies to people as they drove through the parking lot.&amp;nbsp; Someday people will learn my system of projectile product delivery does work.&lt;/P&gt;
&lt;P&gt;I did succumb to the Halo Hype, or as I'm calling it now, Hypelo, but I took more of the lazy geek way.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Also in a first, they allowed the online company store to take pre-orders.&amp;nbsp; Sad thing here is the warehouse is in Georgia, so not only were we dinged for sales tax, but also&amp;nbsp;with a shipping charge.&amp;nbsp; But in this case,&amp;nbsp;a scant 3 dollars per copy of Hypelo 3 to have it delivered to my door on launch day seemed to outweigh the&amp;nbsp;standing in line factor.&amp;nbsp; And what with gas prices, it probably would have cost me 3 bucks just to drive my car over there to get one copy.&lt;/P&gt;
&lt;P&gt;I'll find some time this weekend to play I'm sure.&amp;nbsp; Unless it's clear out at night...&amp;nbsp; &lt;/P&gt;
&lt;P&gt;My Hypelo 3 party was really halted by another package which arrived at my door the same day.&amp;nbsp; &lt;A href="http://www.bisque.com/Products/TheSky6/" target=_blank mce_href="http://www.bisque.com/Products/TheSky6/"&gt;The Sky 6&lt;/A&gt;.&amp;nbsp; A really nice bit of software for us astro-geeks.&amp;nbsp; Of course, I played with that right away.&amp;nbsp; I had to&amp;nbsp;drop it on the laptop and annoy my&amp;nbsp;wife endlessly by sitting in the family&amp;nbsp;room swinging my 'scope around (it was raining outside&amp;nbsp;*sniff*) from my laptop.&lt;/P&gt;
&lt;P&gt;Sadly no Xbox gamer points for figuring out the LAT/LONG of my backyard, but f'eh, I'll survive.&amp;nbsp; Maybe now I'll be able to find Cygnus easier the next time it's clear out.&lt;/P&gt;
&lt;P&gt;So on to some actual UMDF stuff.&amp;nbsp; One of my new favorite things about UMDF is more of the framework's&amp;nbsp;built in "cost&amp;nbsp;of working with a driver" code.&amp;nbsp; In this case, request cancellation!&lt;/P&gt;
&lt;P&gt;Let's take a random request from the hybrid sample driver;&lt;/P&gt;
&lt;DIV align=left&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; IOCTL_ALLOCATE_ADDRESS_RANGE:
        {

            &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ((&lt;SPAN class=kwrd&gt;sizeof&lt;/SPAN&gt; (ALLOCATE_ADDRESS_RANGE) &amp;gt; InputBufferSizeInBytes) ||
                (&lt;SPAN class=kwrd&gt;sizeof&lt;/SPAN&gt; (ALLOCATE_ADDRESS_RANGE) &amp;gt; OutputBufferSizeInBytes))
            {
                wdfRequest-&amp;gt;CompleteWithInformation (
                    HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER),
                    &lt;SPAN class=kwrd&gt;sizeof&lt;/SPAN&gt; (ALLOCATE_ADDRESS_RANGE));
            }
            &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;
            {
                IRequestCallbackRequestCompletion * completionRoutine = \
                    RequestCompletion ();
                
                wdfRequest-&amp;gt;SetCompletionCallback (
                    completionRoutine,
                    (PVOID) &amp;amp;ControlCode);

                completionRoutine-&amp;gt;Release ();
                
                hrSend = SubmitAsyncRequestToLower (wdfRequest);
                &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (FAILED (hrSend))
                {
                    wdfRequest-&amp;gt;Complete (hrSend);
                }
            }
        } &lt;SPAN class=rem&gt;// case IOCTL_ALLOCATE_ADDRESS_RANGE&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;You'll notice the decided lack of a cancellation routine here.&amp;nbsp; In this particular case, we're not doing any heavy lifting (allocation or request specific operations&amp;nbsp;in the driver) so&amp;nbsp;we don't have to worry about any clean up on cancellation.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;And since the request was submitted through the framework via the test application, the framework will actually handle cancellation for us.&lt;/P&gt;
&lt;P&gt;That leaves us with merely submitting the request to the next lower driver, and how easy is this?&amp;nbsp;&lt;/P&gt;&lt;PRE class=csharpcode&gt;HRESULT
CVDevParallelQueue::SubmitAsyncRequestToLower (
    __in IWDFIoRequest * Request)
{
    HRESULT hr;

    Request-&amp;gt;FormatUsingCurrentType();


    hr = Request-&amp;gt;Send (
        m_kmdfIoTarget, 
        0,  &lt;SPAN class=rem&gt;// Submits Asynchronous&lt;/SPAN&gt;
        0);

    &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; (hr);
}&lt;/PRE&gt;
&lt;P&gt;Again, since the request was submitted through the framework, we've already got a nice &lt;STRONG&gt;&lt;FONT face="Times New Roman"&gt;IWDFIoRequest&lt;/FONT&gt;&lt;/STRONG&gt; object, so voila!&amp;nbsp; After a&amp;nbsp;little water&amp;nbsp;is added to the&amp;nbsp;package, we get request submission!&lt;/P&gt;
&lt;P&gt;The real only gotcha here is the completion routine.&amp;nbsp; UMDF doesn't allow you to insert a pointer to a specific&amp;nbsp;completion routine like KMDF / WDM do, so should we need to do anything specific for that request on completion, we'll have to actually create a dispatch routine within that completion routine to submit it to the appropriate child routine.&lt;/P&gt;
&lt;P&gt;You'll see that all that detail in the hybrid sample driver, which I'm happy to say, is finally all cued up for&amp;nbsp;the next&amp;nbsp;WDK release.&lt;/P&gt;
&lt;P&gt;And before I leave, I was asked if I could post a picture of my dog.&amp;nbsp; After all, she's my sidekick for this journey.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://mika.members.winisp.net/hawtdog.jpg" atomicselection="true" mce_href="http://mika.members.winisp.net/hawtdog.jpg"&gt;&lt;IMG height=180 src="http://mika.members.winisp.net/hawtdog.jpg" width=240 mce_src="http://mika.members.winisp.net/hawtdog.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Her name is Mika (named after two time Formula 1 World Champion, Mika Hakkinen).&amp;nbsp; She's an 18 month old Australian Shepherd who is probably a few math classes away from her doctorate in physics.&amp;nbsp; They are ridiculously smart dogs.&lt;/P&gt;
&lt;P&gt;Thanks to everybody who has emailed to commiserate about my trials of astronomy and ASCII.&amp;nbsp; It's always nice to know you're not alone.&amp;nbsp; Even though when staring&amp;nbsp;out at&amp;nbsp;space, only my neighbors can hear me scream...&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;*Currently&amp;nbsp;playing - Beatles, &lt;EM&gt;Ticket to Ride&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5154139" 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/Random/default.aspx">Random</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Halo/default.aspx">Halo</category><category domain="http://blogs.msdn.com/888_umdf_4_you/archive/tags/Astronomy/default.aspx">Astronomy</category></item></channel></rss>