Skip to content

Commit

Permalink
capability of ignoring unwanted processes in injection list (#15)
Browse files Browse the repository at this point in the history
* excluded processes list

made so the used can write an "excluded.txt" file that includes processes uevr will ignore in the injection list

* refactored as for requested change
  • Loading branch information
Yamartim authored Feb 19, 2024
1 parent aaca3a0 commit edc4a62
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion UEVR/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public partial class MainWindow : Window {
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);

private string excludedProcessesFile = "excluded.txt";

public MainWindow() {
InitializeComponent();

Expand Down Expand Up @@ -1068,6 +1070,7 @@ private string GenerateProcessName(Process p) {
private static extern bool IsWow64Process([In] IntPtr hProcess, [Out] out bool wow64Process);

private bool IsInjectableProcess(Process process) {

try {
if (Environment.Is64BitOperatingSystem) {
try {
Expand Down Expand Up @@ -1104,6 +1107,21 @@ private bool IsInjectableProcess(Process process) {
}
}

// Check if the excluded processes file exists
if (File.Exists(excludedProcessesFile)) {

List<string> excludedProcesses = new List<string>();

// Read excluded process names from the text file
excludedProcesses = File.ReadAllLines(excludedProcessesFile).ToList();

// Check if the process name is in the excluded list
if (excludedProcesses.Contains(process.ProcessName)) {
return false;
}

}

return false;
} catch(Exception ex) {
Console.WriteLine(ex.ToString());
Expand Down Expand Up @@ -1187,4 +1205,4 @@ await Task.Run(() => {
}
}
}
}
}

0 comments on commit edc4a62

Please sign in to comment.