This would work for a combination of FLAGS and LEVEL not for a simple LEVEL instead of FLAGS, though note that even here there is a comma missing from the end of WPP_FLAG_LEVEL_LOGGER.
#define WPP_FLAG_LEVEL_LOGGER(ulFlags, ulLevel)?? WPP_LEVEL_LOGGER(ulFlags),
If you simply want to do LEVEL instead of flags there is a trick that works quite nicely.
Do something like the following (note the use of a dummy flag so WPP can find the data structure)
#define WPP_CONTROL_GUIDS \
??? WPP_DEFINE_CONTROL_GUID(CtlGuid,(a044090f,3d9d,48cf,b7ee,9fb114702dc1),? \
??????? WPP_DEFINE_BIT(DUMMY))
#define WPP_LEVEL_LOGGER(lvl) (WPP_CONTROL(WPP_BIT_ ## DUMMY).Logger),
#define WPP_LEVEL_ENABLED(lvl) WPP_CONTROL(WPP_BIT_ ## DUMMY).Level >= lvl
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@NAI.com
Sent: Wednesday, August 06, 2003 3:32 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] RE: WPP with LEVEL tracing.
Adding the following to common.h file solved the compile problem. But I have no idea if this would work. Any comments if the following make sense....
?
#define WPP_FLAG_LEVEL_LOGGER(ulFlags, ulLevel)?? WPP_LEVEL_LOGGER(ulFlags),
?
#define WPP_FLAG_LEVEL_ENABLED(ulFlags, ulLevel) ???????????? \
??????????? (WPP_LEVEL_ENABLED(ulFlags) && WPP_CONTROL(WPP_BIT_##ulFlags).Level <= ulLevel)
?
?
Looks like needs more digging for now......
?
-Srin.
?
-----Original Message-----
From: Kumar, Srin
Sent: Wednesday, August 06, 2003 3:11 PM
To: Windows System Software Developers Interest List
Subject: [ntdev] WPP with LEVEL tracing.
?
I tried building a test project to use WPP. It compiles fine if I use DoTraceMessage. But if use either LEVEL tracing feature or if I use a custom function build fails with the following errors. The driver entry does not do anything please do not complain about that. I am still trying to make the simple project build not run..
?
Any help is appreciated.
?
Compiling - main.c for i386
main.c(26) : error C4013: 'WPP_FLAG_LEVEL_ENABLED' undefined; assuming extern returning int
main.c(26) : error C2065: 'DBGF_INIT' : undeclared identifier
main.c(26) : error C4013: 'WPP_FLAG_LEVEL_LOGGER' undefined; assuming extern returning int
main.c(26) : error C2143: syntax error : missing ')' before 'constant'
main.c(26) : error C2198: 'WPP_SF_' : too few arguments for call through pointer-to-function
?
Do I need to define those?
?
Here is the test files.
?
/******************************** SOURCES FILE *************************************/
TARGETNAME=testcpp
TARGETPATH=obj
TARGETTYPE=DRIVER
?
DEFINE TEST_WPP to use WPP.
?
C_DEFINES=$(C_DEFINES) -DTEST_WPP=1
?
USE_MAPSYM=1
?
BROWSER_INFO=1
BROWSERFILE=$(TARGETNAME).bsc -n
?
SOURCES=\
??? main.c
?
COMMENT RUN_WPP if want to use DbgPrint instead of WMI
#RUN_WPP=$(SOURCES) -km
?
RUN_WPP=$(SOURCES)????????????????????? ??????????????????????? ??????????? \
??????????? -km?????? ??????????? ??????????? ??????????? ??????????????????????????????????? \
??????????? -func:TestDbgPrint(FLAG,LEVEL,(MSG,...))
???????????
?
/************************************************ main.c *********************************************/
#include <common.h>
?
#ifdef TEST_WPP
#include "main.tmh"
#endif // TEST_WPP
?
#if DBG
ULONG ulDebugFlags = 0;
ULONG ulDebugLevel = 0;
#endif
?
?
NTSTATUS
DriverEntry(
??????????? IN???????? PDRIVER_OBJECT??????? DriverObject,
??????????? IN ??????? PUNICODE_STRING????? RegistryPath
??????????? )
{
??????????? int???????????????????? i;
?
#ifdef TEST_WPP
??????????? WPP_INIT_TRACING(DriverObject, RegistryPath);
#endif // TEST_WPP
?
//????????? DoTraceMessage(DBGF_INIT, "Hello\n");
??????????? TestDbgPrint(DBGF_INIT, 1, ("Hello\n"));
?
??????????? return STATUS_SUCCESS;
}
?
VOID
DriverUnload(
??????????? IN???????? PDRIVER_OBJECT??????? DriverObject
??????????? )
{
?
#ifdef TEST_WPP
??????????? WPP_CLEANUP(DriverObject);
#endif // TEST_WPP
?
??????????? return;
}
?
/ ********common.h /
#include <ntddk.h>
?
#define DBGL_ERROR?????????????????????????? 0x00
#define DBGL_WARNING?????????????????????????????????? 0x01
#define DBGL_FUNCTRACE?????????????????? 0x02
#define DBGL_INFO1???????????????????????????? 0x03
#define DBGL_INFO2???????????????????????????? 0x04
?
#ifdef TEST_WPP
#define WPP_CONTROL_GUIDS??????????????????????? ??????????? ??????????????????????? ??????????? <br>??????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????? <br>??????????? WPP_DEFINE_CONTROL_GUID(McVsTdiCG,???? ??????????????????????????????????? <br>??????????????????????????????????? (A7CDA839, A30D, 4b21, 94A3, 6AF5802E2ABE),?????????? <br>??????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????? <br>??????????????????????????????????? WPP_DEFINE_BIT(DBGF_INIT)? / 0x00000001 */??????????? <br>??????????? )
?
#else
?
#define DBGF_INIT???????????????????????????????? 0x00000001
?
#if DBG
extern ULONG?? ulDebugFlags;
extern ULONG?? ulDebugLevel;
?
#define TestDbgPrint(ulFlags, ulLevel, PrintMsg)?????????????????????????????????????????????????????????????????????????? <br>??????????? if (((ulFlags) & ulDebugFlags) && ((ulLevel) <= ulDebugLevel))??????? <br>??????????? {?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????? <br>??????????????????????? DbgPrint(PrintMsg);??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????? <br>??????????? }
#else
??????????? #define TestDbgPrint(ulFlags, ulLevel, PrintMsg)
#endif // DBG
#endif //TEST_WPP
?
---
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
---
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</ntddk.h></common.h>