Alexey Borzenkov ([info]snaury) wrote,
@ 2009-12-08 23:21:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
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. :(




(2 comments) - (Post a new comment)


[info]shockwave77598
2009-12-09 03:54 pm UTC (link)
I have always detested the common DLL idea. Sure, having one copy of the code saves space. This was important back in... oh, 1990 or so. But it also opened up the Pandora's box of updating one program which changes the DLL, and breaks it for all the other programs that use it. Or worse, deletes it when replacing with a modern one - suddenly your other programs can't even find the DLL they need.

It's far better to ship a program with everything it needs and keep it in its own directory than count on something being in some other folder someplace. If some other program can delete critical parts when it "updates" then the installation is dangerously flawed.

(Reply to this) (Thread)


[info]snaury
2009-12-10 07:03 am UTC (link)
Not when your program is ~50Kb and you send it to coworkers via email. msvcr90.dll is 600Kb, so I can still keep roughly under 1MB limit, but largely unneeded msvcp90.dll and msvcm90.dll add up to another 800Kb and it can quickly go over board (I didn't test it, but read somewhere that you must copy all three + manifest or it wouldn't work). Plus, yesterday I found that if you copy Microsoft.VC90.CRT is application's directory and you have CRT installed then Windows doesn't even use it (it prefers installed version). Besides, installing dlls over might have been a problem in the past, but now it's 2009 and practically all dlls are versioned, and all installers know how to deal with it.

But my main problem is with ambiguity when Windows fails to find the dll (at least Windows XP, don't know about others). If it said it can't find msvcr90.dll or Microsoft.VC90.CRT assembly: no problem, people know what't the problem and can fix it. But when it says that program failed to execute? Go figure why. :-/

(Reply to this) (Parent)


(2 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Log in with OpenID
English • Español • Deutsch • Русский…