Where are the WDF files in the WDK?

The WDF (both UMDF and KMDF) files in the WDK are not found in a single directory, rather they are spread out across the entire WDK directory tree. Why? Because the WDK is not just WDF J and the WDK has directories for different purposes, so replicating a specifically purposed directory (like redistributables) under a…

0

Should I use the chk or fre KMDF coinstaller?

This has been asked quite a few times and is a major point of confusion for KMDF developers.  The KMDF coinstaller comes in 2 flavors, chk and fre.  Both flavors reside in the same directory in the WDK (winddk\6000\redist\wdf\<arch>) and have their own unique filenames (fre is WdfCoInstaller01005.dll, chk is WdfCoInstaller01005_chk.dll). You have to decide which…

3

How to return the number of bytes required for a subsequent operation

A very common pattern is to allow a caller to ask for the number bytes (or elements) required and then ask for the data, many user mode Win32 APIs (like RegQueryValueEx) and kernel mode (like IoGetDeviceProperty) implement it. You first ask for the number of bytes needed (passing NULL and a pointer to a size),…

7

Creating your own InterlockedXxx operation

Sometimes your design requires an Interlocked operation that is not currently supported by the OS, runtime libraries, or the compiler (as an intrinsic). You then have a choice to make. Either remove all Interlocked operations for that particular field and use a lock or roll you own Interlocked function. Roll your own Interlocked function? Sounded…

7

Why you want to use POBJECT_TYPEs when converting handles to objects

This post concludes my trilogy (see parts 1 and 2) on PBOJECT_TYPE (although I do reserve the right to pull a George Lucas and add more episodes later 🙂 ). Today we shall cover why passing the PBOJECT_TYPE to ObReferenceObjectByHandle, ObReferenceObjectByPointer, or ObOpenObjectByPointer is important. Let’s take the following snippet NTSTATUS status; PKEVENT pEvent; status…

0

What is POBJECT_TYPE?

In a previous post I wrote about the newly documented POBJECT_TYPE variables for Vista. You can pass these exports to ObReferenceObjectByHandle, ObReferenceObjectByPointer, or ObOpenObjectByPointer. Talking about the new exports without talking about the type itself was a little bit of putting the cart before the horse and I wanted to fix that ;). So, what…

1

Getting Vista to open my Inbox the way I want it to

I am a creature of habit. Once I get into a pattern, especially with keyboard keys (i.e. my sleep key went missing), it is very hard for me to break the habit and learn to do something else to achieve the same goal.  One pattern I have grown accustomed to is hitting the Mail key…

3

Support for double checked locking

Looking through some of the additions to the WDK, I found an interesting structure, RTL_RUN_ONCE. After a little more digging, I found that it is also exposed in user mode under a different typedef, INIT_ONCE. They both have the same set of functionality, but with different naming patterns that matches their typenames. The Rtl functions…

2

Have you been waiting for a book on WDF?

Well wait no more!  We (the technical writers on WHDC and the WDF team) is working on a book and it was just announced (the description is currently a little wonky though).  The book will cover both KMDF and UMDF and the static analysis tools (SDV and PreFAST for Drivers).  Hope you will like it, we are…

0

New POBJECT_TYPE exports documented in the WDK

When calling ObReferenceObjectByHandle, ObReferenceObjectByPointer, or ObOpenObjectByPointer you should be passing a non NULL value for the POBJECT_TYPE ObjectType parameter (more on why you should never pass NULL in a later post). Before Windows Vista there were only two documented types in the DDK, *IoFileObjectType and *ExEventObjectType (these are exported as a POBJECT_TYPE* which is why…

6