OSR Dev Blog

The WDK Build Environment -- Not Getting Better
(By: Hector J. Rodriguez | Published: 14-Feb-06| Modified: 14-Feb-06)
Have you tried to build a driver with the new Vista DDK, which is now called the Windows Driver Kit (WDK)?  If you have, I bet you're as annoyed as I am.  If not, you should really give it a try and let me know your opinion.

It's nothing earth-shattering, but it feels like the folks who put the kit together no longer "get it" when it comes to what matters in the build environment for us devs.

Here are a few examples of kind of things I'm talking about:

  • When you build your driver (using the traditional "build -cZ" command or just "bcz"), warnings are no longer displayed in your terminal window.  You can still get to them, of course, but you'll have to find the file named buildchk_wlh_amd64.wrn.

  • Warnings are no longer treated as errors in the checked build environment (as they have been for years), but they are treated as errors in the free build environment.

  • The functions PoCallDriver and PoStartNextPowerIrp have been declared deprecated in the Vista checked build environment, causing all sorts of mess.

In terms of PoCallDriver and PoStartNextPowerIrp, let me start by saying that the Windows power management team has done the driver development world a great service by making these calls unnecessary in Vista (as reported previously in The NT Insider).  In Vista, PoCallDriver just calls IoCallDriver, and PoStartNextPowerIrp does nothing.  So, the changes to Vista rendering these DDIs unnecessary are great, and we owe them a case of beer (or something) as thanks.

What's not so great is the fact that these functions were declared "deprecated."

If you include either PoCallDriver or PoStartNextPowerIrp in your code, you get a warning... in the Vista checked build environment only.  You don't get the warning in the Vista free build environment, or in any of the down-level build environments (free or checked).  The warning:

d:\blahblah\nothingpower.c(442) :
warning C4996: 'PoCallDriver' was declared deprecated

Don't forget that you actually have to find the .wrn file to see this warning, because warnings are no longer displayed by the compiler by default.

That's not so bad, right?  Confusing and untidy, but once you figure out what's going on nothing too much to rant about?  Well, consider that you'll have to just live with the warnings if you want a single version of your driver to build in the Vista build environment but run on Vista and also down-level platforms.

Of course, if you're willing to build multiple versions of your driver (one for Vista, and another for down-level platforms) it gets really ugly.  You wind up with code that looks like the following:

// We're not interested in this irp, so we'll start
// the next one and pass this one down.
PoStartNextPowerIrp (Irp);


= PoCallDriver (fdoData->DeviceToSendIrpsTo, Irp);
= IoCallDriver (fdoData->DeviceToSendIrpsTo, Irp);

Let me emphasize here: The only reason the conditionals above are necessary is to eliminate the warnings generated by these functions being deprecated.  There's no actual problem calling PoCallDriver and PoStartNextPowerIrp on Vista, because they were changed to "do the right thing" on that platform, precisely for the purpose of allowing drivers to support a single executable across multiple Windows systems.

To me, this is a big mess.  I calm myself by repeating the phrase "it's a beta, after all" and looking forward to the real release.

This article was printed from OSR Online http://www.osronline.com

Copyright 2017 OSR Open Systems Resources, Inc.