Problems adding WPP tracing to Mirror Driver sample

Discussion in 'Windows Vista Drivers' started by jrb1400, Mar 21, 2007.

1. jrb1400Guest

Hi,

I am getting compile errors when trying to add WPP tracing to the Mirror
driver sample. For now, I'm working on the miniport part of the driver. I
am using the command line build (build -ceZ). I get the same errors with
either the Checked or Free build environments

With the original build attempts, there were over 100 syntax errors parsing
<evnttrace.h>. (evnttrace.h is included by mirror.tmh - which is created by
WPP)
I tried to include <ntddk.h>, but then I get many (again over 100) multiply
defined items while parsing miniport.h

Two Questions:
1. Are there any special compiler / define flags to set when using tracing
with a mini driver ? Hoe can I get this to build ?
2. When can I call WPP_CLEANUP(DriverObject)? I don't see anytihing in the
VIDEO_HW_INITIALIZATION_DATA where I can define an Unload routine.

Thanks very much for any assistance,
Jay

Here are some clips from files I am using

- - - - - - - - - - - - - - - -
SOURCES (entire file)
- - - - - - - - - - - - - - - -
TARGETNAME=mirror
TARGETTYPE=DRIVER

TARGETLIBS=\$(DDK_LIB_PATH)\videoprt.lib

AXP64_FLAGS=/QA21164

INCLUDES=..\inc;..\..\inc

SOURCES=mirror.c \
mirror.rc

#
# Generate WPP tracing code
# \$(SOURCES) -- run software preprocessor on files listed in SOURCES
# -km -- use kernel mode
# -func -- define function we'll use for tracing
# This would map all TraceEvents calls to
# DoTraceMessage.
#
RUN_WPP= \$(SOURCES) \
-km \
-func:TraceEvents(LEVEL,FLAGS,MSG,...) \
-gen:{km-WdfDefault.tpl}*.tmh

- - - - - - - - - - - - - - - -
MIRROR.C (just the beginning of it)
- - - - - - - - - - - - - - - -
// #include <ntddk.h> // tried with and without this
#include "dderror.h"
#include "devioctl.h"
#include "miniport.h"
#include "ntddvdeo.h"
#include "video.h"
#include "mirror.h"

#include "trace.h" // added for WPP tracing
#include "mirror.tmh" // added for WPP tracing

VOID DbgBreakPoint() {};

VOID
MirrorNotImplemented(
__in char *s
)
{
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT, "Mirror Sample: Not used
'%s'.\n", s);
}
.. . . . .

- - - - - - - - - - - - - - - -
TRACE.H (entire file)
- - - - - - - - - - - - - - - -
#define WPP_CHECK_FOR_NULL_STRING //to prevent exceptions due to NULL strings

#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID(igeMirrorMiniTraceGuid, (060C32B7, C530, 4d7b,
9A57, F2AA390A724F),\
WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \
WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \
WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \
WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \
WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \
WPP_DEFINE_BIT(DBG_IOCTLS) /* bit 5 = 0x00000020 */ \
WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \
WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \
WPP_DEFINE_BIT(DBG_DPC) /* bit 8 = 0x00000100 */ \
WPP_DEFINE_BIT(DBG_INTERRUPT) /* bit 9 = 0x00000200 */ \
WPP_DEFINE_BIT(DBG_LOCKS) /* bit 10 = 0x00000400 */ \
WPP_DEFINE_BIT(DBG_QUEUEING) /* bit 11 = 0x00000800 */ \
WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \
/* There is a limit of 32 defines. */\
)

#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) &&
WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)

jrb1400, Mar 21, 2007