[Two] doubts about KdPrint()...

Hi!

During the last days, I came across two very strange things when using
KdPrint [it’s my
favourite methode to track the flow of Irp’s and other stuff that
happens]. I’m
working on a driver with worker threads, a system helper-service and a
Windows application to control it all. [Windows 2000].

My first problem:

At one point [very rarely, say, 7 times a day], the worker thread needs to
wait for
something to happen. I thought I don’t really need a special extra event
there as
the result will usually happen within 1-3 seconds, and even if it does not
it’s not
fatal, so I created a loop looping around a few times, slowed down with a
call
with val.QuadPart=-333 to:
KeDelayExecutionThread( KernelMode, FALSE, &val );

This does not work properly. Even setting val.QuadPart to -33333 doesn’t
work.
Interestingly enough, each time any other part of the driver throws a
KdPrint(),
KeDelayExecutionThread() returns. It is inside a ‘critical region’ and
always returns STATUS_SUCCESS.

My current work-around is to increase the number of loops from 12 to 1000
when
#if DBG”, but I’m not entirely happy with this :slight_smile:

The second problem:

Part of my driver project is a MFC application to control everything.
While stress-testing
some functionality (Imagine me sitting in front of the keyboard, hitting
‘cursor_down’ to
select an option from a combo-box, then releasing a message box with
‘return’), after a
while the system tends to use up 100% processor time. [This didn’t happen
with a console
application doing the same thing, even a lot faster]

After a week of searching I found the cause:
When a lot of KdPrint() messages are displayed/transferred [serial cable]
AND the MFC
application [doesn’t need to access the driver at all!] displays lots of
AfxMessageBox()es
rapidly, THEN some system thread (?) starts to “hang”, using 100%
processor power.
(I can end the MFC program, stop the service, unload the driver, and still
100%. I don’t
know what part of the system hangs, though)

Fortunately this doesn’t happen with the release version [no KdPrint()'s]
and I still can
use KdPrint()'s when I make sure that AfxMessageBox()es are not displayed
rapidly.
Still this worries me… Any ideas here?

Thanks for reading all this :slight_smile:

Cheers,
Michael “Why me?” B.


Vogon International GmbH
http://www.vogon-international.com