Can I use WPP to trace application rather than driver

If so, how to configure in vc2010?
Thanks.

On 20-Sep-2011 11:23, Marvin(Fan) Zhang wrote:

If so, how to configure in vc2010?
Thanks.

WPP works for applications; the example below has been posted by Ivan
Brugiolo quite long ago.
This example is for WDK build. It can be converted to VC++2010,
maybe the new VS11 & SOURCES to sln converter can grok it too.

– pa

------------- SOURCES -----------
TARGETNAME=testWPP
TARGETTYPE=PROGRAM
TARGETPATH=obj
UMENTRY=wmain
UMTYPE=console

TARGETLIBS=\
$(SDK_LIB_PATH)\ntdll.lib \
$(SDK_LIB_PATH)\kernel32.lib

INCLUDES=$(DDK_INC_PATH);

USE_MSVCRT=1
USE_NATIVE_EH=ASYNC
USE_STL=1
STL_VER=70
BUFFER_OVERFLOW_CHECKS=NTDLL
MSC_WARNING_LEVEL=/W3 /WX
C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

SOURCES=testWPP.cpp

RUN_WPP= $(SOURCES) -scan:trace.h

_NT_TARGET_VERSION = $(_NT_TARGET_VERSION_WINXP)

------------------ trace.h -----------------------

#ifndef trace_h
#define trace_h

#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID(TestWPPGuid,(11223344, AAAA, BBBB, CCCC, \
DDFFFF112233), \
WPP_DEFINE_BIT(MY_ERROR) \
WPP_DEFINE_BIT(MY_WARN) \
WPP_DEFINE_BIT(MY_NOISE))

// begin_wpp config
//
// FUNC TestWPPLog(LEVEL,MSG,…);
//
// end_wpp

#endif /* trace_h */

------------------------ testwpp.cpp ----------------------

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <strsafe.h>
#include <memory.h>

#include “trace.h”

//Following is needed because of some mess in levels vs. flags +pa
#define Verbose MY_NOISE //defined in trace.h
#define Error MY_ERROR

#if 1 //+pa enable debug of the wpp stuff. see the .tmh for details.
// This allows to duplicate traces (to ODS, dbgprint…) :
#define WPP_DEBUG printf(“\n”),printf
// This enables internal debug spew of wpp:
#define WppDebug(a,b) printf(“\n”),printf b
#endif // enable wpp debug

#include “testWPP.tmh” // file created by WPP

class TestClass {
private:
BYTE Array[256];
public:
TestClass();
virtual ~TestClass();
};

TestClass::TestClass(){
TestWPPLog(Verbose,“%s”, FUNCTION );
}

TestClass::~TestClass(){
TestWPPLog(Error,“%s”, FUNCTION );
}

int __cdecl wmain( int argc, WCHAR **argv)
{

#ifdef WppDebug
printf(“debug messages from WPP will be printed\n”);
#endif

#ifdef WPP_DEBUG
printf(“traces will be echoed to printf\n”);
#endif

WPP_INIT_TRACING( L"UmWppTest" );

TestWPPLog(Verbose,“WPP test - begin log”);

TestClass * p = new TestClass;

delete p;

TestWPPLog(Error,“WPP test - end log”);

WPP_CLEANUP();

return 0;
}
----------------- end------------------</memory.h></strsafe.h></stdlib.h></stdio.h></windows.h>

Thanks Pevel! On more question, how to convert sources to vs2010 sln?

On Tue, Sep 20, 2011 at 7:46 PM, Pavel A wrote:

