Re:Injecting .Net Assemblies into Unmanaged Processes
by rootw0rm on Saturday October 27, 2018 @04:56PM
(#18317613)
didn't click the link, but this has been possible since .Net 2.0. back when EasyHook was still in alpha I was using it to inject the entire CLR into unmanaged processes. My ridiculous self was writing intel ASM in C# byte arrays, changing permissions on memory pages to make them executable, pausing the process, then injecting my code. After that I discovered C and my life became much simpler.
Re:Injecting .Net Assemblies into Unmanaged Processes
by evincarofautumn on Sunday October 28, 2018 @03:46AM
(#18319573)
It’s not so unusual. I learned assembly before I learned C, mostly because I didn’t have a C compiler—or even know that I needed one! My family’s Windows 95 computer had QBASIC preinstalled (which amazingly I learned mostly by browsing the interactive help) and I discovered that in order to speed up my graphics routines, I had to write them in assembly in MASM (and DEBUG), also preinstalled. The fact that they were just there already, without requiring any installation or configuration, was enormously helpful as a beginner.
At ~10 years old, I didn’t have any frame of reference for how difficult this tack was compared to other languages, so I just accepted it as “this is what programming is like”. I only picked up C several years later as I got into programming languages and studied as many different languages as I could. Now I work in programming language technology as both a career and a hobby. :)
Re:Injecting .Net Assemblies into Unmanaged Processes
by rootw0rm on Sunday October 28, 2018 @10:28PM
(#18324559)
yup. taught myself ASM through countless hours debugging/tracing/reversing code (and also reading Intel's docs). i learned how to reverse before i really got interested in programming. i had a tiny bit of C++/Pascal experience from high school. C# came out and I saw an easy way to bust out quick windows apps with a decent GUI. made a hacking/macroing framework for Ultima Online in C#, really hideous, horrible, awful code....but I came up with some decent patches for the many different UO clients.
Re:Injecting .Net Assemblies into Unmanaged Processes
by tobi1449 on Saturday October 27, 2018 @03:10PM
(#18317226)
What's the difference between this and simply exporting a method of a .net assembly via https://www.nuget.org/packages/UnmanagedExports/ besides having more control over the CLR/.net environment with the method posted here?
Re:Injecting .Net Assemblies into Unmanaged Processes
by platz on Saturday October 27, 2018 @02:15PM
(#18316932)
So with this technique, could I say, develop a macro in my language of choice to execute a snippet of .net code such that the clr runtime is created and the snippet run in that context?
Re:Injecting .Net Assemblies into Unmanaged Processes
by tomc1985 on Saturday October 27, 2018 @09:40PM
(#18318696)
Oh man, I did something similar to inject controls into IE9's statusbar for a BHO that never got released. As unholy as it seems, having to learn MFC seemed worse
The technique in the OP is slightly different but the end result should be the same if you inject a IJW DLL into any process.
1. https://www.codeproject.com/Articles/10020/Using-managed-cod...
I hope I’m reading it right - you knew intel asm but not C? I’m little surprised. Sorry
At ~10 years old, I didn’t have any frame of reference for how difficult this tack was compared to other languages, so I just accepted it as “this is what programming is like”. I only picked up C several years later as I got into programming languages and studied as many different languages as I could. Now I work in programming language technology as both a career and a hobby. :)