Question

I'm developing an application that uses a plugin mechanism to load libraries. Usually the hosting application runs as 64bit application.

So far everything worked as expected. x64 assemblies could be loaded, AnyCPU could be loaded and x86 assemblies failed. That is - until someone came up with the idea and created an x86 Console Application - and it could be loaded as well.

Why is it possible to load an x86 console application assembly (exe) from a 64bit host process, but it fails to load an x86 library (dll)? Just for clarification - I'm not trying to load x86 dll's and not intend to - just curious why it's allowed to load x86 applications.

(If anyone is interested I can attach the sample code that I used)

Était-ce utile?

La solution

The response to this was given in Microsoft Connect some time ago... however I can't seem to find the link.

I did, however, find a thread where they reference it with the response here.

Quoting:

Hi. Thank you for reporting the issue. It looks like you stumbled on an implementation detail - we do not use LoadLibrary for executables and it looks like in this case it does a validation that we do not. I cannot say this difference was the intended behavior, however if we were to to add an additional check now we could break someone, and the issue does not seem serious enough to take the risk.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top