microsoft / Windows-driver-samples

This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.
Microsoft Public License
6.92k stars 4.93k forks source link

Visual Studio 2022 with WDK and the WDK templates installed #1030

Closed bundgaard closed 1 month ago

bundgaard commented 1 year ago

Hi, I do not really know where to put this issue, but following the download-the-wdk guide for Visual Studio 2022 and when asked to download the VSIX with the Visual Studio templates, they seem to be broken.

The UMDF V2 sample includes #include <device.tmh> which seems to be a typo. Also, it doesn't compile as the TRACE_DEVICE, TRACE_LEVEL_ERROR, and WDF_POINTER_TYPE_DEVICE_CONTEXT DeviceGetContext(...) has errors.

Is it something the team for this project can take and push forward or answer back with a way to contact you guys to get this fixed?

Many thanks for considering my request.

FrankHan1652 commented 1 year ago

Having the same issue. Followed the suggestions in [https://stackoverflow.com/questions/42872409/cannot-compile-visual-studios-template-for-umdf-usb-drivers] but nothing went better;

barisunsalhn commented 10 months ago

Did you find solution?

11philip22 commented 8 months ago

I have the same issue. Plz fix, Microsoft

daiplusplus commented 6 months ago

Go to your Project Properties > Wpp Tracing > Run Wpp Tracing - set it to "Yes" and the solution should build fine.

The "missing" device.tmh file is actually generated by the build itself.

epmpub commented 3 months ago

Go to your Project Properties > Wpp Tracing > Run Wpp Tracing - set it to "Yes" and the solution should build fine.

The "missing" device.tmh file is actually generated by the build itself.

i can't find the option.....

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.10.0

daiplusplus commented 3 months ago

@epmpub

It should look like this:

image


Note that these extra VC Project Properties pages don't appear until-and-unless you have the Windows DDK installed and your .vcxproj is a driver (KMDF/UMDF_ project. It needs special imports etc.

Sqrtx2 commented 2 months ago

@daiplusplus

@epmpub

It should look like this:

image

Note that these extra VC Project Properties pages don't appear until-and-unless you have the Windows DDK installed and your .vcxproj is a driver (KMDF/UMDF_ project. It needs special imports etc.

I have this setting enabled but I still have the same issue, what could be other potential fixes?

daiplusplus commented 1 month ago

@Sqrtx2 What is the actual build output you get?

Sqrtx2 commented 1 month ago

@Sqrtx2 What is the actual build output you get? @daiplusplus

I have already managed to fix my issue (forgot to edit my reply, sorry). I fixed it by installing a few older versions of spectre mitigations.

HydraDragonAntivirus commented 1 month ago

It didn't show me VC Project Properties pages even if it's KMDF project. Edit: Install this https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk MSVC v143 - VS 2022 C++ ARM64/ARM64EC Spectre-mitigated libs (Latest) MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest) C++ ATL for latest v143 build tools with Spectre Mitigations (ARM64/ARM64EC) C++ ATL for latest v143 build tools with Spectre Mitigations (x86 & x64) C++ MFC for latest v143 build tools with Spectre Mitigations (ARM64/ARM64EC) C++ MFC for latest v143 build tools with Spectre Mitigations (x86 & x64) Edit: Still didn't work. Edit: https://www.youtube.com/watch?v=n463QJ4cjsU Watch this and do all steps.