Old question: I have an .exe (PE) with IL (.NET) code in it. When it is started, a mscorlib.dll (.NET framework) function is called to start IL code. Can I extract .NET code segment and append it to other program (that calls mscorlib.dll to execute that segment)?
New question:
I want to append the compiled code from a C# .NET program to a native, pure Win32 application that can run without any .NET Runtimes, and execute it by dynamically calling mscorlib.dll's functions, if .NET is present. This is like a 'executable joiner' technique, not a native compilation.
I do not want to write some .NET .exe to a temp directory and execute it; it is already done and now want to get rid of temp folder by calling .NET vm directly on .NET code inside my file (by giving out an offset of found structure/session, or just by assigning correct PE .section name - know just a little about PortableExecutable format).