Skip to content

Commit

Permalink
Enable WPP Event Tracing for both the WSK library and the test driver
Browse files Browse the repository at this point in the history
The WPP Event Tracing can be disabled which means return to the good old DbgPrintEx routine. To disable WPP, the following steps need to be done:
- commenting the line `#define EVENT_TRACING` in project's trace.h file,
- setting the "Run Wpp Tracing" option in project settings to No.

Signed-off-by: Martin Drab <[email protected]>
  • Loading branch information
Martin Drab committed May 18, 2023
1 parent f4500c4 commit 034396d
Show file tree
Hide file tree
Showing 16 changed files with 414 additions and 21 deletions.
8 changes: 8 additions & 0 deletions viosock/inc/debug-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#define __DEBUG_UTILS_H__


#include <Evntrace.h>
#include "trace.h"
#include "..\..\virtio\kdebugprint.h"

#ifndef EVENT_TRACING


#if defined(DBG) || defined(_DEBUG)

Expand Down Expand Up @@ -81,3 +87,5 @@


#endif

#endif
3 changes: 3 additions & 0 deletions viosock/viosock-wsk-test/test-messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <bcrypt.h>
#include "..\inc\debug-utils.h"
#include "test-messages.h"
#ifdef EVENT_TRACING
#include "test-messages.tmh"
#endif


static ULONG _randSeed;
Expand Down
117 changes: 117 additions & 0 deletions viosock/viosock-wsk-test/trace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* This file contains trace and debugging related definitions
*
* Copyright (c) 2019 Virtuozzo International GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of their contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/



#define EVENT_TRACING

#if !defined(EVENT_TRACING)

extern ULONG driverDebugFlags;
extern int driverDebugLevel;

#if !defined(TRACE_LEVEL_NONE)
#define TRACE_LEVEL_NONE 0
#define TRACE_LEVEL_CRITICAL 1
#define TRACE_LEVEL_FATAL 1
#define TRACE_LEVEL_ERROR 2
#define TRACE_LEVEL_WARNING 3
#define TRACE_LEVEL_INFORMATION 4
#define TRACE_LEVEL_VERBOSE 5
#define TRACE_LEVEL_RESERVED6 6
#define TRACE_LEVEL_RESERVED7 7
#define TRACE_LEVEL_RESERVED8 8
#define TRACE_LEVEL_RESERVED9 9
#endif


//
// Define Debug Flags
//
#define DBG_VIOWSK 0x00000001

#define DBG_TEST 0x00000001

#define TraceEvents(level, flags, message, ...) \
if (level > driverDebugLevel || !bDebugPrint || !(driverDebugFlags & flags)) {} \
else VirtioDebugPrintProc(message, __VA_ARGS__)

#define WPP_INIT_TRACING(a,b)
#define WPP_CLEANUP(DriverObject)

#else
#define WPP_CHECK_FOR_NULL_STRING

//
// Define the tracing flags.
//
// Tracing GUID - C2D7F82F-CE5F-4408-8A37-8B9FE2B3D52E
//

#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID(WskTraceGuid,(13b9cfb4,b962,4b43,b59d,92242fab52e3), \
WPP_DEFINE_BIT(DBG_VIOWSK) /* bit 0 = 0x00000001 */ \
) \
WPP_DEFINE_CONTROL_GUID(WskTestTraceGuid,(46e3298a,70b1,49c6,b9fd,8691980b7adf), \
WPP_DEFINE_BIT(DBG_TEST) /* bit 0 = 0x00000001 */ \
)


#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
WPP_LEVEL_LOGGER(flag)

#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
(WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)

#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)

//
// This comment block is scanned by the trace preprocessor to define our
// Trace function.
//
// begin_wpp config
//
// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
// FUNC DEBUG_ENTER_FUNCTION{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=DBG_TEST}(MSG, ...);
// FUNC DEBUG_ENTER_FUNCTION_NO_ARGS{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=DBG_TEST}();
// FUNC DEBUG_EXIT_FUNCTION{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=DBG_TEST}(MSG, ...);
// FUNC DEBUG_EXIT_FUNCTION_VOID{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=DBG_TEST}();
// FUNC DEBUG_ERROR{LEVEL=TRACE_LEVEL_ERROR, FLAGS=DBG_TEST}(MSG, ...);
// FUNC DEBUG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=DBG_TEST}(MSG, ...);
// FUNC DEBUG_TRACE{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=DBG_TEST}(MSG, ...);
// FUNC DEBUG_INFO{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=DBG_TEST}(MSG, ...);
//
// end_wpp
//

#endif
121 changes: 109 additions & 12 deletions viosock/viosock-wsk-test/viosock-wsk-test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,63 +234,159 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Debug|Win32'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Release|Win32'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Debug|x64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Release|x64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Debug|ARM64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Release|ARM64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|ARM64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8 Release|ARM64'">
<Link>
<AdditionalDependencies>cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
<AdditionalDependencies>Ntstrsafe.lib;cng.lib;%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies>
</Link>
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>trace.h</WppScanConfigurationData>
<PreprocessorDefinitions>TRACE_PROJECT_NAME=VioWskTest;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<DriverSign>
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
</DriverSign>
</ItemDefinitionGroup>
<ItemGroup>
<FilesToPackage Include="$(TargetPath)" />
Expand All @@ -306,6 +402,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="test-messages.h" />
<ClInclude Include="trace.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
3 changes: 3 additions & 0 deletions viosock/viosock-wsk-test/viosock-wsk-test.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
<ClInclude Include="test-messages.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="trace.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
11 changes: 10 additions & 1 deletion viosock/viosock-wsk-test/viosockwsk-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include "..\inc\vio_sockets.h"
#include "..\sys\public.h"
#include "test-messages.h"

#ifdef EVENT_TRACING
#include "viosockwsk-test.tmh"
#endif


#define LISTEN_PORT_MIN 1337
Expand Down Expand Up @@ -688,6 +690,7 @@ DriverUnload(
VioWskDeregister(&_vioWskRegistration);
VioWskModuleFinit();
IoDeleteDevice(_shutdownDeviceObject);
WPP_CLEANUP(DriverObject);

DEBUG_EXIT_FUNCTION_VOID();
return;
Expand All @@ -704,6 +707,7 @@ DriverEntry(
NTSTATUS Status = STATUS_UNSUCCESSFUL;
DEBUG_ENTER_FUNCTION("DriverObject=0x%p; RegistryPath=\"%wZ\"", DriverObject, RegistryPath);

WPP_INIT_TRACING(DriverObject, RegistryPath);
Status = IoCreateDevice(DriverObject, 0, NULL, FILE_DEVICE_UNKNOWN, 0, FALSE, &Device);
if (!NT_SUCCESS(Status))
goto Exit;
Expand Down Expand Up @@ -756,6 +760,11 @@ DriverEntry(
if (Device)
IoDeleteDevice(Device);
Exit:
if (!NT_SUCCESS(Status))
{
WPP_CLEANUP(DriverObject);
}

DEBUG_EXIT_FUNCTION("0x%x", Status);
return Status;
}
Loading

0 comments on commit 034396d

Please sign in to comment.