private void UpdateTokenData() { UserGroup user = _token.GetUser(); txtUsername.Text = user.GetName(); txtUserSid.Text = user.Sid.ToString(); TokenType tokentype = _token.GetTokenType(); txtTokenType.Text = _token.GetTokenType().ToString(); TokenLibrary.TokenImpersonationLevel implevel = _token.GetImpersonationLevel(); txtImpLevel.Text = implevel.ToString(); txtTokenId.Text = FormatLuid(_token.GetTokenId()); txtModifiedId.Text = FormatLuid(_token.GetModifiedId()); txtAuthId.Text = FormatLuid(_token.GetAuthenticationId()); if (Enum.IsDefined(typeof(TokenLibrary.TokenIntegrityLevel), _token.GetTokenIntegrityLevel())) { comboBoxIL.SelectedItem = _token.GetTokenIntegrityLevel(); comboBoxILForDup.SelectedItem = _token.GetTokenIntegrityLevel(); } else { comboBoxIL.Text = _token.GetTokenIntegrityLevel().ToString(); comboBoxILForDup.Text = _token.GetTokenIntegrityLevel().ToString(); } txtSessionId.Text = _token.GetSessionId().ToString(); txtSourceName.Text = _token.GetSourceName(); txtSourceId.Text = FormatLuid(_token.GetSourceId()); TokenElevationType evtype = _token.GetElevationType(); txtElevationType.Text = evtype.ToString(); txtIsElevated.Text = _token.IsElevated().ToString(); txtOriginLoginId.Text = FormatLuid(_token.GetTokenOriginId()); btnLinkedToken.Enabled = evtype != TokenElevationType.Default; UpdateGroupList(); txtPrimaryGroup.Text = _token.GetPrimaryGroup().GetName(); txtOwner.Text = _token.GetDefaultOwner().GetName(); RawAcl defdacl = _token.GetDefaultDacl(); if (defdacl != null) { foreach (GenericAce ace in defdacl) { KnownAce kace = ace as KnownAce; if (kace != null) { UserGroup group = new UserGroup(kace.SecurityIdentifier, GroupFlags.None); ListViewItem item = new ListViewItem(group.GetName()); uint mask = (uint)(GenericAccessRights.GenericAll | GenericAccessRights.GenericExecute | GenericAccessRights.GenericRead | GenericAccessRights.GenericWrite); string maskstr; if (((uint)kace.AccessMask & ~mask) != 0) { maskstr = String.Format("0x{0:X08}", kace.AccessMask); } else { GenericAccessRights generic = (GenericAccessRights)kace.AccessMask; maskstr = generic.ToString(); } item.SubItems.Add(maskstr); item.SubItems.Add(kace.AceFlags.ToString()); item.SubItems.Add(kace.AceType.ToString()); listViewDefDacl.Items.Add(item); } } } else { listViewDefDacl.Items.Add("No Default DACL"); } listViewDefDacl.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listViewDefDacl.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); if (_token.IsRestricted()) { PopulateGroupList(listViewRestrictedSids, _token.GetRestrictedSids()); } else { tabControlMain.TabPages.Remove(tabPageRestricted); } if (_token.IsAppContainer()) { PopulateGroupList(listViewCapabilities, _token.GetCapabilities()); txtACNumber.Text = _token.GetAppContainerNumber().ToString(); txtPackageSid.Text = _token.GetPackageSid().GetName(); } else { tabControlMain.TabPages.Remove(tabPageAppContainer); } txtUIAccess.Text = _token.IsUIAccess().ToString(); txtSandboxInert.Text = _token.IsSandboxInert().ToString(); bool virtAllowed = _token.IsVirtualizationAllowed(); txtVirtualizationAllowed.Text = virtAllowed.ToString(); if (virtAllowed) { txtVirtualizationEnabled.Text = _token.IsVirtualizationEnabled().ToString(); } else { txtVirtualizationEnabled.Text = "N/A"; } txtMandatoryILPolicy.Text = _token.GetIntegrityLevelPolicy().ToString(); UpdatePrivileges(); }