Пример #1
0
        public UserInfo()
        {
            var wi = WindowsIdentity.GetCurrent();

            Sid = wi.User;

            if (wi.IsSystem)
            {
                IsSystemAccount = true;
            }
            else
            {
                var serviceSid = new SecurityIdentifier(WellKnownSidType.LocalServiceSid, null);
                IsServiceAccount = serviceSid.Equals(Sid);
            }
            Name = ((NTAccount)Sid.Translate(typeof(NTAccount))).Value;
        }