// Decompiled with JetBrains decompiler // Type: Microsoft.InfoCards.SystemIdentity // Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // MVID: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B // Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.exe using Microsoft.InfoCards.Diagnostics; using System; using System.Globalization; using System.Runtime.InteropServices; using System.Security.Principal; namespace Microsoft.InfoCards { internal sealed class SystemIdentity : IDisposable { private bool m_isDisposed; private WindowsIdentity m_identity; private object m_sync; public static readonly IdentityReference LsaIdentityReference = (IdentityReference) new SecurityIdentifier("SY"); public SystemIdentity(bool throwIfAlreadySystem) { this.m_sync = new object(); WindowsIdentity current = WindowsIdentity.GetCurrent(); if (current.IsSystem && throwIfAlreadySystem) throw InfoCardTrace.ThrowHelperError((Exception) new InvalidOperationException(SR.GetString("UserIdentityEqualSystemNotSupported"))); if (!current.IsSystem) { this.m_identity = current; if (NativeMethods.RevertToSelf()) return; InfoCardTrace.Assert(false, "Identity management failure"); } else InfoCardTrace.Assert(null == this.m_identity, "m_identity should be null when we are system and throwIfAlreadySystem == false"); } void IDisposable.Dispose() { if (this.m_isDisposed) return; lock (this.m_sync) { if (this.m_isDisposed) return; this.m_isDisposed = true; if (this.m_identity == null) return; if (!NativeMethods.ImpersonateLoggedOnUser(this.m_identity.Token)) { int forLastWin32Error = Marshal.GetHRForLastWin32Error(); InfoCardTrace.FailFast(string.Format((IFormatProvider) CultureInfo.InvariantCulture, SR.GetString("StoreImpersonateLoggedOnUserFailed"), new object[1] { (object) forLastWin32Error })); } this.m_identity.Dispose(); } } } }