6 |
using System.Diagnostics; |
using System.Diagnostics; |
7 |
using libWin32.Win32.Threading; |
using libWin32.Win32.Threading; |
8 |
using RomCheater.Logging; |
using RomCheater.Logging; |
9 |
|
using System.IO; |
10 |
|
|
11 |
namespace RomCheater.PluginFramework.Core |
namespace RomCheater.PluginFramework.Core |
12 |
{ |
{ |
29 |
List<ProcContainer> proc_list = new List<ProcContainer>(); |
List<ProcContainer> proc_list = new List<ProcContainer>(); |
30 |
foreach (Process proc in Process.GetProcesses()) |
foreach (Process proc in Process.GetProcesses()) |
31 |
{ |
{ |
32 |
|
string proc_name = proc.ProcessName.ToLower(); |
33 |
try |
try |
34 |
{ |
{ |
35 |
bool isSystem = false; |
bool isSystem = false; |
|
string proc_name = proc.ProcessName.ToLower(); |
|
36 |
string proc_user = ThreadControl.GetProcessOwner(proc.Handle, out isSystem).ToLower(); |
string proc_user = ThreadControl.GetProcessOwner(proc.Handle, out isSystem).ToLower(); |
37 |
if (isSystem) |
if (isSystem) |
38 |
{ |
{ |
41 |
} |
} |
42 |
ProcContainer container = null; |
ProcContainer container = null; |
43 |
try |
try |
44 |
{ |
{ |
45 |
container = new ProcContainer(proc); |
container = new ProcContainer(proc); |
46 |
logger.VerboseDebug.WriteLine(" adding process {0} ", proc_name); |
logger.VerboseDebug.WriteLine(" adding process {0} ", proc_name); |
47 |
|
proc_list.Add(container); |
48 |
} |
} |
49 |
|
catch (FileNotFoundException) { } |
50 |
catch (Exception ex) |
catch (Exception ex) |
51 |
{ |
{ |
52 |
//throw; |
//throw; |
53 |
logger.VerboseDebug.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.Message); |
logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); |
54 |
continue; |
//continue; |
55 |
} |
} |
|
proc_list.Add(container); |
|
56 |
} |
} |
57 |
catch (System.ComponentModel.Win32Exception) |
catch (System.ComponentModel.Win32Exception ex) |
58 |
{ |
{ |
59 |
continue; |
if (!((uint)ex.ErrorCode == 0x80004005)) |
60 |
|
{ |
61 |
|
logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); |
62 |
|
} |
63 |
|
//continue; |
64 |
} |
} |
65 |
catch (Exception) |
catch (Exception ex) |
66 |
{ |
{ |
67 |
continue; |
logger.VerboseError.WriteLine(" not adding process {0} because it thew an exception [{1}]", proc_name, ex.ToString()); |
68 |
|
//continue; |
69 |
} |
} |
70 |
} |
} |
71 |
proc_list = proc_list.OrderBy(p => p.Name).ToList(); |
proc_list = proc_list.OrderBy(p => p.Name).ToList(); |