Skip to main content

elevate_ti/security/
privilege.rs

1//! Administrative security privilege definitions.
2
3use windows::core::{PCWSTR, w};
4
5/// Administrative Windows security privileges.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum Privilege {
8    /// Debug programs (`SeDebugPrivilege`).
9    Debug,
10    /// Impersonate a client after authentication (`SeImpersonatePrivilege`).
11    Impersonate,
12}
13
14impl Privilege {
15    pub(crate) const fn as_pcwstr(self) -> PCWSTR {
16        match self {
17            Self::Debug => w!("SeDebugPrivilege"),
18            Self::Impersonate => w!("SeImpersonatePrivilege"),
19        }
20    }
21
22    pub(crate) const fn as_str(self) -> &'static str {
23        match self {
24            Self::Debug => "SeDebugPrivilege",
25            Self::Impersonate => "SeImpersonatePrivilege",
26        }
27    }
28}