> On 20-Sep-2011 11:23, Marvin(Fan) Zhang wrote:
>
>> If so, how to configure in vc2010?
>> Thanks.
>>
>
> WPP works for applications; the example below has been posted by Ivan
> Brugiolo quite long ago.
> This example is for WDK build. It can be converted to VC++2010,
> maybe the new VS11 & SOURCES to sln converter can grok it too.
>
> – pa
>
>
> ------------- SOURCES -----------
> TARGETNAME=testWPP
> TARGETTYPE=PROGRAM
> TARGETPATH=obj
> UMENTRY=wmain
> UMTYPE=console
>
> TARGETLIBS=<br>> $(SDK_LIB_PATH)\ntdll.lib <br>> $(SDK_LIB_PATH)\kernel32.lib
>
> INCLUDES=$(DDK_INC_PATH);
>
> USE_MSVCRT=1
> USE_NATIVE_EH=ASYNC
> USE_STL=1
> STL_VER=70
> BUFFER_OVERFLOW_CHECKS=NTDLL
> MSC_WARNING_LEVEL=/W3 /WX
> C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
>
> SOURCES=testWPP.cpp
>
> RUN_WPP= $(SOURCES) -scan:trace.h
>
> _NT_TARGET_VERSION = $(_NT_TARGET_VERSION_WINXP)
>
>
> ------------------ trace.h -----------------------
>
> #ifndef trace_h
> #define trace_h
>
> #define WPP_CONTROL_GUIDS <br>> WPP_DEFINE_CONTROL_GUID(TestWPPGuid,(11223344, AAAA, BBBB, CCCC, <br>> DDFFFF112233), <br>> WPP_DEFINE_BIT(MY_ERROR) <br>> WPP_DEFINE_BIT(MY_WARN) <br>> WPP_DEFINE_BIT(MY_NOISE))
>
> // begin_wpp config
> //
> // FUNC TestWPPLog(LEVEL,MSG,…);
> //
> // end_wpp
>
> #endif /
trace_h */
>
> ------------------------ testwpp.cpp ----------------------
>
> #include <windows.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <strsafe.h>
> #include <memory.h>
>
> #include “trace.h”
>
> //Following is needed because of some mess in levels vs. flags +pa
> #define Verbose MY_NOISE //defined in trace.h
> #define Error MY_ERROR
>
> #if 1 //+pa enable debug of the wpp stuff. see the .tmh for details.
> // This allows to duplicate traces (to ODS, dbgprint…) :
> #define WPP_DEBUG printf(“\n”),printf
> // This enables internal debug spew of wpp:
> #define WppDebug(a,b) printf(“\n”),printf b
> #endif // enable wpp debug
>
> #include “testWPP.tmh” // file created by WPP
>
> class TestClass {
> private:
> BYTE Array[256];
> public:
> TestClass();
> virtual ~TestClass();
> };
>
> TestClass::TestClass(){
> TestWPPLog(Verbose,“%s”, **FUNCTION );
> }
>
> TestClass::~TestClass(){
> TestWPPLog(Error,“%s”, **FUNCTION );
> }
>
>
> int __cdecl wmain( int argc, WCHAR
*argv)
> {
>
> #ifdef WppDebug
> printf(“debug messages from WPP will be printed\n”);
> #endif
>
> #ifdef WPP_DEBUG
> printf(“traces will be echoed to printf\n”);
> #endif
>
> WPP_INIT_TRACING( L"UmWppTest" );
>
> TestWPPLog(Verbose,“WPP test - begin log”);
>
> TestClass * p = new TestClass;
>
> delete p;
>
> TestWPPLog(Error,“WPP test - end log”);
>
> WPP_CLEANUP();
>
> return 0;
> }
> ----------------- end------------------
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.**cfm?name=ListServerhttp:
></http:></memory.h></strsafe.h></stdlib.h></stdio.h></windows.h>

You would have to do it by hand for vs2010

d

debt from my phone


From: Marvin(Fan) Zhang
Sent: Tuesday, September 20, 2011 7:01 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Can I use WPP to trace application rather than driver

Thanks Pevel! On more question, how to convert sources to vs2010 sln?

On Tue, Sep 20, 2011 at 7:46 PM, Pavel A > wrote:
On 20-Sep-2011 11:23, Marvin(Fan) Zhang wrote:
If so, how to configure in vc2010?
Thanks.

WPP works for applications; the example below has been posted by Ivan Brugiolo quite long ago.
This example is for WDK build. It can be converted to VC++2010,
maybe the new VS11 & SOURCES to sln converter can grok it too.

– pa

------------- SOURCES -----------
TARGETNAME=testWPP
TARGETTYPE=PROGRAM
TARGETPATH=obj
UMENTRY=wmain
UMTYPE=console

