<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 3, 2017 at 5:53 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><br>
><br>
> Add ability to produce ETW (Event Tracing for Windows) to release<br>
> version of the driver to be able to record binary traces in case<br>
> of problem in customer environment for further analysis.<br>
> Logging of debug build is not changed.<br>
><br>
> Signed-off-by: Yuri Benditovich <<a href="mailto:yuri.benditovich@daynix.com">yuri.benditovich@daynix.com</a>><br>
> ---<br>
> qxldod/QxlDod.cpp | 4 ++++<br>
> qxldod/driver.cpp | 9 +++++++++<br>
> qxldod/driver.h | 5 +++++<br>
> qxldod/qxldod.vcxproj | 5 +++++<br>
> 4 files changed, 23 insertions(+)<br>
><br>
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp<br>
> index b97301a..fc29c9f 100755<br>
> --- a/qxldod/QxlDod.cpp<br>
> +++ b/qxldod/QxlDod.cpp<br>
> @@ -12,6 +12,10 @@<br>
> #include "qxldod.h"<br>
> #include "qxl_windows.h"<br>
> #include "compat.h"<br>
> +#if !DBG<br>
> +#include "WppTrace.h"<br>
> +#include "qxldod.tmh"<br>
> +#endif<br>
><br>
> #pragma code_seg("PAGE")<br>
><br>
> diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp<br>
> index 1ff2abb..d33b345 100755<br>
> --- a/qxldod/driver.cpp<br>
> +++ b/qxldod/driver.cpp<br>
> @@ -10,6 +10,10 @@<br>
><br>
> #include "driver.h"<br>
> #include "QxlDod.h"<br>
> +#if !DBG<br>
> +#include "WppTrace.h"<br>
> +#include "driver.tmh"<br>
> +#endif<br>
<br>
</div></div>Why not putting these lines in driver.h? All debug defines are already there.<br></blockquote><div><br></div><div>I'll move WppTrace.h to common header</div><div>Include directive for TMF file should be in the source file, according to MSFT guidelines, otherwise there are compilation problems</div><div><a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/adding-wpp-macros-to-a-trace-provider">https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/adding-wpp-macros-to-a-trace-provider</a><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-"><br>
><br>
> #pragma code_seg(push)<br>
> #pragma code_seg("INIT")<br>
> @@ -20,6 +24,7 @@<br>
> //<br>
><br>
> int nDebugLevel = TRACE_LEVEL_ERROR;<br>
> +static DRIVER_OBJECT* driverObject;<br>
><br>
> // registry-based configuration is intended to be manual only<br>
> // for VSync suppression during support and troubleshooting<br>
> @@ -62,6 +67,9 @@ DriverEntry(<br>
> {<br>
> PAGED_CODE();<br>
><br>
> + WPP_INIT_TRACING(<wbr>pDriverObject, pRegistryPath);<br>
> + driverObject = pDriverObject;<br>
> +<br>
> DbgPrint(TRACE_LEVEL_FATAL, ("---> KMDOD build on on %s %s\n", __DATE__,<br>
> __TIME__));<br>
><br>
> RTL_OSVERSIONINFOW versionInfo;<br>
> @@ -157,6 +165,7 @@ DodUnload(VOID)<br>
> {<br>
> PAGED_CODE();<br>
> DbgPrint(TRACE_LEVEL_<wbr>INFORMATION, ("<--> %s\n", __FUNCTION__));<br>
> + WPP_CLEANUP(driverObject);<br>
<br>
</span>From MS documentation<br>
<br>
A pointer to the driver object that represents the driver. Starting with Windows XP, if the driver is not using Inflight Trace Recorder (IFR), this parameter is not used and can be set to NULL.<br>
<br>
so we can avoid to save driverObject and just pass NULL.<br></blockquote><div><br></div><div>OK</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
> }<br>
><br>
> NTSTATUS<br>
> diff --git a/qxldod/driver.h b/qxldod/driver.h<br>
> index a70b0e7..626ac24 100755<br>
> --- a/qxldod/driver.h<br>
> +++ b/qxldod/driver.h<br>
> @@ -272,3 +272,8 @@ void DebugPrint(int level, const char *fmt, ...);<br>
> #else<br>
> #define QXL_ASSERT_CHK(exp) {}<br>
> #endif<br>
> +<br>
> +#if DBG<br>
> +#define WPP_INIT_TRACING(driver, regpath)<br>
> +#define WPP_CLEANUP(driver)<br>
> +#endif<br>
> diff --git a/qxldod/qxldod.vcxproj b/qxldod/qxldod.vcxproj<br>
> index 1766a61..15e36d9 100755<br>
> --- a/qxldod/qxldod.vcxproj<br>
> +++ b/qxldod/qxldod.vcxproj<br>
> @@ -185,6 +185,8 @@<br>
> <ClCompile><br>
> <AdditionalIncludeDirectories><wbr>%(<wbr>AdditionalIncludeDirectories);<wbr>$(DDK_INC_PATH);$(SDK_INC_<wbr>PATH);.\Include</<wbr>AdditionalIncludeDirectories><br>
> <WarningLevel>Level3</<wbr>WarningLevel><br>
> + <WppScanConfigurationData><wbr>WppTrace.h</<wbr>WppScanConfigurationData><br>
> + <WppEnabled>true</WppEnabled><br>
> </ClCompile><br>
> <PostBuildEvent><br>
> <Command>Inf2Cat /driver:$(OutDir) /os:8_X86,6_3_X86</Command><br>
> @@ -255,6 +257,8 @@<br>
> <ClCompile><br>
> <AdditionalIncludeDirectories><wbr>%(<wbr>AdditionalIncludeDirectories);<wbr>$(DDK_INC_PATH);$(SDK_INC_<wbr>PATH);.\Include</<wbr>AdditionalIncludeDirectories><br>
> <WarningLevel>Level3</<wbr>WarningLevel><br>
> + <WppScanConfigurationData><wbr>WppTrace.h</<wbr>WppScanConfigurationData><br>
> + <WppEnabled>true</WppEnabled><br>
> </ClCompile><br>
> <PostBuildEvent><br>
> <Command>Inf2Cat /driver:$(OutDir)<br>
> /os:8_X64,Server8_X64,Server6_<wbr>3_X64,6_3_X64</Command><br>
> @@ -277,6 +281,7 @@<br>
> <ClInclude Include="driver.h" /><br>
> <ClInclude Include="QxlDod.h" /><br>
> <ClInclude Include="resource.h" /><br>
> + <ClInclude Include="WppTrace.h" /><br>
> </ItemGroup><br>
> <ItemGroup><br>
> <ClCompile Include="BaseObject.cpp" /><br>
<br>
</div></div><span class="gmail-HOEnZb"><font color="#888888">Frediano<br>
</font></span></blockquote></div><br></div></div>