|
@@ -1,2 +1,30 @@
|
1
|
1
|
# injector
|
2
|
2
|
|
|
3
|
+Barebones library to launch a process with a DLL injected. Intended use-case is to be invoked from C# P/Invoke.
|
|
4
|
+
|
|
5
|
+```
|
|
6
|
+using System;
|
|
7
|
+using System.Runtime.InteropServices;
|
|
8
|
+
|
|
9
|
+class Program
|
|
10
|
+{
|
|
11
|
+ [DllImport("injector.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
12
|
+ public static extern uint LaunchInjected(
|
|
13
|
+ string command_line,
|
|
14
|
+ string working_directory,
|
|
15
|
+ string inject_dll_path,
|
|
16
|
+ [MarshalAs(UnmanagedType.LPStr)]
|
|
17
|
+ string initialize_function);
|
|
18
|
+
|
|
19
|
+ static void Main(string[] args)
|
|
20
|
+ {
|
|
21
|
+ uint process_id = LaunchInjected(
|
|
22
|
+ "c:\\full\\path\\to\\app.exe -arg 0 -arg 1",
|
|
23
|
+ "c:\\full\\path\\to\\",
|
|
24
|
+ "c:\\some\\utility\\inject.dll",
|
|
25
|
+ "Inject_Initialize_Function");
|
|
26
|
+
|
|
27
|
+ Console.WriteLine("Launched process id {0}", process_id);
|
|
28
|
+ }
|
|
29
|
+}
|
|
30
|
+```
|