TARGETLIBS=<br> $(SDK_LIB_PATH)\ntdll.lib <br> $(SDK_LIB_PATH)\kernel32.lib

INCLUDES=$(DDK_INC_PATH);

USE_MSVCRT=1
USE_NATIVE_EH=ASYNC
USE_STL=1
STL_VER=70
BUFFER_OVERFLOW_CHECKS=NTDLL
MSC_WARNING_LEVEL=/W3 /WX
C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

SOURCES=testWPP.cpp

RUN_WPP= $(SOURCES) -scan:trace.h

_NT_TARGET_VERSION = $(_NT_TARGET_VERSION_WINXP)

------------------ trace.h -----------------------

#ifndef trace_h
#define trace_h

#define WPP_CONTROL_GUIDS <br> WPP_DEFINE_CONTROL_GUID(TestWPPGuid,(11223344, AAAA, BBBB, CCCC, <br> DDFFFF112233), <br> WPP_DEFINE_BIT(MY_ERROR) <br> WPP_DEFINE_BIT(MY_WARN) <br> WPP_DEFINE_BIT(MY_NOISE))

// begin_wpp config
//
// FUNC TestWPPLog(LEVEL,MSG,…);
//
// end_wpp

#endif /* trace_h */

------------------------ testwpp.cpp ----------------------

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <strsafe.h>
#include <memory.h>

#include “trace.h”

//Following is needed because of some mess in levels vs. flags +pa
#define Verbose MY_NOISE //defined in trace.h
#define Error MY_ERROR

#if 1 //+pa enable debug of the wpp stuff. see the .tmh for details.
// This allows to duplicate traces (to ODS, dbgprint…) :
#define WPP_DEBUG printf(“\n”),printf
// This enables internal debug spew of wpp:
#define WppDebug(a,b) printf(“\n”),printf b
#endif // enable wpp debug

#include “testWPP.tmh” // file created by WPP

class TestClass {
private:
BYTE Array[256];
public:
TestClass();
virtual ~TestClass();
};

TestClass::TestClass(){
TestWPPLog(Verbose,“%s”, FUNCTION );
}

TestClass::~TestClass(){
TestWPPLog(Error,“%s”, FUNCTION );
}

int __cdecl wmain( int argc, WCHAR **argv)
{

#ifdef WppDebug
printf(“debug messages from WPP will be printed\n”);
#endif

#ifdef WPP_DEBUG
printf(“traces will be echoed to printf\n”);
#endif

WPP_INIT_TRACING( L"UmWppTest" );

TestWPPLog(Verbose,“WPP test - begin log”);

TestClass * p = new TestClass;

delete p;

TestWPPLog(Error,“WPP test - end log”);

WPP_CLEANUP();

return 0;
}
----------------- end------------------


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</memory.h></strsafe.h></stdlib.h></stdio.h></windows.h>

sorry, I mean how to convert sources to sln

On Tue, Sep 20, 2011 at 10:19 PM, Doron Holan wrote:

