Expand description
§nt_token
Memory-safe, ergonomic helpers for working with Windows access tokens and security identifiers (SIDs) in Rust.
This crate builds on the windows crate and deliberately mirrors the PathBuf / Path API shape:
OwnedToken– owns aHANDLEand releases it automatically onDrop.Token– zero-cost borrowed view (#[repr(transparent)]); most high-level methods live here.Sid– owned, immutable SID with parsing, formatting and account-lookup helpers.
§Quick start
use nt_token::{OwnedToken, Sid};
use windows::Win32::Security::TOKEN_QUERY;
let token = OwnedToken::from_current_process(TOKEN_QUERY)?;
println!("elevated = {}", token.is_elevated()?);
println!("integrity level = {}", token.integrity_level()?);
for g in token.groups()? {
println!("group → {g}");
}Structs§
- Group
- Token group entry – SID plus its attribute flags.
- Owned
Token - RAII owner for a Windows access‑token
HANDLE. - Privilege
- Token privilege (immutable snapshot).
- Sid
- Owned and immutable security identifier.
- Token
- Borrowed, zero‑cost view of a token
HANDLE(likePath).