How does WinSxS resolve DLL names to DLL locations?
Asked Answered
D

1

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?

Darya answered 5/10, 2009 at 17:21 Comment(5)
At a best guess, it has one version of the DLL set as default unless a Manifest file tells it otherwise.Confessedly
I think this belongs on Super User, not SO.Quartered
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).Byrnes
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 :-)Darya
I withdraw the comment (but won't delete it, since that would just confuse later readers).Quartered
D
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.

Darya answered 5/10, 2009 at 17:25 Comment(2)
This article was posted in Q/A format due to suggestions on meta: meta.stackexchange.com/questions/24608/….Quartered
Note: I suggest putting at least a little bit of the article into the answer, to establish its relevance.Quartered

© 2022 - 2024 — McMap. All rights reserved.