using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DllUtils.Modules;
using DllUtils.Process;
namespace DllUtils
{
public static class Injector
{
///
/// Returns RemoteProcessHandle that can be used to Inject dll
///
///
///
public static RemoteProcessHandle GetRemoteProcess(string processName)
{
return GetRemoteProcess(System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault());
}
///
/// Returns RemoteProcessHandle that can be used to Inject dll
///
///
///
public static RemoteProcessHandle GetRemoteProcess(int processId)
{
return GetRemoteProcess(System.Diagnostics.Process.GetProcessById(processId));
}
///
/// Returns RemoteProcessHandle that can be used to Inject dll
///
///
///
public static RemoteProcessHandle GetRemoteProcess(System.Diagnostics.Process process)
{
if (process == null)
{
return null;
}
return new RemoteProcessHandle(process);
}
///
/// Injects dll into process using its name
///
///
///
///
public static InjectedModule Inject(string processName, string dllPath)
=> GetRemoteProcess(processName).Inject(dllPath);
///
/// Injects dll into process using its id
///
///
///
///
public static InjectedModule Inject(int processId, string dllPath)
=> GetRemoteProcess(processId).Inject(dllPath);
///
/// Injects dll into process using System.Diagnostics.Process
///
///
///
///
public static InjectedModule Inject(System.Diagnostics.Process process, string dllPath)
=> GetRemoteProcess(process).Inject(dllPath);
}
}