Skip to content

Inject your Native AOT assembly through the dllmain entry and perform internal function calling within the injected context

License

Notifications You must be signed in to change notification settings

Joey0x646576/nativeaot-function-calling-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Inject your Native AOT assembly and perform internal function calling within the injected context

This project leverages the .NET ahead-of-time compiler to inject a natively compiled assembly into a Windows process and execute functions from within the injected context. The context in this case is notepad.exe.

Description

DLL injection is usually associated with C++, where you create and inject DLLs to interact with process internals. This project demonstrates that .NET in combination with Native AOT compilation, is just as capable! Since there aren't many examples on this subject I decided to go more in depth about it on my blog post, feel free to read it!

How to

  1. Publish the project dotnet publish -r win-x64 -c Release
  2. Inject the dll in notepad.exe using LoadLibrary or tools such as Process Hacker which support this.

The example contains some simple interactions with the process:

  • Search
  • JumpToLine
  • Reading variables

Remarks

Warning

This is done on notepad.exe(10.0.19041.3996) on Windows 10 22h2.

Preview

2024-04-2719-48-42

About

Inject your Native AOT assembly through the dllmain entry and perform internal function calling within the injected context

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages