| Alexey Borzenkov ( @ 2009-12-08 23:21:00 |
| Entry tags: | work |
WinSxS
WinSxS (introduced by Microsoft a very long time ago) was supposed to save us from "Dll Hell" (e.g. Common Controls that didn't interfere with older programs), but suddenly I found that it's more abused by Microsoft than doing anything good. I'm talking here about Visual C++ 2008 runtimes.
You see, the only way to use dynamic 9.0 runtimes is to embed a manifest in your exe/dll file, and activation subsystem (Act* APIs) is responsible for finding the "assembly" and loading appropriate dlls. The program is still linked against msvcr90.dll as usual, but you won't find the dll anywhere in the PATH, because they must either be installed and registered in C:\WINDOWS\WinSxS, or placed inside a subdirectory named after assembly name, along with a manifest. What's bad is that it will actually runtime will refuse to initialize unless it's loaded via activation subsystem (as in placing msvcr90.dll in the same directory as your executable). What's worse is that if required assembly is not installed (nor the directory is locally available) then executable will refuse to load without any meaningful error message.
Let's say you are running application that links to msvcr71.dll, but which does not ship it along? You'll see a MessageBox showing that msvcr71.dll is not installed. What happens if vcredist for Visual C++ 2008 runtime is not installed? You'll see that file cannot be executed. Oh yes, that was very helpful, thank you! (this happened today on my colleagues computer, I was thinking there was some permission problem when I remembered he didn't install neither Python nor C++ runtime... surprise-surprise, installing it fixed a problem with some beta build of the game he couldn't launch, doh!)
But when I looked at redirection policies for 9.0 runtimes it looked even worse. What's the god damn point in them?! If you installed Visual C++ 2008 SP1 runtime, then all previous versions are redirected to it. At work I actually have three 2008 runtimes (don't know where third one came from), and all newer versions redirect older versions to themselves. What's the point in having older versions installed, then? :-/ I'm sure if there's any incompatible change at all (like SP2 or something) it will be called VC91 anyway, and dlls will be named like msvcr91.dll too, avoiding any collision. Under such policies, why make life harder with WinSxS and manifests for your end users?! Really beats me. :(