Archive for the ‘WDK’ Category

Windows 7 Server == Windows Server 2008 R2

Tuesday, September 30th, 2008

Wow, who knew. Well, apparently everyone else. Sigh…

Bad Idea: Making assumptions about CPU number

Tuesday, September 30th, 2008

If you own a driver that makes assumptions about what processor you’re executing on at any point, you may want to re-think that strategy.

It has been possible in the past to assume that, if you’re running at DISPATCH_LEVEL on a given physical processor, you can get away with less locking if you do per-processor data structures. It makes sense: you are guaranteed to be the only thread in your code on that CPU until you’re done, since you can only be preempted by threads > DISPATCH_LEVEL, and your DPC will pick up where it left off once the system returns to DISPATCH_LEVEL. With a per-processor queue or other data structure, accesses from DISPATCH_LEVEL are guaranteed to be atomic.

Well, for reasons that will become clear over the next few months, that strategy is no longer possible. There may be cases in future versions of Windows that allow different physical processors to be assigned the same processor ID. That means that two different threads running at the same time on different processors might wind up colliding on the same queue.

Of course, this also implies that data structures that were once assumed to be per-processor exclusive (i.e. singletons) will no longer necessarily be so. If you’re using processor number as a key that you assume is globally unique, e.g. managing some initialize-once data or something, you will need to re-think your architecture.

If you don’t generally deal with processor numbers, none of this matters to you. For those that do, however, if you do anything "smart" with processor numbers, you may have some re-thinking to do.

At Driver DevCon

Monday, September 29th, 2008

Ken, Soren, and I are at DDC 2008 this week. So far, the talks have been great, as is the weather. If you’re around, drop one of us a line.

-Steve

New WDK available

Tuesday, July 17th, 2007

There’s a new (beta) WDK available on Connect. It’s paired with the Vista SP1 beta, as well as with the Server beta, so it’s probably a good time to download and test things out.

UPDATE: The story has changed; it’s just Server 2008, not Vista SP1.

Please at least Authenticode-sign your drivers

Friday, June 15th, 2007

I am a happy user of Parallels Desktop, which, for those that don’t keep up with this sort of thing, is virtual machine software for Mac. It’s a great product overall, although it has a few rough edges.

One of the rougher edges is the fact that their drivers are unsigned. I suspect they’re probably doing some unsignable things, but for Vista, there’s still a partial solution: Authenticode signing.

I’ve covered signing on this blog in the recent past, so I won’t re-hash the technical details again. But from the perspective of an end-user, I hate clicking all of those blood-red boxes. I even missed a click once and had to figure out how to fix it manually.

Authenticode doesn’t do much for downlevel platforms, but it can make a big, positive difference to end users on Vista and beyond.

A documented way to get loaded modules

Tuesday, June 5th, 2007

This is a new one on me. I just saw this mentioned on NTDEV for the first time yesterday. AuxKlibQueryModuleInformation is a documented way to get the loaded modules, replacing some of the functionality of ZwQuerySystemInformation.

In fact, the entire Auxiliary Kernel-Mode Library Routines section is interesting. I had no idea it existed until now. Other exports include AuxKlibGetImageExportDirectory and AuxKlibGetBugCheckData.

Doron Holan says that it’s backward-compatible all the way to Windows 2000 via a static library, in a similar manner to cancel-safe queues and the safe string library.

Neato.

Thomas Divine is re-blogging

Thursday, May 31st, 2007

A mere hour after I ran across Don Burn’s new blog, I read on the PCAUSA network driver development mailing list that Thomas Divine has started blogging again. For those that don’t know Thomas: as nearly as I can tell, he knows everything that is to be known about NDIS. If you do network driver development, you’ve surely benefitted from his www.ndis.com site.

*RSS reader grows by one more blog*

Don Burn is blogging

Thursday, May 31st, 2007

I just ran across Don Burn’s new(ish) WDK-focused, at http://msmvps.com/blogs/WinDrvr. Don is a longtime contributor to the community and I like the direction he’s gone with his first few posts.

In addition to the basic driver dev stuff, he’s getting into some important higher-level stuff like source control and using undocumented features. I bet I could have guessed his opinion on both topics before reading, though. :-)

*Added to my RSS reader*

Be careful with MmGetSystemRoutineAddress

Thursday, May 31st, 2007

Bill McKenzie reported on NTDEV that he re-discovered a nasty crash bug in MmGetSystemRoutineAddress. Apparently, all versions of Windows XP and everything before Windows Server 2003 SP1 will bugcheck if they’re passed an invalid system routine name.

This bug is fixed in Vista and is scheduled for fix in XP SP3.

Meanwhile, Peter Viscarola from OSR offers this advice:

The work-around is to always call MmGetSystemRoutineAddress from within a try/except block. If you get the exception, I guess you can assume the routine you’re seeking isn’t there…

UPDATE from Doron Holan:

FYI, using SEH to recover from this bug is *NOT* recommended. SEH is not a formal contract for this API and as such, we (MSFT) cannot guarantee that the OS is still in a stable state after you have caught the exception. I am working on a better solution, but for now, SEH is not the answer.

New WinDBG

Friday, April 27th, 2007

There’s a new WinDBG release. Enjoy!