agentleFS
MicrosoftKnown publishermicrosoft/windows-drivers-rs/AGENTS.md

windows-drivers-rs

AGENTS.md1.9k starsChanged 8 months agoApache-2.0View on GitHub

Rust crates for developing Windows Drivers (WDM, KMDF, UMDF). The workspace only includes the library crates under crates/; examples and tests are excluded from the root workspace because each requires a different WDK configuration (only one WDK config per Cargo build graph is supported). Crate layering (bottom → top): Key design patterns: Requires an eWDK developer prompt and LLVM 17 on PATH for bindgen. cargo-expand v1.0.85 is required for macrotest/trybuild-based tests. Switching between stable/nightly toolchains requires deleting cached test artifacts…

Trending

Quiet since July.about the whole repository

Dec 2025: 2 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/windows-drivers-rs repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/windows-drivers-rs

The biggest 5 of 34 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 34

Talked about on GitHub, Bluesky and Hacker News (34 times).

On GitHub · 26

21 more on GitHub

On Bluesky · 6

1 more on Bluesky

On Hacker News · 2

  • In this repositoryOne other file it gives its agents.

The file

Files
AGENTS.md

Copilot Instructions for windows-drivers-rs

Overview

Rust crates for developing Windows Drivers (WDM, KMDF, UMDF). The workspace only includes the library crates under crates/; examples and tests are excluded from the root workspace because each requires a different WDK configuration (only one WDK config per Cargo build graph is supported).

Architecture

Crate layering (bottom → top):

  1. wdk-build — Build-time crate. Configures cargo build scripts for WDK binding generation, linker settings, and cargo-make task generation. Also contains the rust-driver-makefile.toml that downstream driver packages extend.
  2. wdk-sys (no_std) — Raw FFI bindings auto-generated by bindgen, plus hand-written macro re-implementations where bindgen fails. Uses custom cfg flags (driver_model__driver_type, driver_model__kmdf_version_major, etc.) set by wdk-build to conditionally compile for WDM/KMDF/UMDF.
  3. wdk-macros — Proc-macro crate consumed only through wdk-sys re-exports. Versioned in lockstep with wdk-sys (enforced by CI version-checks.yaml).
  4. wdk — Safe idiomatic Rust wrappers around wdk-sys. Conditionally no_std for WDM/KMDF; std-capable for UMDF.
  5. wdk-alloc — Global allocator (WdkAllocator) for kernel-mode crates needing alloc.
  6. wdk-panic — Default panic handlers for WDK binaries.
  7. cargo-wdk — Cargo subcommand for building and packaging driver projects.

Key design patterns:

  • Conditional compilation via custom cfg flags (not Cargo features) distinguishes driver types. These flags are emitted by wdk-build during the build script phase.
  • wdk-sys has feature flags for optional WDK subsystem bindings: gpio, hid, spb, storage, usb, parallel-ports.
  • Some crates expose a nightly feature for functionality gated behind unstable Rust features.

Build, Test, and Lint

Requires an eWDK developer prompt and LLVM 17 on PATH for bindgen.

Build

cargo build --locked --all-features

Test

# Full suite
cargo test --locked --all-features

# Single test
cargo test --locked --all-features <test_name>

# Nightly-only tests
cargo +nightly test --locked --features nightly

cargo-expand v1.0.85 is required for macrotest/trybuild-based tests. Switching between stable/nightly toolchains requires deleting cached test artifacts under target/*/tests/ to avoid stale trybuild/macrotest caches.

Lint

# Clippy (warnings are denied via RUSTFLAGS=-Dwarnings)
cargo clippy --locked --all-features --all-targets -- -D warnings

# Formatting (requires nightly for unstable rustfmt options)
cargo +nightly fmt --all -- --check

# TOML formatting
taplo fmt --check --diff

# Cargo.toml dependency sorting
cargo sort -w -g -n --check

# Spelling
typos

# Security audit
cargo audit --deny warnings

# Unused dependencies
cargo machete --skip-target-dir

# Docs build
cargo doc --locked --all-features

Pre-commit (runs everything)

cargo make wdk-pre-commit-flow

Code Conventions

  • Unsafe discipline: unsafe_op_in_unsafe_fn is forbidden at workspace level. Every unsafe block must have exactly one unsafe operation (multiple_unsafe_ops_per_block = "forbid") and a // SAFETY: comment (undocumented_unsafe_blocks = "forbid"). Unnecessary safety docs are also forbidden.
  • FFI naming: Bindings in wdk-sys retain their original C names and style (e.g., PascalCase functions). Safe Rust wrappers in wdk follow Rust naming conventions (RFC 430).
  • Formatting: rustfmt uses nightly-only unstable options (see rustfmt.toml). Import grouping is StdExternalCrate, granularity is Crate.
  • Lints: Clippy all is deny, pedantic/nursery/cargo are warn. Most workspace members inherit [lints] workspace = true; wdk-sys, wdk-build, wdk-macros, and cargo-wdk define their own [lints] tables instead (Cargo currently does not support both inheriting workspace lints and selectively overriding them per crate).
  • Edition: 2024, MSRV 1.91.0, resolver v3.
  • Static CRT: Enabled globally via .cargo/config.toml (-C target-feature=+crt-static).
  • Spelling: typos is configured in .typos.toml; Windows API identifiers are allowlisted rather than using file-level excludes.
  • TOML: taplo uses CRLF line endings (see taplo.toml).
  • Versioning: wdk-macros and wdk-sys must have identical versions (exact = dependency). This is enforced by the version-checks.yaml CI workflow.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.