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

Home NTDEV

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: https://www.osr.com/osr-learning-library/


WPP cpp.tmh file has size zero after moigrating driver project from VS2017 to VS2022

I run into strange problem, when after moving Driver (KMDF, filter driver) project from VS2017 to VS2022 xxx.cpp.tmh files are generated, but has size zero. :(

I tried to compare vcxproj, bot I don't find the difference in WPP setions.

Where problem may be?

Thanks for help & Regards,
Michael Grabelkovsky.

Comments

  • I found the problem.
    Instead of
    #include "DeviceFilter.cpp.tmh"
    I wrote
    #include "DeviceFilter.tmh"
    And compilation is OK!?!

    What is interesting:
    1. Both files are generated. But DeviceFilter.cpp.tmh has size zero. On VS2017 compiler including "DeviceFilter.cpp.tmh" worked for me.
    2. I have kernel static lib which is compiled with Platform Toolset WindowsKernelModeDriver10.0. And for it tmh is generated as usual XXX.cpp.tmh.

    I really don't understand what happened. and would like any comments from experts. :)

    I have other driver which I will need shift on VS2022 and I will check on it too...

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

    My TMH files have always been Foo.TMH, so not sure where the other ones are coming from...Are these "clean" project files (i.e. not upgraded)?

    -scott
    OSR

  • Michael_GrabelkovskyMichael_Grabelkovsky Member Posts: 48
    edited November 2023

    It was upgraded project.
    But! I build project from template and found that it reference on tmh without "cpp":
    #include "DeviceFilter.tmh"

    I repeat this 'trick', deleted "cpp" in my project and it was success!
    It's very strange, but works stable.
    And ... does not work for one other driver which I try to move on VS2022 right now... :(((

    Post edited by Michael_Grabelkovsky on
  • Scott,
    I found and fixed the problem.
    There is exist dependens from order inside the Property Page -> C/C++ -> Additional Include Directories list!

    I moved directory where TMHs are generated in the 1st place in it and it helps!?!
    Currently TMHs (without ".cpp" in the name!) are generated normally.
    Don't ask me the reason for!
    By the way, inside VS2017 was not so, this dir was in the middle of the list and it works (with #include "DeviceFilter.cpp.tmh" !)

    I'd very like, if somebody from experts describe the reasons for this problem.
    Probably it is documented inside MSDN?
    Or it's new bug Microsoft? :(

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

    My experience is that a cleanly generated vcxproj will generate .TMH files in $(IntDir) and there's no need to mess with the include directories.

    Definitely recommend taking this time to just generate new project files and not bother with the upgrade process. It's a PITA, but also a good opportunity to revisit the build and do any cleanup. Better to spend time on that than fighting with bugginess in the upgrade process.

    -scott
    OSR

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!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online