building windows driver with cmake and wdk from cmdline

TL;DR

FindWdk

Having a clean and lightweight enviroment is what everyone wants. Building drivers on windows is supported via visual studio with cmake support. But having to open the bloated ui might not be on everyone’s mind.

I really like FindWDK often which is CMake module for building drivers with WDK.

Folder structure

│   .gitignore
│   .gitmodules
│   CMakeLists.txt
│   LICENSE
│   README.md
│
├───build
│       .ninja_deps
│       .ninja_log
│
├───FindWDK
│   │   .appveyor.yml
│   │   .editorconfig
│   │   .gitignore
│   │   LICENSE
│   │   README.md
│   │
│   ├───cmake
│   │       FindWdk.cmake
│   │
|   | **snipped**
│
└───simple
        CMakeLists.txt
        simple.c

cmake file preset at root directory

root cmake file

cmake file for simple driver

simple cmake file

Build steps

  • Launch vcvars64.bat for VS2019

    %comspec% /k “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat”

  • mkdir build
  • cd build
  • cmake -G Ninja ..
  • cmake –build . –config Debug –target simple

build steps

NOTE: The above steps used ninja the other option should work fine as well.

Repo for a simple driver using FindWdk

simple driver

2021

memory tracking through nt!PoolHitTag

8 minute read

Let’s explore how nt!PoolHitTag can be useful for while tracking memory issues. Along with useful windbg command like !pool, !poolfind, !verifier etc.

Lost registers during kernel debugging Win7

less than 1 minute read

When kernel debugging an old target like Windows 7 after a long time using windbg. I noticed not being able to see the registers in register pane. That was k...

Back to Top ↑