Hi Jonathan,
You might just want to try the new templates on the Vista B1 WDK, it
fixes all the problems reported before.
IF you are a participant in the Vista Beta Program use the WDK. If not
you can joing and I can provide further details.
There is a problem PRE-Vista of using WPP / WMI in the same code, the
famous toaster sample. Well that has also been fixed with the new
templates. The toaster sample has also been changed to use the new
templates and solve all these problems, please take a look at the
toaster sample.
Take a look at the Tracedrv sample which includes all the features
listed below.
Dynamic API selection
Supporting W2K and above
Released versions of WPP determine which ETW logging functions to call
at compile time
This feature allows the determination at runtime
Usage for WPP macros does not change.
Windows 2000, DoTraceMessage calls IoWMIWriteEvent
Windows XP or Windows Server 2003, DoTraceMessage calls
IoWmiTraceMessage
This makes it possible to write a single provider that runs on Windows
2000 and later without requiring the use of special template files
Supports WMI + WPP
New PRE- and POST-logging macros
Pre- and post-logging macros define
WPP_LEVEL_PRE(level)
WPP_LEVEL_POST(level)
It allows user code to become part of the tracing function's macro
expansion
Customers can use this for dynamic setup or cleanup around trace points
Sample:
Store the last error before doing the trace, and replace it after the
trace is done(this is user mode sample)
#define WPP_LEVEL_PRE(LEVEL) { ULONG WppPreLastError = GetLastError();
#define WPP_LEVEL_POST(LEVEL) ; SetLastError(WppPreLastError); }
Support for enumerated types
Enumerations can be used to display meaningful names in trace messages,
instead of displaying integer values that users must decode
To use an enumeration in trace messages, add configuration data such as
the following example to your source code file.
//begin_wpp config
// CUSTOM_TYPE(FormatName, ItemEnum(EnumName)
//end_wpp
EnumName is the enumeration and FormatName is the custom type that can
be used in the format string of a trace message
Enum DiskState {
DiskOffline =-1,
DiskOnline = 1,
DiskFailed = 0xFF000001,
DiskStalled = 0xFF000002
}
// begin_wpp config
// CUSTOM_TYPE(disk, ItemEnum(DiskState));
// end_wpp
DoTraceMessage(ERROR, "Disk Status = %!disk!", GetState());
To notify WPP to look for this configuration data in the source code
file, add a -scan:sourcecodefile parameter to the RUN_WPP macro that
invokes the WPP.
Tracewpp module name parameter
The new Tracewpp command-line argument
p:modulename
replaces the default string with a more convenient
user-defined message
This helps connect files that are part of one logical module but in
separate directories and helps distinguish between files that are in
separate modules but have visually similar paths.
Default output trace for sample driver
[0]0420.0F14::03/24/2005-10:19:22.100 [tracedrv]Hello, 1 Hi
With -p:MyDriver
[0]0E9C.0AE4::03/24/2005-10:23:34.743 [MyDriver]Hello, 1 Hi
!wmitrace debugger extension
-----------------------------
Use this extension to see your traces on the debbugger.
Set the path to the TMF files, and start the tracing session with the
-kd option.
!wmitrace.help
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jonathan Ludwig
Sent: Friday, September 16, 2005 9:42 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Problem with WPP_DEBUG macro
I implemented WPP Tracing as per the NT Insider Article " WPP Tracing
Part I -- Supporting Windows 2000 and Beyond". I then tried using the
WPP_DEBUG macro so I can get the traces as ordinary DbgPrint statements
too. I kept getting compiler errors saying the compiler couldn't
convert the data type of the last parameter in the format string and
parameters to a character string. I then looked at the macro and found
that there were too many paranthesis. So I ended up doing a second
stage marco to get it to work:
#define MyWppStage2(msg) DbgPrint msg
#define WPP_DEBUG(msg) MyWppStage2 msg
Is this a bug in the WPP preprocessor or did I do something wrong? I
did this in my SOURCES file:
RUN_WPP=$(SOURCES) <br> -km <br> -gen:{km-w2k.tpl}*.tmh <br> -dll <br> -func:SymTracePrint(LEVEL,EVENT,(MSG,...))
And my trace statements look like this:
SymTracePrint( TRACE_LEVEL_VERBOSE, FILEVOLDBG_IRP_INFO, ("Received Irp:
%p for device %p\n", Irp, DeviceObject));
I'm using the 2000 Build Environment of the 2003 Server SP1 DDK
(3790.1830).
Thanks,
Jonathan
---
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com