DbgPrintEx() no output in DbgMon!

Hi,

I cannot seem to get output messages in DbgMon when I use the following line
of code.

DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, “The quick brown fox\n”);

I have read the documentation and created a key IHVDRIVER in the registry
and set its value to 8. In fact if I set its value to 0xFFFFFFFF I still get
no text.

Is there something else that needs to be setup or am I using this function
completely wrong?

I looked through the registry but could not find a key called WIN2000 as
mentioned in the DDK docs.

I am using Windows XP and DDK 6001.18000.

Regards FarmerJo

  1. Ensure that DbgMon is capturing kernel output. Ctrl-K.
  2. On Windows XP only, DPFLTR_IHVDRIVER_ID is wrong. It is #define’d as 77 but XP expects 79. So to use DbgPrintEx, you have to detect if you’re running on XP and pass 79 instead of DPFLTR_IHVDRIVER_ID.

Best regards -
-Stephen Cleary

Hi,

Many thanks for the help, this was beginning to drive me bonkers! I did as
you suggested and it now works. I do have one or two other questions.

If I set the registry key IHVDRIVER to 8, I get both INFO and ERROR messages
displayed in DbgMon, I was only expecting to see INFO given a bit pattern of
00…1000 etc. Why is this? Do I need to remove the default key?

Given that DPFLTR_IHVDRIVER_ID is defined with the wrong value in dpfilter.h
are any of the other ComponentIDs incorrect also? Is there a replacement
module for this?

I looked far and wide across the internet for information regarding this
issue but was unable to find any. Is there a URL anywhere that I could
reference?

Once again many thanks.

Regards FarmerJo

Get SetDbgPrintFiltering from osronline

–Mark Cariddi

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Tuesday, April 29, 2008 11:59 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DbgPrintEx() no output in DbgMon!

Hi,

I cannot seem to get output messages in DbgMon when I use the following
line
of code.

DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, “The quick brown
fox\n”);

I have read the documentation and created a key IHVDRIVER in the
registry
and set its value to 8. In fact if I set its value to 0xFFFFFFFF I still
get
no text.

Is there something else that needs to be setup or am I using this
function
completely wrong?

I looked through the registry but could not find a key called WIN2000 as

mentioned in the DDK docs.

I am using Windows XP and DDK 6001.18000.

Regards FarmerJo


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> If I set the registry key IHVDRIVER to 8, I get both INFO and ERROR messages

displayed in DbgMon, I was only expecting to see INFO given a bit pattern of
00…1000 etc. Why is this? Do I need to remove the default key?

Read “Reading and Filtering Debugging Messages” in MSDN, and specifically note the WIN2000 value. Setting your registry key to 8 results in a mask of 9.

Given that DPFLTR_IHVDRIVER_ID is defined with the wrong value in dpfilter.h
are any of the other ComponentIDs incorrect also? Is there a replacement
module for this?

Technically, DPFLTR_IHVDRIVER_ID is not wrong; this is a known bug in XP that it is now too late to fix (because drivers now rely on the bug…).

You just need to add 2 to any value >= 42, but only when you run on XP. To understand why, see the OSR ntdev link below.

Regarding a “replacement module”, I’ve written some generally useful functions dealing with OS version detection, tracing, and dynamic function lookups (what I consider very basic, almost standard functionality that would be duplicated in nearly every driver). They’re available for free at:
https://sourceforge.net/projects/kmnito/
I must warn you, though, that this is technically “pre-release” code - I wasn’t planning on announcing it until I had done more testing (especially the WDK helper portions) and definitely more documentation .

> I looked far and wide across the internet for information regarding this
> issue but was unable to find any. Is there a URL anywhere that I could
> reference?

Stan Mitchell did an excellent job of summarizing why this problem exists on this list on 2007-04-02:
http://www.osronline.com/showThread.cfm?link=107386
Google doesn’t seem to index this thread for some reason, so it’s a bit hard to find…

(from your first post):
> I am using Windows XP and DDK 6001.18000.

WDK 6001.18000 has incorrect KMDF coinstallers. You’ll need to update the WDF coinstallers from Windows Connect before you install a driver on any Vista machine.

-Stephen Cleary

Hi,

Thanks for the info.

I did look long and hard at “Reading and Filtering Debugging Messages” and
understood it all except the WIN2000 thingy. I looked in the registry and
could not find any such item so assumed that it was not present on my XP
machine. Will re-read this section again though.

Where abouts is this WIN2000 key/variable/other. I recall from the
documentation that it can be changed if required.

Regards FarmerJo