From 11723ff086347bdc69b9f1f22a3f8b99a0a27f60 Mon Sep 17 00:00:00 2001 From: Martim Lima <54243954+Yamartim@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:54:08 -0300 Subject: [PATCH 1/2] excluded processes list made so the used can write an "excluded.txt" file that includes processes uevr will ignore in the injection list --- UEVR/MainWindow.xaml.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/UEVR/MainWindow.xaml.cs b/UEVR/MainWindow.xaml.cs index b8edd14..da6041e 100644 --- a/UEVR/MainWindow.xaml.cs +++ b/UEVR/MainWindow.xaml.cs @@ -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(); @@ -1068,6 +1070,20 @@ private string GenerateProcessName(Process p) { private static extern bool IsWow64Process([In] IntPtr hProcess, [Out] out bool wow64Process); private bool IsInjectableProcess(Process process) { + + List excludedProcesses = new List(); + + // Check if the excluded processes file exists + if (File.Exists(excludedProcessesFile)) { + // 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; + } + try { if (Environment.Is64BitOperatingSystem) { try { @@ -1187,4 +1203,4 @@ await Task.Run(() => { } } } -} \ No newline at end of file +} From 8ccee820144acbdd4cef5247b7ad725ff6e98ac7 Mon Sep 17 00:00:00 2001 From: Martim Lima <54243954+Yamartim@users.noreply.github.com> Date: Mon, 19 Feb 2024 02:16:05 -0300 Subject: [PATCH 2/2] refactored as for requested change --- UEVR/MainWindow.xaml.cs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/UEVR/MainWindow.xaml.cs b/UEVR/MainWindow.xaml.cs index da6041e..9791241 100644 --- a/UEVR/MainWindow.xaml.cs +++ b/UEVR/MainWindow.xaml.cs @@ -1070,20 +1070,7 @@ private string GenerateProcessName(Process p) { private static extern bool IsWow64Process([In] IntPtr hProcess, [Out] out bool wow64Process); private bool IsInjectableProcess(Process process) { - - List excludedProcesses = new List(); - - // Check if the excluded processes file exists - if (File.Exists(excludedProcessesFile)) { - // 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; - } - try { if (Environment.Is64BitOperatingSystem) { try { @@ -1120,6 +1107,21 @@ private bool IsInjectableProcess(Process process) { } } + // Check if the excluded processes file exists + if (File.Exists(excludedProcessesFile)) { + + List excludedProcesses = new List(); + + // 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());