Tech Support > Microsoft Windows > Drivers > I find a big bug in the source of diskperf!
I find a big bug in the source of diskperf!
Posted by xmllmx on August 3rd, 2007


I find a big bug in the source of diskperf!

The diskperf source code contains a function as follows:

// CODE BEGIN //////////////////////////

#define DebugPrint(x) DiskPerfDebugPrint x

#if DBG

VOID
DiskPerfDebugPrint(
ULONG DebugPrintLevel,
PCCHAR DebugMessage,
...
)

/*++

Routine Description:

Debug print for all DiskPerf

Arguments:

Debug print level between 0 and 3, with 3 being the most verbose.

Return Value:

None

--*/

{
va_list ap;

va_start(ap, DebugMessage);


if ((DebugPrintLevel <= (DiskPerfDebug & 0x0000ffff)) ||
((1 << (DebugPrintLevel + 15)) & DiskPerfDebug)) {

DbgPrint(DebugMessage, ap);
}

va_end(ap);

}
#endif

// CODE END //////////////////////////

If I call the function like this:

DebugPrint((0, "Hello %X, %X, %X\n", 0x89, 0x99, 0x123));

It is weird that this function should output:

Hello F243791C, F243791C, F2437964

Posted by Tim Roberts on August 5th, 2007


xmllmx <xmllmx@gmail.com> wrote:
That's fascinating. You are absolutely correct -- this is a bug, and it's
been in there a long time. I'm surprised that a driver writer would try to
get away with this, and even more so that it slipped through into the DDK.

You should be able to replace the DbgPrint call with something like this:
vDbgPrintEx( IHVDRIVER, 1, DebugMessage, ap );
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.


Similar Posts