| | 1 | | using System.IO; |
| | 2 | |
|
| | 3 | | namespace LockCheck.Windows; |
| | 4 | |
|
| | 5 | | internal class ProcessInfoWindows : ProcessInfo |
| | 6 | | { |
| | 7 | | public static ProcessInfoWindows? Create(NativeMethods.RM_PROCESS_INFO pi) |
| | 8 | | { |
| 2 | 9 | | var peb = new Peb((int)pi.Process.dwProcessId, pi.GetStartTime()); |
| 2 | 10 | | return peb.HasError ? null : new ProcessInfoWindows(peb); |
| | 11 | | } |
| | 12 | |
|
| | 13 | | public static ProcessInfoWindows? Create(int processId) |
| | 14 | | { |
| 2 | 15 | | var peb = new Peb(processId, NativeMethods.GetProcessStartTime(processId)); |
| 2 | 16 | | return peb.HasError ? null : new ProcessInfoWindows(peb); |
| | 17 | | } |
| | 18 | |
|
| | 19 | | public ProcessInfoWindows(Peb peb) |
| 2 | 20 | | : base(peb.ProcessId, peb.StartTime) |
| | 21 | | { |
| 2 | 22 | | ParentProcessId = peb.ParentProcessId; |
| 2 | 23 | | ExecutableFullPath = peb.ExecutableFullPath; |
| 2 | 24 | | ExecutableName = Path.GetFileName(peb.ExecutableFullPath); |
| 2 | 25 | | ApplicationName = peb.ProcessName; |
| 2 | 26 | | SessionId = peb.SessionId; |
| 2 | 27 | | Owner = peb.Owner; |
| 2 | 28 | | IsCritical = peb.IsCritical; |
| 2 | 29 | | ProcessStartKey = peb.ProcessStartKey; |
| 2 | 30 | | } |
| | 31 | | } |