A demo project outlining how to inject C# dlls into remote processes and reload them. Supports both x86 and x64 injection.
Example: An exmaple executable to be injected into. Sits waiting to be injected into.
Library: An example library to be executed. Must contain a single method with STAThread attribute and expect a single string parameter.
Host: Library that manages the reloading. It bootstraps itself and then controls creating/unloading app domains with the requested library loaded.
Injecter: Console application to execute the demo.
A high level overview of the execution:
- Load Host library into process (using CreateRemoteThread injection)
- Find offset of Host's 'Run' function in process
- Call 'Run' function in process passing library to run arguments (using CreateRemoteThread again)
- Execution now proceeds within process
- Create new app domain and load requested library
- Invoke 'Run' function in requested library by finding method with STAThread attribute
- Wait for 'Run' to complete and repeat 5-7 on key press
If you see build error 'Error The RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask task could not be loaded from the assembly' then install Microsoft .NET Framework 3.5
.
MIT