Exemplo n.º 1
0
 public ProcessViewModel(ProcessExtendedInformation info)
 {
     Info           = info;
     _nativeProcess = NativeProcess.TryOpen(ProcessAccessMask.QueryLimitedInformation, Info.ProcessId);
     if (_nativeProcess != null)
     {
         IsManaged   = _nativeProcess.IsManaged;
         IsProtected = _nativeProcess.IsProtected;
         IsInAnyJob  = _nativeProcess.IsInAnyJob;
     }
 }
Exemplo n.º 2
0
        private string QueryProcessName(int processID)
        {
            using (var process = NativeProcess.TryOpen(ProcessAccessMask.QueryLimitedInformation, processID)) {
                if (process == null)
                {
                    return(string.Empty);
                }
                var name = process.TryGetFullImageName();
                if (name == null)
                {
                    return(string.Empty);
                }

                return("(" + Path.GetFileNameWithoutExtension(name) + ")");
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var processes = SystemInformation.EnumProcessesExtended();

            foreach (var pi in processes)
            {
                Console.Write($"{pi.ImageName} ({pi.ProcessId}) Threads: {pi.Threads} Parent: {pi.ParentProcessId} Virtual Size: {pi.VirtualSize}");
                if (pi.ProcessId > 0)
                {
                    using (var process = NativeProcess.TryOpen(ProcessAccessMask.QueryLimitedInformation, pi.ProcessId)) {
                        if (process != null)
                        {
                            Console.Write($" Start: {process.CreateTime} Managed: {process.IsManaged} In Job: {process.IsInAnyJob} Protection: {process.Protection}");
                        }
                    }
                }
                Console.WriteLine();
            }
        }
Exemplo n.º 4
0
 public ProcessViewModel(ProcessExtendedInformation info)
 {
     Info           = info;
     _nativeProcess = NativeProcess.TryOpen(ProcessAccessMask.QueryLimitedInformation, Info.ProcessId);
 }