KdPrintEx/IHVDRIVER works on Vista but not on XP

Hello all,

My development is on a driver that supports Win2k through Vista platforms. I
have lived with this problem for a while by setting Kd_WIN2000_Mask to 0xf
and setting it back to 1 when a flurry of messages from other components
became too much. Today, I finally decided to investigate why the filtering
was not working. Here are my findings and a workaround in case anyone else
might find it useful.

I had been using KdPrintEx with a ComponentID of DPFLTR_IHVDRIVER_ID on
WinXP and 2K3 Server. After switching to WDK 6000, KdPrintEx works for Vista
but no longer generates a debug trace on XP. Some tracing in ntoskrnl
revealed that the value of DPFLTR_IHVDRIVER_ID for XP is 79 and the same
ComponentID has the value 77, on Vista and 2K3.

DDK 3790.1830 had distinct wdm.h header files that defined the
DPFLTR_IHVDRIVER_ID constant, with these different values (77 vs. 79). After
the WDK header file restructuring, this constant was moved into dpfilter.h
and only has the 77 value. Shouldn’t the DPFLTR_TYPE enumeration have two
definitions based on NTDDI_VERSION?

Comparing the two enums shows that the XP version has DPFILTR_BOOTOK_ID and
DPFILTR_BOOTVRFY_ID at 42 and 43, but they have been removed in the WDK
version. For WinXP, this increases the values of all ComponentIDs from
DPFLTR_RPCPROXY_ID onwards by 2.

To work around this, I do a run-time check for XP and if true, use 79 (my
DPFLTR_IHVDRIVER_XP_ID) in KdPrintEx and DbgPrintEx calls.

Stan Mitchell - SourceQuest, Inc.