none
Any sample for Wpp trace for win32 application? RRS feed

  • Question

  • I am looking for sample / example for win32 app which uses wpp trace. I want to use wpp for trace usermode win32 application. 

    Any pointers.

    Thursday, September 19, 2019 10:43 AM

Answers

  • Visual Studio doesn't support WPP for applications, so put the following XML into a file named WPP.targets in your solution directory and follow the directions in the comments

    <?xml version="1.0" encoding="utf-8"?>
    
    <!--
    
    This file causes TraceWPP to be run against the source files in the project prior to being
    compiled. This file is imported by the .vcxproj project file (look at the end, in the ExtensionTargets section),
    which should look something like this:
    
      <ImportGroup Label="ExtensionTargets">
    	<Import Project="$(SolutionDir)\WPP.targets" />
      </ImportGroup>
    
    -->
    
    <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
     <PropertyGroup>
          <ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.tmh</ExtensionsToDeleteOnClean>
      </PropertyGroup>
    
      <ItemGroup>
          <CoreCppClean Include="@(CoreCppClean);$(ProjectDir)">
              <FilePatternsToDelete>*.tmh</FilePatternsToDelete>
         </CoreCppClean>
      </ItemGroup>
    
      <ItemGroup>
        <TraceWppSources Include="@(ClCompile)" Exclude="stdafx.cpp" />
      </ItemGroup>
    
      <Target Name="TraceWpp" BeforeTargets="ClCompile" Inputs="@(TraceWppSources)" Outputs="@(TraceWppSources -> '%(Filename).tmh')">
        <Message Importance="High" Text="Creating TMH files for: @(TraceWppSources, ' '), using $(ProjectDir)..\Global\WPP_Tracing.h"/>
        <Exec Command="cd &quot;$(ProjectDir)&quot;" />
        <Exec Command="&quot;$(FrameworkSdkDir)bin\$(WindowsTargetPlatformVersion)\$(Platform)\TraceWPP.exe&quot; -dll -scan:&quot;$(ProjectDir)..\Global\WPP_Tracing.h&quot; -cfgdir:&quot;$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\wppconfig\rev1&quot; -odir:&quot;$(IntDir)\&quot; @(TraceWppSources, ' ')" />
        <Message Importance="High" Text="TMH files created"/>
      </Target>
      
    </Project>

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, September 19, 2019 4:09 PM
    Moderator
  • https://social.msdn.microsoft.com/Forums/en-US/385396b2-95b1-4138-b8de-25be916fe432/wpp-software-tracing-for-an-application-in-an-user-mode?forum=wdk

    With kind regards

    Thursday, September 19, 2019 2:09 PM

All replies

  • https://social.msdn.microsoft.com/Forums/en-US/385396b2-95b1-4138-b8de-25be916fe432/wpp-software-tracing-for-an-application-in-an-user-mode?forum=wdk

    With kind regards

    Thursday, September 19, 2019 2:09 PM
  • Visual Studio doesn't support WPP for applications, so put the following XML into a file named WPP.targets in your solution directory and follow the directions in the comments

    <?xml version="1.0" encoding="utf-8"?>
    
    <!--
    
    This file causes TraceWPP to be run against the source files in the project prior to being
    compiled. This file is imported by the .vcxproj project file (look at the end, in the ExtensionTargets section),
    which should look something like this:
    
      <ImportGroup Label="ExtensionTargets">
    	<Import Project="$(SolutionDir)\WPP.targets" />
      </ImportGroup>
    
    -->
    
    <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
     <PropertyGroup>
          <ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.tmh</ExtensionsToDeleteOnClean>
      </PropertyGroup>
    
      <ItemGroup>
          <CoreCppClean Include="@(CoreCppClean);$(ProjectDir)">
              <FilePatternsToDelete>*.tmh</FilePatternsToDelete>
         </CoreCppClean>
      </ItemGroup>
    
      <ItemGroup>
        <TraceWppSources Include="@(ClCompile)" Exclude="stdafx.cpp" />
      </ItemGroup>
    
      <Target Name="TraceWpp" BeforeTargets="ClCompile" Inputs="@(TraceWppSources)" Outputs="@(TraceWppSources -> '%(Filename).tmh')">
        <Message Importance="High" Text="Creating TMH files for: @(TraceWppSources, ' '), using $(ProjectDir)..\Global\WPP_Tracing.h"/>
        <Exec Command="cd &quot;$(ProjectDir)&quot;" />
        <Exec Command="&quot;$(FrameworkSdkDir)bin\$(WindowsTargetPlatformVersion)\$(Platform)\TraceWPP.exe&quot; -dll -scan:&quot;$(ProjectDir)..\Global\WPP_Tracing.h&quot; -cfgdir:&quot;$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\wppconfig\rev1&quot; -odir:&quot;$(IntDir)\&quot; @(TraceWppSources, ' ')" />
        <Message Importance="High" Text="TMH files created"/>
      </Target>
      
    </Project>

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, September 19, 2019 4:09 PM
    Moderator