Crate windows_elevate

Crate windows_elevate 

Source
Expand description

windows-elevate is a Windows-only crate, it provides utility two functions:

  • check_elevated() is used to determine whether the current process is running as elevated.
  • elevate() is used to elevate the current process permissions.

§Example

use windows_elevate::{check_elevated, elevate};

fn test_elevate() {
   let is_elevated = check_elevated().expect("Failed to call check_elevated");

   if !is_elevated {
       elevate().expect("Failed to elevate");
       return;
   }
   // From here, it's the new elevated process
}

Re-exports§

pub use windows_result;

Functions§

check_elevated
Returns windows_result::Result, indicating whether the current process is elevated.
elevate
This function spawns a new elevated process for the current executable file