Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

Adding a WPP trace logging support to storport miniport driver is not working

psdpsd Member Posts: 2

I am working on adding a WPP trace logging support to a virtual storport miniport driver, but it is not working in my case only for this type of driver. For other kernel mode drivers (WDF, WDM), WPP trace logging support is working fine, and I can see the traces coming in TraceView.

Links referred:

I referred to the above links and done the following implementation:
1. Added trace.h header file which includes=>
• WPP_CONTROL_GUIDS macro is defined
• Flags and levels macros are defined
• TraceEvents macro is defined

  1. -scan:".\header\Trace.h" is added

  2. For storage miniport driver:
    • “stortrce.h” is included
    • -gen:{km-StorDefault.tpl}*.tmh is added

  3. Trace.h and the generated .tmh files are included in the source code files.

My case is, the support is working fine for other type of drivers when added, but it is not working for my virtual storport miniport driver. I am not getting any traces in the TraceView. Can you please tell me, am I missing anything for the virtual storport miniport drivers; Or, provide any links that I can refer, to correct my implementation.


  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,590

    I've done this successfully in physical StorPort miniports but not a virtual one (yet...will be soon though for a project).

    Are you calling WPP_INIT_TRACING with an initialized STORAGE_TRACE_INIT_INFO?


  • psdpsd Member Posts: 2

    Global Variable:
    PVOID TraceContext = NULL;

    Yes, I am calling WPP_INIT_TRACING with an initialized STORAGE_TRACE_INIT_INFO as given below in the DriverEntry() function:

    memset(&initInfo, 0, sizeof(STORAGE_TRACE_INIT_INFO));
    initInfo.Size = sizeof(STORAGE_TRACE_INIT_INFO);
    initInfo.NumErrorLogRecords = 5;
    initInfo.TraceCleanupRoutine = WppCleanupRoutine;
    initInfo.DriverObject = DriverObject;
    initInfo.TraceContext = NULL;
    WPP_INIT_TRACING(DriverObject, Argument2, &initInfo);
    if (initInfo.TraceContext != NULL)
        TraceContext = initInfo.TraceContext;

    Also, have the cleanup routine as given below:

    VOID WppCleanupRoutine(PVOID arg1)
    TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, " WppCleanupRoutine\n");

    if (TraceContext)
        WPP_CLEANUP(NULL, TraceContext);


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 19-23 June 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online