Home

Awesome

Windows Kernel-Mode Drivers written in Rust

Join the chat at https://gitter.im/pravic/winapi-kmd-rs

This library is just a proof-of-concept of the windows kernel-mode drivers, which can be written in Rust programming language.

It contains the types, constants and bindings for the Windows Driver Kit with target OS starting from Windows XP (x86/x64).

Getting started

To compile you need the following:

As workaround you can compile drivers as #[crate_type="staticlib"] and link them manually (see examples/03.urandom/build.cmd).

Setting up:

git clone https://github.com/pravic/kmd-env-rs .
git submodule init
git submodule update --recursive

Set the nightly-msvc Rust toolchain for this repository:

rustup override add nightly-i686-msvc

Try to compile example:

cd km\examples\01.minimal\
cargo build --release

By default, it compiles to x86 mode. If you need x64, either change kmd-env-rs/.cargo/config as following:

[build]
target = "x86_64-sys-windows-msvc"
...

or use RUST_TARGET_PATH:

set RUST_TARGET_PATH=C:/path/to/kmd-env-rs/.cargo`
cargo build --release --target i686-sys-windows-msvc
cargo build --release --target x86_64-sys-windows-msvc

Examples

See examples folder with a driver samples and screenshots.

Reference documentation.

Acknowledges

In memory of Four-F - the author of tutorials about kernel mode drivers development in assembly language (2002-2005).