//Initialization:
//Initialize trace engine:
TraceInitialize();
//Enable output of errors to the debugger:
TraceAssignGroupsToStream
(TO_DebugMonitor, TG_Error, (unsigned)-1);
//Enable output of debug traces to debugger
//(KeyWordDriverDebug is defined as "DrvD")
TraceAssignGroupKeyWordToStream
(TO_DebugMonitor, KeyWordDriverDebug);
//Also print errors to the system event log
EnableTraceToOutputLog
(DriverObject, TG_Error, (unsigned)-1);
//Finally allocate 1 MB trace buffer for thread switch traces
TraceAllocateBuffer(1024*1024, TG_ThreadSwaps, (unsigned)-1);
//Printing debug statement
HTRACEK((KeyWordDriverDebug, "Entering DriverEntry"));
//Printing thread swaps:
HTRACE(TG_ThreadSwaps,
"%d Swap %x->%x processor = %d. Hard brkpt",
Count++, PrevThread, CurThreadID,
Processor);
End of Figure