Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 3.28 KB

README.md

File metadata and controls

42 lines (33 loc) · 3.28 KB

windows-kernel-rs

Note: this is still work in progress!

This is a Windows kernel framework in Rust that consists of windows-kernel-sys, a crate that provides low-level unsafe bindings generated using bindgen, and windows-kernel-rs, a crate that provides safe abstractions in Rust on top.

Features

To give you an idea of whether these crates are useful to you, here is a non-exhaustive overview of the features that are currently supported and that are more or less planned:

  • KernelModule to provide safe entry and exit points to your driver.
  • Batteries included: panic handler, global allocator, etc.
  • Rust error handling using Result.
  • Device API to quickly set up with devices with a trait to provide the various callbacks.
  • Support for reading from and writing to devices.
  • Support for handling device I/O controls.
  • Basic safe abstraction on top of I/O Request Packets (IRPs) using Rust ownership to model their lifetimes.
  • Basic support for Memory Descriptor Lists (MDLs).
  • Version API to query the current version of Microsoft Windows.
  • Affinity API to run closures on a specific CPU or all CPUs in the system.
  • Device API
  • FastMutex (similar to Mutex) based on the FAST_MUTEX API.
  • PushLock (similar to RwLock) based on the EX_PUSH_LOCK API.
  • Abstraction for processes and process attachments to execute code in the context of a process.
  • Abstraction for sections.
  • Basic x86-64 intrinsics.
  • More complete model of IRP handling.
  • Support for x86 and AArch64.

Articles

Note: this framework may progress faster than I can keep my articles up-to-date. They may currently be due for a bit of a rewrite to reflect some of the changes that made it into this repository since I have written the articles.

In addition, there are articles that cover implementing Windows kernel drivers in Rust from the ground up, including corresponding examples provided as part of this repository:

  1. Prerequisites
  2. Hello World - 02-hello-world
  3. Generating Bindings - 03-generating-bindings
  4. Safe Framework - 04-safe-framework
  5. Creating Devices - 05-creating-devices - user/05-creating-devices
  6. Reading and Writing - 06-reading-and-writing - user/06-reading-and-writing
  7. I/O Controls - 07-io-controls - user/07-io-controls