7

If I link a module against mydll.dll, which is deployed using WinSxS, the PE header in my module will simply reference "mydll.dll". How does Windows determine at runtime, firstly that this dependency should be loaded via WinSxS, and secondly what assembly it's in?

user184323
  • 151
  • 7
  • At a best guess, it has one version of the DLL set as default unless a Manifest file tells it otherwise. – Powerlord Oct 05 '09 at 17:22
  • I think this belongs on Super User, not SO. – Michael Myers Oct 05 '09 at 17:30
  • 1
    Why? It has a lot of relevance to programming (as the recent /. story, where 90% of the readers don't understand what SxS is or how it works, has shown). – Pavel Minaev Oct 05 '09 at 17:34
  • 1
    Hi mmyers - as the article states, it may be useful for sysadmins but it is primarily aimed at programmers. WinSxS is one of those mechanisms that everybody needs to understand, but nobody does :-) – user184323 Oct 05 '09 at 17:44
  • I withdraw the comment (but won't delete it, since that would just confuse later readers). – Michael Myers Oct 05 '09 at 18:58

1 Answers1

8

It does so via the "activation context". In my opinion, WinSxS does not make any sense until you learn about the activation context and how it is managed.

I've put a rather long blog post explaining the details at http://omnicognate.wordpress.com/2009/10/05/winsxs/.

To summarise the article, the activation context is a structure that WinSxS uses at runtime to resolve unversioned object names (eg. DLL names) to the full information about how to locate them. The purpose of "manifests" in WinSxS is to construct activation contexts. Without understanding how and when these activation contexts are constructed and how they are managed (they are held on a thread-local stack), it is not possible to reason through the steps involved in loading a DLL via WinSxS and it is therefore impossible to diagnose the majority of problems that can arise.

user184323
  • 151
  • 7
  • This article was posted in Q/A format due to suggestions on meta: http://meta.stackexchange.com/questions/24608/what-is-the-etiquette-for-posting-an-article. – Michael Myers Oct 05 '09 at 17:26
  • Note: I suggest putting at least a little bit of the article into the answer, to establish its relevance. – Michael Myers Oct 05 '09 at 17:28