pub struct Token;
Expand description
Represents a simple wrapper around Token on Windows.
Implementations§
Source§impl Token
impl Token
Sourcepub fn integrity_level() -> Result<&'static str>
pub fn integrity_level() -> Result<&'static str>
Sourcepub fn has_privilege(name: &str) -> Result<bool>
pub fn has_privilege(name: &str) -> Result<bool>
Checks if the current process token has a specific privilege enabled.
§Parameters
name
- The name of the privilege to check.
§Returns
Ok(true)
if the privilege is found in the token.Ok(false)
if the privilege is not found.Err(anyhow::Error)
if the token query fails.
§Example
ⓘ
if Token::has_privilege("SeImpersonatePrivilege")? {
println!("Privilege is enabled!");
}
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more