pub struct WindowsToken<'a, Driver>{ /* private fields */ }Expand description
A Windows access token.
An access token records a security principal’s identity and the privileges the kernel grants to it. Every process holds a primary token. Threads may carry an impersonation token that overrides the process token for the duration of an impersonation.
§Implementation Details
Corresponds to _TOKEN.
Implementations§
Source§impl<'a, Driver> WindowsToken<'a, Driver>
impl<'a, Driver> WindowsToken<'a, Driver>
Sourcepub fn new(vmi: VmiState<'a, WindowsOs<Driver>>, va: Va) -> Self
pub fn new(vmi: VmiState<'a, WindowsOs<Driver>>, va: Va) -> Self
Creates a new Windows token object.
Sourcepub fn session_id(&self) -> Result<u32, VmiError>
pub fn session_id(&self) -> Result<u32, VmiError>
Sourcepub fn token_source(&self) -> WindowsTokenSource<'a, Driver>
pub fn token_source(&self) -> WindowsTokenSource<'a, Driver>
Returns an accessor for the token source.
§Implementation Details
Corresponds to _TOKEN.TokenSource.
Sourcepub fn authentication_id(&self) -> Result<WindowsLuid, VmiError>
pub fn authentication_id(&self) -> Result<WindowsLuid, VmiError>
Returns the authentication LUID identifying the logon session.
§Implementation Details
Corresponds to _TOKEN.AuthenticationId.
Sourcepub fn token_id(&self) -> Result<WindowsLuid, VmiError>
pub fn token_id(&self) -> Result<WindowsLuid, VmiError>
Sourcepub fn parent_token_id(&self) -> Result<WindowsLuid, VmiError>
pub fn parent_token_id(&self) -> Result<WindowsLuid, VmiError>
Returns the parent token identifier, or zero for tokens minted from scratch.
§Implementation Details
Corresponds to _TOKEN.ParentTokenId.
Sourcepub fn modified_id(&self) -> Result<WindowsLuid, VmiError>
pub fn modified_id(&self) -> Result<WindowsLuid, VmiError>
Sourcepub fn originating_logon_session(&self) -> Result<WindowsLuid, VmiError>
pub fn originating_logon_session(&self) -> Result<WindowsLuid, VmiError>
Returns the originating logon-session LUID.
§Implementation Details
Corresponds to _TOKEN.OriginatingLogonSession.
Sourcepub fn token_type(&self) -> Result<WindowsTokenType, VmiError>
pub fn token_type(&self) -> Result<WindowsTokenType, VmiError>
Sourcepub fn impersonation_level(&self) -> Result<WindowsImpersonationLevel, VmiError>
pub fn impersonation_level(&self) -> Result<WindowsImpersonationLevel, VmiError>
Sourcepub fn token_flags(&self) -> Result<WindowsTokenFlags, VmiError>
pub fn token_flags(&self) -> Result<WindowsTokenFlags, VmiError>
Sourcepub fn token_in_use(&self) -> Result<bool, VmiError>
pub fn token_in_use(&self) -> Result<bool, VmiError>
Returns whether the token is currently in use.
Only meaningful for primary tokens. Impersonation tokens leave the field clear.
§Implementation Details
Corresponds to _TOKEN.TokenInUse.
Sourcepub fn user_and_group_count(&self) -> Result<u32, VmiError>
pub fn user_and_group_count(&self) -> Result<u32, VmiError>
Returns the number of entries in UserAndGroups. The first
entry is the user SID, the rest are group SIDs.
§Implementation Details
Corresponds to _TOKEN.UserAndGroupCount.
Sourcepub fn restricted_sid_count(&self) -> Result<u32, VmiError>
pub fn restricted_sid_count(&self) -> Result<u32, VmiError>
Returns the number of entries in RestrictedSids.
§Implementation Details
Corresponds to _TOKEN.RestrictedSidCount.
Sourcepub fn primary_group(&self) -> Result<WindowsSid<'a, Driver>, VmiError>
pub fn primary_group(&self) -> Result<WindowsSid<'a, Driver>, VmiError>
Sourcepub fn user_and_groups(
&self,
) -> Result<impl Iterator<Item = Result<WindowsSidAndAttributes<'a, Driver>, VmiError>> + use<'a, Driver>, VmiError>
pub fn user_and_groups( &self, ) -> Result<impl Iterator<Item = Result<WindowsSidAndAttributes<'a, Driver>, VmiError>> + use<'a, Driver>, VmiError>
Returns an iterator over the token’s user SID followed by every group SID. The first entry is always the user, the rest are groups.
§Implementation Details
Walks _TOKEN.UserAndGroups.
Sourcepub fn restricted_sids(
&self,
) -> Result<impl Iterator<Item = Result<WindowsSidAndAttributes<'a, Driver>, VmiError>> + use<'a, Driver>, VmiError>
pub fn restricted_sids( &self, ) -> Result<impl Iterator<Item = Result<WindowsSidAndAttributes<'a, Driver>, VmiError>> + use<'a, Driver>, VmiError>
Returns an iterator over the token’s restricted SIDs. Empty when the token is not a restricted token.
§Implementation Details
Walks _TOKEN.RestrictedSids.
Sourcepub fn privileges_present(&self) -> Result<u64, VmiError>
pub fn privileges_present(&self) -> Result<u64, VmiError>
Returns the _SEP_TOKEN_PRIVILEGES.Present bitmap. Each set bit
is a privilege whose LUID LowPart equals the bit position.
§Implementation Details
Corresponds to _TOKEN.Privileges.Present.
Sourcepub fn privileges_enabled(&self) -> Result<u64, VmiError>
pub fn privileges_enabled(&self) -> Result<u64, VmiError>
Returns the _SEP_TOKEN_PRIVILEGES.Enabled bitmap.
§Implementation Details
Corresponds to _TOKEN.Privileges.Enabled.
Sourcepub fn privileges_enabled_by_default(&self) -> Result<u64, VmiError>
pub fn privileges_enabled_by_default(&self) -> Result<u64, VmiError>
Returns the _SEP_TOKEN_PRIVILEGES.EnabledByDefault bitmap.
§Implementation Details
Corresponds to _TOKEN.Privileges.EnabledByDefault.
Sourcepub fn privileges(
&self,
) -> Result<impl Iterator<Item = WindowsTokenPrivilege>, VmiError>
pub fn privileges( &self, ) -> Result<impl Iterator<Item = WindowsTokenPrivilege>, VmiError>
Returns an iterator over privileges present in this token.
Trait Implementations§
Source§impl<'a, Driver> From<WindowsToken<'a, Driver>> for WindowsObject<'a, Driver>
impl<'a, Driver> From<WindowsToken<'a, Driver>> for WindowsObject<'a, Driver>
Source§fn from(value: WindowsToken<'a, Driver>) -> Self
fn from(value: WindowsToken<'a, Driver>) -> Self
Source§impl<'a, Driver> FromWindowsObject<'a, Driver> for WindowsToken<'a, Driver>
impl<'a, Driver> FromWindowsObject<'a, Driver> for WindowsToken<'a, Driver>
Source§fn from_object(
object: WindowsObject<'a, Driver>,
) -> Result<Option<Self>, VmiError>
fn from_object( object: WindowsObject<'a, Driver>, ) -> Result<Option<Self>, VmiError>
WindowsObject into a specific object type.Source§impl<Driver> VmiVa for WindowsToken<'_, Driver>
impl<Driver> VmiVa for WindowsToken<'_, Driver>
Auto Trait Implementations§
impl<'a, Driver> !RefUnwindSafe for WindowsToken<'a, Driver>
impl<'a, Driver> !Send for WindowsToken<'a, Driver>
impl<'a, Driver> !Sync for WindowsToken<'a, Driver>
impl<'a, Driver> !UnwindSafe for WindowsToken<'a, Driver>
impl<'a, Driver> Freeze for WindowsToken<'a, Driver>
impl<'a, Driver> Unpin for WindowsToken<'a, Driver>
impl<'a, Driver> UnsafeUnpin for WindowsToken<'a, Driver>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.