internal NtProcessInformation(SystemProcessInformation process_info, IEnumerable <NtThreadInformation> threads) { ImageName = process_info.ImageName.ToString(); ProcessId = process_info.UniqueProcessId.ToInt32(); ParentProcessId = process_info.InheritedFromUniqueProcessId.ToInt32(); SessionId = process_info.SessionId; Threads = threads.ToArray(); WorkingSetPrivateSize = process_info.WorkingSetPrivateSize.QuadPart; HardFaultCount = process_info.HardFaultCount; NumberOfThreadsHighWatermark = process_info.NumberOfThreadsHighWatermark; CycleTime = process_info.CycleTime; CreateTime = process_info.CreateTime.QuadPart; UserTime = process_info.UserTime.QuadPart; KernelTime = process_info.KernelTime.QuadPart; BasePriority = process_info.BasePriority; HandleCount = process_info.HandleCount; UniqueProcessKey = process_info.UniqueProcessKey.ToInt64(); PeakVirtualSize = process_info.PeakVirtualSize.ToInt64(); VirtualSize = process_info.VirtualSize.ToInt64(); PageFaultCount = process_info.PageFaultCount; PeakWorkingSetSize = process_info.PeakWorkingSetSize.ToInt64(); WorkingSetSize = process_info.WorkingSetSize.ToInt64(); QuotaPeakPagedPoolUsage = process_info.QuotaPeakPagedPoolUsage.ToInt64(); QuotaPagedPoolUsage = process_info.QuotaPagedPoolUsage.ToInt64(); QuotaPeakNonPagedPoolUsage = process_info.QuotaPeakNonPagedPoolUsage.ToInt64(); QuotaNonPagedPoolUsage = process_info.QuotaNonPagedPoolUsage.ToInt64(); PagefileUsage = process_info.PagefileUsage.ToInt64(); PeakPagefileUsage = process_info.PeakPagefileUsage.ToInt64(); PrivatePageCount = process_info.PrivatePageCount.ToInt64(); ReadOperationCount = process_info.ReadOperationCount.QuadPart; WriteOperationCount = process_info.WriteOperationCount.QuadPart; OtherOperationCount = process_info.OtherOperationCount.QuadPart; ReadTransferCount = process_info.ReadTransferCount.QuadPart; WriteTransferCount = process_info.WriteTransferCount.QuadPart; OtherTransferCount = process_info.OtherTransferCount.QuadPart; ImagePath = NtSystemInfo.GetProcessIdImagePath(ProcessId, false).GetResultOrDefault(string.Empty); }
/// <summary> /// Get a new logon session SID. /// </summary> /// <returns>The new logon session SID.</returns> public static Sid GetLogonSessionSid() { return(GetLogonSessionSid(NtSystemInfo.AllocateLocallyUniqueId())); }
public TokenSource(string source) : this(source, NtSystemInfo.AllocateLocallyUniqueId(false).GetResultOrDefault()) { }