예제 #1
0
        public static InstallationData Create(NtProcess proc)
        {
            InstallationEnumerator enumerator = new InstallationEnumerator();

            foreach (InstallationData data in enumerator)
            {
                FullPathName fullPath = new FullPathName(proc.Win32ProcessImagePath);
                if (fullPath.StartsWith(data.InstallationPath))
                {
                    return(data);
                }
            }
            return(new InstallationData(
                       proc.Win32ProcessImagePath,
                       InstallationLevel.Developer,
                       0,
                       "Developer Chrome",
                       String.Empty));
        }
        public void LoadProcesses()
        {
            _processes.Clear();
            List <ChromiumProcess> chromes    = new List <ChromiumProcess>();
            HashSet <int>          chromePids = new HashSet <int>();

            foreach (Process p in Process.GetProcesses())
            {
                // System.Diagnostics.Process uses a naive implementation that is unable to deal with many
                // types of processes (such as those already under a debugger, or those with a high
                // privilege level), so use NtProcess instead.
                NtProcess ntproc = new NtProcess(p.Id);
                if (!ntproc.IsValid)
                {
                    continue;
                }

                FullPathName processPath = new FullPathName(ntproc.Win32ProcessImagePath);
                if (processPath.StartsWith(_installationData.InstallationPath))
                {
                    chromes.Add(new ChromiumProcess(ntproc, _installationData));
                    chromePids.Add(p.Id);
                }
            }

            foreach (ChromiumProcess chrome in chromes)
            {
                // Only insert root processes at this level, child processes will be children of one of
                // these processes.
                if (!chromePids.Contains(chrome.ParentPid))
                {
                    ChromeProcessViewModel viewModel = new ChromeProcessViewModel(_root, chrome);
                    viewModel.LoadProcesses(chromes.ToArray());
                    _processes.Add(viewModel);
                }
            }
        }
예제 #3
0
 public static InstallationData Create(NtProcess proc)
 {
     InstallationEnumerator enumerator = new InstallationEnumerator();
       foreach (InstallationData data in enumerator) {
     FullPathName fullPath = new FullPathName(proc.Win32ProcessImagePath);
     if (fullPath.StartsWith(data.InstallationPath))
       return data;
       }
       return new InstallationData(
       proc.Win32ProcessImagePath,
       InstallationLevel.Developer,
       0,
       "Developer Chrome",
       String.Empty);
 }
예제 #4
0
        public void LoadProcesses()
        {
            _processes.Clear();
              List<ChromiumProcess> chromes = new List<ChromiumProcess>();
              HashSet<int> chromePids = new HashSet<int>();
              foreach (Process p in Process.GetProcesses()) {
            // System.Diagnostics.Process uses a naive implementation that is unable to deal with many
            // types of processes (such as those already under a debugger, or those with a high
            // privilege level), so use NtProcess instead.
            NtProcess ntproc = new NtProcess(p.Id);
            if (!ntproc.IsValid)
              continue;

            FullPathName processPath = new FullPathName(ntproc.Win32ProcessImagePath);
            if (processPath.StartsWith(_installationData.InstallationPath)) {
              chromes.Add(new ChromiumProcess(ntproc, _installationData));
              chromePids.Add(p.Id);
            }
              }

              foreach (ChromiumProcess chrome in chromes) {
            // Only insert root processes at this level, child processes will be children of one of
            // these processes.
            if (!chromePids.Contains(chrome.ParentPid)) {
              ChromeProcessViewModel viewModel = new ChromeProcessViewModel(_root, chrome);
              viewModel.LoadProcesses(chromes.ToArray());
              _processes.Add(viewModel);
            }
              }
        }