Share via


of queues, cues and q-s

Apparently Bungie released a game this week.  This caused something of a massive line to form around the company store on Tuesday.  And in a first for the physical company store, they opened the store at 7am to help handle the load.  That means they shot down my suggestion of catapulting copies to people as they drove through the parking lot.  Someday people will learn my system of projectile product delivery does work.

I did succumb to the Halo Hype, or as I'm calling it now, Hypelo, but I took more of the lazy geek way. 

Also in a first, they allowed the online company store to take pre-orders.  Sad thing here is the warehouse is in Georgia, so not only were we dinged for sales tax, but also with a shipping charge.  But in this case, a scant 3 dollars per copy of Hypelo 3 to have it delivered to my door on launch day seemed to outweigh the standing in line factor.  And what with gas prices, it probably would have cost me 3 bucks just to drive my car over there to get one copy.

I'll find some time this weekend to play I'm sure.  Unless it's clear out at night... 

My Hypelo 3 party was really halted by another package which arrived at my door the same day.  The Sky 6.  A really nice bit of software for us astro-geeks.  Of course, I played with that right away.  I had to drop it on the laptop and annoy my wife endlessly by sitting in the family room swinging my 'scope around (it was raining outside *sniff*) from my laptop.

Sadly no Xbox gamer points for figuring out the LAT/LONG of my backyard, but f'eh, I'll survive.  Maybe now I'll be able to find Cygnus easier the next time it's clear out.

So on to some actual UMDF stuff.  One of my new favorite things about UMDF is more of the framework's built in "cost of working with a driver" code.  In this case, request cancellation!

Let's take a random request from the hybrid sample driver;

     case IOCTL_ALLOCATE_ADDRESS_RANGE:
        {

            if ((sizeof (ALLOCATE_ADDRESS_RANGE) > InputBufferSizeInBytes) ||
                (sizeof (ALLOCATE_ADDRESS_RANGE) > OutputBufferSizeInBytes))
            {
                wdfRequest->CompleteWithInformation (
                    HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER),
                    sizeof (ALLOCATE_ADDRESS_RANGE));
            }
            else
            {
                IRequestCallbackRequestCompletion * completionRoutine = \
                    RequestCompletion ();
                
                wdfRequest->SetCompletionCallback (
                    completionRoutine,
                    (PVOID) &ControlCode);

                completionRoutine->Release ();
                
                hrSend = SubmitAsyncRequestToLower (wdfRequest);
                if (FAILED (hrSend))
                {
                    wdfRequest->Complete (hrSend);
                }
            }
        } // case IOCTL_ALLOCATE_ADDRESS_RANGE
        break;

You'll notice the decided lack of a cancellation routine here.  In this particular case, we're not doing any heavy lifting (allocation or request specific operations in the driver) so we don't have to worry about any clean up on cancellation. 

And since the request was submitted through the framework via the test application, the framework will actually handle cancellation for us.

That leaves us with merely submitting the request to the next lower driver, and how easy is this? 

 HRESULT
CVDevParallelQueue::SubmitAsyncRequestToLower (
    __in IWDFIoRequest * Request)
{
    HRESULT hr;

    Request->FormatUsingCurrentType();


    hr = Request->Send (
        m_kmdfIoTarget, 
        0,  // Submits Asynchronous
        0);

    return (hr);
}

Again, since the request was submitted through the framework, we've already got a nice IWDFIoRequest object, so voila!  After a little water is added to the package, we get request submission!

The real only gotcha here is the completion routine.  UMDF doesn't allow you to insert a pointer to a specific 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.

You'll see that all that detail in the hybrid sample driver, which I'm happy to say, is finally all cued up for the next WDK release.

Thanks to everybody who has emailed to commiserate about my trials of astronomy and ASCII.  It's always nice to know you're not alone.  Even though when staring out at space, only my neighbors can hear me scream...

*Currently playing - Beatles, Ticket to Ride