Barebones library to launch a process with a DLL injected. Intended use-case is to be invoked from C# P/Invoke.

kaezin 10aa3d02c5 Add some README content před 7 roky
.gitignore 2fb73f9a4f Ignore *.VC.db před 7 roky
LICENSE 083a8b2371 Initial commit před 7 roky
README.md 10aa3d02c5 Add some README content před 7 roky
injector.cpp d11ff4157c Simple injector that launches a process with a dll injected and returns the launched PID před 7 roky
injector.h d11ff4157c Simple injector that launches a process with a dll injected and returns the launched PID před 7 roky
injector.sln d11ff4157c Simple injector that launches a process with a dll injected and returns the launched PID před 7 roky
injector.vcxproj d11ff4157c Simple injector that launches a process with a dll injected and returns the launched PID před 7 roky
injector.vcxproj.filters d11ff4157c Simple injector that launches a process with a dll injected and returns the launched PID před 7 roky

README.md

injector

Barebones library to launch a process with a DLL injected. Intended use-case is to be invoked from C# P/Invoke.

using System;
using System.Runtime.InteropServices;

class Program
{
    [DllImport("injector.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
    public static extern uint LaunchInjected(
        string command_line,
        string working_directory,
        string inject_dll_path,
        [MarshalAs(UnmanagedType.LPStr)]
        string initialize_function);

    static void Main(string[] args)
    {
        uint process_id = LaunchInjected(
            "c:\\full\\path\\to\\app.exe -arg 0 -arg 1",
            "c:\\full\\path\\to\\",
            "c:\\some\\utility\\inject.dll",
            "Inject_Initialize_Function");

        Console.WriteLine("Launched process id {0}", process_id);
    }
}