> You would have to do it by hand for vs2010
>
> d
>
> debt from my phone
> ------------------------------
> From: Marvin(Fan) Zhang
> Sent: Tuesday, September 20, 2011 7:01 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Can I use WPP to trace application rather than driver
>
> Thanks Pevel! On more question, how to convert sources to vs2010 sln?
>
> On Tue, Sep 20, 2011 at 7:46 PM, Pavel A wrote:
>
>> On 20-Sep-2011 11:23, Marvin(Fan) Zhang wrote:
>>
>>> If so, how to configure in vc2010?
>>> Thanks.
>>>
>>
>> WPP works for applications; the example below has been posted by Ivan
>> Brugiolo quite long ago.
>> This example is for WDK build. It can be converted to VC++2010,
>> maybe the new VS11 & SOURCES to sln converter can grok it too.
>>
>> – pa
>>
>>
>> ------------- SOURCES -----------
>> TARGETNAME=testWPP
>> TARGETTYPE=PROGRAM
>> TARGETPATH=obj
>> UMENTRY=wmain
>> UMTYPE=console
>>
>> TARGETLIBS=<br>>> $(SDK_LIB_PATH)\ntdll.lib <br>>> $(SDK_LIB_PATH)\kernel32.lib
>>
>> INCLUDES=$(DDK_INC_PATH);
>>
>> USE_MSVCRT=1
>> USE_NATIVE_EH=ASYNC
>> USE_STL=1
>> STL_VER=70
>> BUFFER_OVERFLOW_CHECKS=NTDLL
>> MSC_WARNING_LEVEL=/W3 /WX
>> C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE
>>
>> SOURCES=testWPP.cpp
>>
>> RUN_WPP= $(SOURCES) -scan:trace.h
>>
>> _NT_TARGET_VERSION = $(_NT_TARGET_VERSION_WINXP)
>>
>>
>> ------------------ trace.h -----------------------
>>
>> #ifndef trace_h
>> #define trace_h
>>
>> #define WPP_CONTROL_GUIDS <br>>> WPP_DEFINE_CONTROL_GUID(TestWPPGuid,(11223344, AAAA, BBBB, CCCC, <br>>> DDFFFF112233), <br>>> WPP_DEFINE_BIT(MY_ERROR) <br>>> WPP_DEFINE_BIT(MY_WARN) <br>>> WPP_DEFINE_BIT(MY_NOISE))
>>
>> // begin_wpp config
>> //
>> // FUNC TestWPPLog(LEVEL,MSG,…);
>> //
>> // end_wpp
>>
>> #endif /
trace_h */
>>
>> ------------------------ testwpp.cpp ----------------------
>>
>> #include <windows.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <strsafe.h>
>> #include <memory.h>
>>
>> #include “trace.h”
>>
>> //Following is needed because of some mess in levels vs. flags +pa
>> #define Verbose MY_NOISE //defined in trace.h
>> #define Error MY_ERROR
>>
>> #if 1 //+pa enable debug of the wpp stuff. see the .tmh for details.
>> // This allows to duplicate traces (to ODS, dbgprint…) :
>> #define WPP_DEBUG printf(“\n”),printf
>> // This enables internal debug spew of wpp:
>> #define WppDebug(a,b) printf(“\n”),printf b
>> #endif // enable wpp debug
>>
>> #include “testWPP.tmh” // file created by WPP
>>
>> class TestClass {
>> private:
>> BYTE Array[256];
>> public:
>> TestClass();
>> virtual ~TestClass();
>> };
>>
>> TestClass::TestClass(){
>> TestWPPLog(Verbose,“%s”, **FUNCTION );
>> }
>>
>> TestClass::~TestClass(){
>> TestWPPLog(Error,“%s”, **FUNCTION );
>> }
>>
>>
>> int __cdecl wmain( int argc, WCHAR
*argv)
>> {
>>
>> #ifdef WppDebug
>> printf(“debug messages from WPP will be printed\n”);
>> #endif
>>
>> #ifdef WPP_DEBUG
>> printf(“traces will be echoed to printf\n”);
>> #endif
>>
>> WPP_INIT_TRACING( L"UmWppTest" );
>>
>> TestWPPLog(Verbose,“WPP test - begin log”);
>>
>> TestClass * p = new TestClass;
>>
>> delete p;
>>
>> TestWPPLog(Error,“WPP test - end log”);
>>
>> WPP_CLEANUP();
>>
>> return 0;
>> }
>> ----------------- end------------------
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.**cfm?name=ListServerhttp:
>>
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:></memory.h></strsafe.h></stdlib.h></stdio.h></windows.h>

I understood you the first time . For vs2010 there is no conversion tool to move from build to msbuild

d

debt from my phone


From: Marvin(Fan) Zhang
Sent: Tuesday, September 20, 2011 7:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Can I use WPP to trace application rather than driver

sorry, I mean how to convert sources to sln

On Tue, Sep 20, 2011 at 10:19 PM, Doron Holan > wrote:
You would have to do it by hand for vs2010

d

debt from my phone
________________________________
From: Marvin(Fan) Zhang
Sent: Tuesday, September 20, 2011 7:01 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Can I use WPP to trace application rather than driver

Thanks Pevel! On more question, how to convert sources to vs2010 sln?

On Tue, Sep 20, 2011 at 7:46 PM, Pavel A > wrote:
On 20-Sep-2011 11:23, Marvin(Fan) Zhang wrote:
If so, how to configure in vc2010?
Thanks.

