21 releases (breaking)

0.61.2 Oct 6, 2025
0.60.2 Jun 12, 2025
0.59.0 Jul 30, 2024
0.52.0 Nov 15, 2023
0.28.0 Nov 17, 2021

#16 in Windows APIs

Download history 14342426/week @ 2026-03-24 21560098/week @ 2026-03-31 23391428/week @ 2026-04-07 25119448/week @ 2026-04-14 26366778/week @ 2026-04-21 28871350/week @ 2026-04-28 32094059/week @ 2026-05-05 35623458/week @ 2026-05-12 32702287/week @ 2026-05-19 32664515/week @ 2026-05-26 30640605/week @ 2026-06-02 29918665/week @ 2026-06-09 28026746/week @ 2026-06-16 28516849/week @ 2026-06-23 24860010/week @ 2026-06-30 25297902/week @ 2026-07-07

111,015,941 downloads per month
Used in 136,328 crates (1,426 directly)

MIT/Apache

18MB
334K SLoC

windows-sys

The windows-sys crate is a zero-overhead fallback for the most demanding situations and primarily where the absolute best compile time is essential. It only includes function declarations (externs), structs, and constants. No convenience helpers, traits, or wrappers are provided.

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

[dependencies.windows-sys]
version = ">=0.59, <=0.61"
features = [
    "Win32_Security",
    "Win32_System_Threading",
    "Win32_UI_WindowsAndMessaging",
]

Using a range instead of the default Caret requirements helps avoid duplicate versions in downstream graphs and improves resolver flexibility.

Make use of any Windows APIs as needed:

use windows_sys::{
    core::*, Win32::Foundation::*, Win32::System::Threading::*, Win32::UI::WindowsAndMessaging::*,
};

unsafe {
    let event = CreateEventW(std::ptr::null(), 1, 0, std::ptr::null());
    SetEvent(event);
    WaitForSingleObject(event, 0);
    CloseHandle(event);

    MessageBoxA(0 as _, s!("Ansi"), s!("Caption"), MB_OK);
    MessageBoxW(0 as _, w!("Wide"), w!("Caption"), MB_OK);
}

Dependencies