28 breaking releases

0.59.0 Jan 7, 2025
0.58.0 Jul 3, 2024
0.57.0 Jun 7, 2024
0.55.0 Mar 6, 2024
0.0.0 Oct 18, 2021

#100 in Operating systems

Download history 16291/week @ 2024-10-21 14069/week @ 2024-10-28 12619/week @ 2024-11-04 14178/week @ 2024-11-11 10930/week @ 2024-11-18 10939/week @ 2024-11-25 11104/week @ 2024-12-02 11515/week @ 2024-12-09 12241/week @ 2024-12-16 6678/week @ 2024-12-23 7488/week @ 2024-12-30 20010/week @ 2025-01-06 40403/week @ 2025-01-13 30863/week @ 2025-01-20 37206/week @ 2025-01-27 40192/week @ 2025-02-03

150,057 downloads per month
Used in 101 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-targets]
version = "0.53"

[dev-dependencies.windows-bindgen]
version = "0.59"

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