microsoft / Windows-Driver-Frameworks

WDF makes it easy to write high-quality Windows drivers
MIT License
1.26k stars 366 forks source link

WDF with vscode #17

Closed drakbar closed 3 years ago

drakbar commented 3 years ago

Is it possible to build Hello World Windows Driver using visual studio code?

I have both Windows SDK and WDK installed, and I have attempted to configure it to look for msvc and the path for the headers.

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\km\\*",
                "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\wdf\\kmdf\\1.31\\*"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\Program Files (x86)\\Windows Kits\\10\\Tools\\sdv\\bin\\interceptor\\cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++14",
            "intelliSenseMode": "windows-msvc-x64",
            "windowsSdkVersion": "10.0.19041.0"
        }
    ],
    "version": 4
}
baget commented 3 years ago

i you might need to use msbuild then you are compiling the sample .vcproj

HollisTech commented 3 years ago

Yes the best way to do this is to use msbuild, and to use the environment setup scripts supplied for visual studio (or the EWDK) so your build has all the right runtime settings. A powershell or bat script to run the build in the correct environment is easy to implement.