My name is Joey and I am a software developer from the Netherlands.
I mostly consume C# and PHP as a (web)developer. In my spare time I try to expand my horizon.
Currently focusing on going more low level to learn Assembly / C++
When people think about injecting a library inside a native process, most people would directly associate this with C++ and the DllMain entry point. While this is valid, have you ever considered doing this in .NET(C#)?
Let me take you on an interesting adventure with Native AOT where we'll sneak our .NET DLL into Notepad.exe and have some fun calling its internal functions.
With the release of .NET 7, a new and exciting feature has been introduced - the Native AOT (Ahead of Time). This feature involves compiling an application's code into native machine code before it's executed. That is quite the difference from regular .NET compiled code!
One of the great advantages of using Native AOT in C++ is the ability to leverage the functionality written in C#. For example, with the use of System.Text.Json, developers can easily serialize and deserialize data in their C++ applications. In this tutorial, we will walk through a simple example of how to use this powerful feature to enhance the functionality of your C++ applications.
Sending data, be it a simple string or object(s) to a completely different application was easier than anticipated. While I was working on an application I actually encountered an instance where I was required to re-authenticate the user in a separate application, as I do not want to prompt the user to, once again sign in. I had several ideas of either storing the token on the user his system or why not create a static entry point and just overwrite the string from memory.
Apparently there was a much easier solution... Today we discuss MemoryMappedFile
Do you want to see more? Visit my Github