Code Monkey home page Code Monkey logo

findwdk's Introduction

FindWDK

CMake module for building drivers with Windows Development Kit (WDK) Build status

Introduction

FindWDK makes it possible to build kernel drivers and kernel libraries with Windows Development Kit (WDK) and CMake.

Requirements:

  • WDK10
  • Visual Studio 2015 and higher
  • CMake 3.0 and higher

Usage

Add FindWDK to the module search path and call find_package:

list(APPEND CMAKE_MODULE_PATH "<path_to_FindWDK>")
find_package(WDK REQUIRED)

FindWDK will search for the installed Windows Development Kit (WDK) and expose commands for creating kernel drivers and kernel libraries. Also the following variables will be defined:

  • WDK_FOUND -- if false, do not try to use WDK
  • WDK_ROOT -- where WDK is installed
  • WDK_VERSION -- the version of the selected WDK
  • WDK_WINVER -- the WINVER used for kernel drivers and libraries (default value is 0x0601 and can be changed per target or globally)

Kernel driver

The following command adds a kernel driver target called <name> to be built from the source files listed in the command invocation:

wdk_add_driver(<name> 
    [EXCLUDE_FROM_ALL]
    [KMDF <kmdf_version>]
    [WINVER <winver_version>]
    source1 [source2 ...]
    )

Options:

  • EXCLUDE_FROM_ALL -- exclude from the default build target
  • KMDF <kmdf_version> -- use KMDF and set KMDF version
  • WINVER <winver_version> -- use specific WINVER version

Example:

wdk_add_driver(KmdfCppDriver 
    KMDF 1.15 
    WINVER 0x0602
    Main.cpp
    )

Kernel library

The following command adds a kernel library target called <name> to be built from the source files listed in the command invocation:

wdk_add_library(<name> [STATIC | SHARED]
    [EXCLUDE_FROM_ALL]
    [KMDF <kmdf_version>]
    [WINVER <winver_version>]
    source1 [source2 ...]
    )

Options:

  • EXCLUDE_FROM_ALL -- exclude from the default build target
  • KMDF <kmdf_version> -- use KMDF and set KMDF version
  • WINVER <winver_version> -- use specific WINVER version
  • STATIC or SHARED -- specify the type of library to be created

Example:

wdk_add_library(KmdfCppLib STATIC 
    KMDF 1.15
    WINVER 0x0602
    KmdfCppLib.h 
    KmdfCppLib.cpp
    )

Linking to WDK libraries

FindWDK creates imported targets for all WDK libraries. The naming pattern is WDK::<UPPERCASED_LIBNAME>. Linking a minifilter driver to FltMgr.lib is shown below:

target_link_libraries(MinifilterCppDriver WDK::FLTMGR)

Samples

Take a look at the samples folder to see how WMD and KMDF drivers and libraries are built.

License

FindWDK is licensed under the OSI-approved 3-clause BSD license. You can freely use it in your commercial or opensource software.

Version history

Version 1.0.1 (13 Mar 2018)

  • New: Add ability to link to WDK libraries
  • New: Add MinifilterCppDriver sample
  • Fix: W4 warnings in C version of the driver, add missing /W4 /WX for C compiler

Version 1.0.0 (03 Feb 2018)

  • Initial public release

findwdk's People

Contributors

sergiusthebest avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.