29 breaking releases

0.60.0 Feb 21, 2025
0.58.0 Jul 3, 2024
0.55.0 Mar 6, 2024
0.52.0 Nov 15, 2023
0.0.0 Oct 18, 2021

#27 in Windows APIs

Download history 11081/week @ 2024-11-19 11164/week @ 2024-11-26 10612/week @ 2024-12-03 12153/week @ 2024-12-10 11230/week @ 2024-12-17 6508/week @ 2024-12-24 8278/week @ 2024-12-31 24697/week @ 2025-01-07 38178/week @ 2025-01-14 33563/week @ 2025-01-21 36255/week @ 2025-01-28 41939/week @ 2025-02-04 37260/week @ 2025-02-11 40034/week @ 2025-02-18 39731/week @ 2025-02-25 28734/week @ 2025-03-04

152,312 downloads per month
Used in 96 crates (5 directly)

MIT/Apache

8.5MB
9K SLoC

Contains (DOS exe, 24MB) default/Windows.Win32.winmd, (Windows exe, 7.5MB) default/Windows.winmd, (DOS exe, 1MB) default/Windows.Wdk.winmd

Code generator for Windows metadata

The windows-bindgen crate automatically generates Rust bindings from Windows metadata.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-link]
version = "0.1"

[build-dependencies.windows-bindgen]
version = "0.60"

Generate Rust bindings in a build script as follows:

fn main() {
    let args = [
        "--out",
        "src/bindings.rs",
        "--flat",
        "--filter",
        "GetTickCount",
    ];

    windows_bindgen::bindgen(args);
}

And then use the bindings as follows:

mod bindings;

fn main() {
    unsafe {
        println!("{}", bindings::GetTickCount());
    }
}

Dependencies