private static void Main(string[] args) { Process notepadpp = Process.GetProcessesByName("notepad++").FirstOrDefault(); if (notepadpp == null) { // The process we are injecting into. notepadpp = Process.Start("notepad++"); notepadpp.WaitForInputIdle(); } GameSharpProcess gameSharp = new GameSharpProcess(notepadpp); if (gameSharp == null) { throw new Exception("Process not found."); } string pathToDll = Path.Combine(Environment.CurrentDirectory, "GameSharp.Notepadpp.dll"); // My remote thread injector, you can replace this with any injector. IInjection injector = new RemoteThreadInjection(gameSharp); injector.InjectAndExecute(new Injectable(pathToDll, "Main"), attach: true, launchConsole: true); }
private static void Main(string[] args) { // The process we are injecting into. GameSharpProcess process = new GameSharpProcess(Process.GetProcessesByName("notepad++").FirstOrDefault()); if (process == null) { throw new Exception("Process not found."); } // A simple RemoteThreadInjector. IInjection injector = new RemoteThreadInjection(process); // Inject the DLL and executes the entrypoint. string pathToDll = Path.Combine(Environment.CurrentDirectory, "GameSharp.Notepadpp.dll"); injector.InjectAndExecute(new Injectable(pathToDll, "Main"), attach: false); }