public TokenPrivilege(string systemName, string privilege, bool enabled) { LUID luid; BOOL rc = Win32.LookupPrivilegeValue(systemName, privilege, out luid); Win32.CheckCall(rc); _luid = new Luid(luid); _attributes = (enabled ? PrivilegeAttributes.Enabled : 0); }
internal TokenStatistics(IntPtr ptr) { TOKEN_STATISTICS ts = (TOKEN_STATISTICS)Marshal.PtrToStructure(ptr, typeof(TOKEN_STATISTICS)); _tokenId = new Luid(ts.TokenId); _authenticationId = new Luid(ts.AuthenticationId); _expirationTime = new DateTime(ts.ExpirationTime); _tokenType = ts.TokenType; _impersonationLevel = ts.ImpersonationLevel; _dynamicCharged = ts.DynamicCharged; _dynamicAvailable = ts.DynamicAvailable; _groupCount = ts.GroupCount; _privilegeCount = ts.PrivilegeCount; _modifiedId = new Luid(ts.ModifiedId); }
internal TokenPrivilege(MemoryMarshaler m) { LUID_AND_ATTRIBUTES la = (LUID_AND_ATTRIBUTES)m.ParseStruct(typeof(LUID_AND_ATTRIBUTES)); _luid = new Luid(la.Luid); _attributes = (PrivilegeAttributes)la.Attributes; }
internal TokenSource(IntPtr ptr) { TOKEN_SOURCE ts = (TOKEN_SOURCE)Marshal.PtrToStructure(ptr, typeof(TOKEN_SOURCE)); _name = new string(ts.Name); _luid = new Luid(ts.Indentifier); }