WPP works for applications; the example below has been posted by Ivan Brugiolo quite long ago.
This example is for WDK build. It can be converted to VC++2010,
maybe the new VS11 & SOURCES to sln converter can grok it too.

– pa

------------- SOURCES -----------
TARGETNAME=testWPP
TARGETTYPE=PROGRAM
TARGETPATH=obj
UMENTRY=wmain
UMTYPE=console

TARGETLIBS=<br> $(SDK_LIB_PATH)\ntdll.lib <br> $(SDK_LIB_PATH)\kernel32.lib

INCLUDES=$(DDK_INC_PATH);

USE_MSVCRT=1
USE_NATIVE_EH=ASYNC
USE_STL=1
STL_VER=70
BUFFER_OVERFLOW_CHECKS=NTDLL
MSC_WARNING_LEVEL=/W3 /WX
C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE

SOURCES=testWPP.cpp

RUN_WPP= $(SOURCES) -scan:trace.h

NT_TARGET_VERSION = $(NT_TARGET_VERSION_WINXP)

------------------ trace.h -----------------------

#ifndef__trace_h
#define
trace_h


#define WPP_CONTROL_GUIDS <br> WPP_DEFINE_CONTROL_GUID(TestWPPGuid,(11223344, AAAA, BBBB, CCCC, <br> DDFFFF112233), <br> WPP_DEFINE_BIT(MY_ERROR) <br> WPP_DEFINE_BIT(MY_WARN) <br> WPP_DEFINE_BIT(MY_NOISE))

// begin_wpp config
//
// FUNC TestWPPLog(LEVEL,MSG,…);
//
// end_wpp

#endif /trace_h/

------------------------ testwpp.cpp ----------------------

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <strsafe.h>
#include <memory.h>

#include “trace.h”

//Following is needed because of some mess in levels vs. flags +pa
#define Verbose MY_NOISE //defined in trace.h
#define Error MY_ERROR

#if 1 //+pa enable debug of the wpp stuff. see the .tmh for details.
// This allows to duplicate traces (to ODS, dbgprint…) :
#define WPP_DEBUG printf(“\n”),printf
// This enables internal debug spew of wpp:
#define WppDebug(a,b) printf(“\n”),printf b
#endif // enable wpp debug

#include “testWPP.tmh” // file created by WPP

class TestClass {
private:
BYTE Array[256];
public:
TestClass();
virtual ~TestClass();
};

TestClass::TestClass(){
TestWPPLog(Verbose,“%s”,FUNCTION);
}

TestClass::~TestClass(){
TestWPPLog(Error,“%s”,FUNCTION);
}

int__cdecl wmain( int argc, WCHAR **argv)
{

#ifdef WppDebug
printf(“debug messages from WPP will be printed\n”);
#endif

#ifdef WPP_DEBUG
printf(“traces will be echoed to printf\n”);
#endif

WPP_INIT_TRACING( L"UmWppTest" );

TestWPPLog(Verbose,“WPP test - begin log”);

TestClass * p = new TestClass;

delete p;

TestWPPLog(Error,“WPP test - end log”);

WPP_CLEANUP();

return 0;
}
----------------- end------------------


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</memory.h></strsafe.h></stdlib.h></stdio.h></windows.h>

Take a look at this MSDN website which tells clearly what you need.

http://msdn.microsoft.com/en-us/library/ff546870(v=VS.85).aspx

cool, it works! Thanks!

On Wed, Sep 21, 2011 at 5:52 PM, wrote:

> Take a look at this MSDN website which tells clearly what you need.
>
> http://msdn.microsoft.com/en-us/library/ff546870(v=VS.85).aspx
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 21-Sep-2011 12:52, xxxxx@hotmail.com wrote:

Take a look at this MSDN website which tells clearly what you need.

http://msdn.microsoft.com/en-us/library/ff546870(v=VS.85).aspx

Hmm. this page advices to “configure Visual Studio to use the Windows
Driver Kit (WDK) compiler.”

This obviously should be “to use TraceWpp.exe”. The compiler still is
the one from VC++.

-pa