Dear Sir:
I try to add below code to my driver source, and add sys to
vista.
But No Message output. What's wrong with me?
Please help me to solve it.
//----------------------------------------------------------------------------------------------------------------------//
ULONG DebugLevel = TRACE_LEVEL_INFORMATION;
ULONG DebugFlag = DBG_INIT|DBG_PNP|DBG_POWER|DBG_CREATE_CLOSE|
DBG_IOCTLS|DBG_WRITE|DBG_READ|DBG_DPC|DBG_INTERRUPT|DBG_HW_ACCESS;
VOID
SerialDbgPrintEx (
IN ULONG TraceEventsLevel,
IN ULONG TraceEventsFlag,
IN PCCHAR DebugMessage,
...
)
{
#if DBG
#define TEMP_BUFFER_SIZE 1024
va_list list;
CHAR debugMessageBuffer [TEMP_BUFFER_SIZE];
NTSTATUS status;
va_start(list, DebugMessage);
if (DebugMessage) {
status = RtlStringCbVPrintfA( debugMessageBuffer,
sizeof(debugMessageBuffer),
DebugMessage,
list );
if(!NT_SUCCESS(status)) {
KdPrint((_DRIVER_NAME_": RtlStringCbVPrintfA failed %x\n",
status));
return;
}
if (TraceEventsLevel < TRACE_LEVEL_INFORMATION ||
(TraceEventsLevel <= DebugLevel &&
((TraceEventsFlag & DebugFlag) == TraceEventsFlag))) {
KdPrint((debugMessageBuffer));
}
}
va_end(list);
return;
#else
UNREFERENCED_PARAMETER(TraceEventsLevel);
UNREFERENCED_PARAMETER(TraceEventsFlag);
UNREFERENCED_PARAMETER(DebugMessage);
#endif
}
and
I call
SerialDbgPrintEx(TRACE_LEVEL_INFORMATION, DBG_PNP, "-->
SerialEvtDeviceAdd\n");
but NO message shows on DebugView