public IEnumerable <KeyValuePair <string, object> > ProvideValues(ManagementObject managementObject, Process process, bool updateProcess) { var result = new List <KeyValuePair <string, object> >(); try { var handle = process.Handle; //possible exception string sid = null; try { sid = ProcessExtensions.GetProcessOwner(process.Handle); var processOwner = new SecurityIdentifier(sid).Translate(typeof(NTAccount)).ToString(); result.Add(new KeyValuePair <string, object>("ProcessOwner", processOwner)); } catch (Exception) { // ignored } if (IsImmersiveProcess(handle)) { result.Add(new KeyValuePair <string, object>("Status", ProcessType.Immersive)); return(result); } if (managementObject.TryGetProperty("SessionId", out uint sessionId) && sessionId == 0) { result.Add(new KeyValuePair <string, object>("Status", ProcessType.Service)); return(result); } if (IsNetAssembly(managementObject)) { result.Add(new KeyValuePair <string, object>("Status", ProcessType.NetAssembly)); return(result); } if (sid != null && string.Equals(User.UserIdentity?.User?.Value, sid, StringComparison.OrdinalIgnoreCase)) { result.Add(new KeyValuePair <string, object>("Status", ProcessType.UserProcess)); } } catch (Exception) { // no access to handle } return(result); }