Microsoft's WPF/E, the E stands for almost everywhere 1

Posted by jbevain Thu, 23 Mar 2006 19:54:52 GMT


So they are porting their stuff to Mac, and expecting we to do so on Linux. Will we?

The sad but true story of a hack without future 3

Posted by jbevain Thu, 23 Mar 2006 14:26:00 GMT


A long time ago, while discovering the wonders of the inside of an assembly when writing Cecil, I’ve thought of a nice hack for the ones who use Mono on Windows.

This is the story of this hack, from its birth, to its death.

The ECMA-335 standard, aka CLI, describes the format of the binaries understood by the CLI. This format is basically the one used on Windows for the executables and the libraries: the PE (Portable Executable) format.

You may read on internet that a standard compliant CLI executable import one and only one function from one library, the _CorExeMain or the _CorDllMain, imported from the Core Execution Engine of the .net framework: mscoree.dll. All of this is true. The verifier of the .net framework checks that this function is imported, otherwise, the executable is declared as uncompliant. You may also read that the entry point of such a CLI executable is only a jump to the function of execution engine.

Basically my idea was to write an assembly patcher, which could modify the import of a CLI executable to point to my own loader, say monoldr.dll. This way, when running a patched CLI executable, the PE loader would jump to my monoldr, in charge of running mono on the executable. It sounded so well.

So one night, I started working on this. I quickly wrote a patcher using Cecil to change the import in the executable, and I started working on the monoldr.

When my patcher was ready, I runned it over a simple hello world executable, and runned this modified but shiny binary. The PE loader decided not to accept this binary, telling me that the image was illegal. Wow. I suspected that the PE loader run some kind of verification, similar to peverify, on the binary. My answer was to change a flag in the CLI header of the assembly, to turn it from a CIL only image, into a mixed image, which are of course allowed to import other functions from other libraries.

I modified my patcher, runned it over the assembly, and runned the hello world again, expecting that the PE loader would jump straight into my mono loader, and gracefully print “MonoExeMain”.

Instead a nice “Hello World !” appeared in the console.

This friendly greeting simply means that my PE loader don’t pay attention to the imports of the assembly, and by itself jumps to the Core Execution Engine of the .net framework. After a little investigation, it appears that PE loader from XP and 2003 have been modified to understand .net executables, so the import stuff is no more used. My hack would only work on previous versions of Windows, like 2K or 98. The loader looks in the Data Directories of the PE header, and if a COM+ directory is found, it decides that it’s a managed executable, and give it to the .net framework.

Oh of course I could write a more complex patcher, which moves the COM+ directory into another one, this way the loader would jump to my mono loader, which would have to patch the header again before giving the assembly to mono, but any tools like ildasm or monodis would fail on this patched assembly. And all of this is not worth creating a .bat file…

June, don't make it bad 2

Posted by jbevain Tue, 07 Jun 2005 10:16:52 GMT


Meet Ximian folks

I’ve met Miguel, Nat and John when they were in Paris. It was very nice to meet those guys. Even if having four breakfast in two days is a little bit unusual to me, it was two really good days.

Me

If everything goes fine, i should leave paris and move to Mulhouse, near the German border. For curious peoples, here is the “Where i’ve lived in France” map:

  • 1. Jouars-Pontchartrain (78), 14 years
  • 2. Alissas (07), 5 years
  • 3. Lyon (69), 2 years
  • 4. Paris (75), 1 year
  • 5. Mulhouse (68), will be there for at least 3 years

Mulhouse looks to be a crappy city, but i’ll be close to folks from Evaluant. I won’t miss Paris’s subway.

Google Summer Of Code & Cecil

I’ve applied for the Summer Of Code. This is the task i’ll work on! The previous roadmap is still up to date. I hope i’ll be selected, i’d be very disappointed to miss an opportunity of winning a T-shirt.

At least 3 projects from Mono are using Cecil. So I’m happy.

Guys from Mainsoft are interested in Cecil as well. Thanks to them, i’ve nice reports on Cecil’s bugs and API. This should accelerate Cecil’s development.

Older posts: 1 ... 9 10 11