windows_elevate/
lib.rs

1//! **windows-elevate** is a Windows-only crate, it provides utility two functions:
2//! - `check_elevated()` is used to determine whether the current process is running as elevated.
3//! - `elevate()` is used to elevate the current process permissions.
4//!
5//! ## Example
6//! ```rust
7//! use windows_elevate::{check_elevated, elevate};
8//!
9//!fn test_elevate() {
10//!    let is_elevated = check_elevated().expect("Failed to call check_elevated");
11//!
12//!    if !is_elevated {
13//!        elevate().expect("Failed to elevate");
14//!        return;
15//!    }
16//!    // From here, it's the new elevated process
17//!}
18//! ```
19//!
20//!
21#![cfg(windows)]
22
23mod check_elevated;
24mod elevate;
25
26pub use check_elevated::check_elevated;
27pub use elevate::elevate;
28pub use windows_result;