[Mono-list] replacement for mscoree.dll
Mon, 30 Dec 2002 18:05:59 +0100
> I don't know if anyone has worked on this yet, but I did a small
> experiment creating a replacement for mscoree.dll.
> It's very "rude", but it works for simple applications (just a "proof of
> concept"). Maybe someone is interested in working on this in the near
> This is how it works (as far as I understand):
> When you build a .NET executable you get a PE executable. This consists
> out of 2 parts: the.NET code and a small stub (x86 code).
> The stub references mscoree.dll and calls a function. For simple
> applications it calls _CorExeMain (there are some other function in
> there, but this is the one I used).
> Now, this _CorExeMain function can locate a decent .NET runtime
> (example: Mono) and have it execute the .NET code contained in the PE
> What I did was very simple: just find out what the commandline (exe
> filename) was and call the mono.bat file (from the mono for windows
> distribution) with the found exe (as I said, "very rude").
> mscorlib, Version=1.0.3300.0, Culture=neutral,
> D:\sandbox\mscortest>copy ..\mscoree.dll
> 1 file(s) copied.
> _CorExeMain> going to execute Mono with [test.exe]
> mscorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
> _CorExeMain> Press Any Key to Exit
> Now the next step(s) could be
> * directly call the mono jit/interpreter api in order to execute the
> .NET code (can this be done?)
> * correctly find out the application path (path to .exe) + parameters
> passed on the commandline
> p.s. I can send the example code if anyone wants (5kb zipfile, VS7
This is really cool.
Now they question is only: If the mono mscorlib.dll is distributed in the
same directory, will MS Windows *always* use this, instead of the original
mscorlib.dll in the windows directory??