Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capability of ignoring unwanted processes in injection list #15

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(() => {
}
}
}
}
}
Loading