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 | 8 年 前 | |
---|---|---|
.gitignore | 8 年 前 | |
LICENSE | 8 年 前 | |
README.md | 8 年 前 | |
injector.cpp | 8 年 前 | |
injector.h | 8 年 前 | |
injector.sln | 8 年 前 | |
injector.vcxproj | 8 年 前 | |
injector.vcxproj.filters | 8 年 前 |
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);
}
}