Printer Friendly Version      Send     
Click to Rate and Give Feedback
Related Articles
Raymond Chen explains how a bit of diagnostic code unexpectedly brought the Windows 95 build to crawl.

By Raymond Chen (September 2008)
Raymond explains how the one-time powerful Alpha AXP system came out of retirement to help develop a new generation of 64-bit systems.

By Raymond Chen (August 2008)
Microsoft Bob is a lot more prevalent than you might think. Raymond Chen explains how Microsoft Bob made its way into millions of homes.

By Raymond Chen (July 2008)
Raymond Chen fondly reminisces about working with the two worst computers ever made.

By Raymond Chen (June 2008)
More ...
Articles by this Author
Raymond Chen explains how a bit of diagnostic code unexpectedly brought the Windows 95 build to crawl.

By Raymond Chen (September 2008)
Raymond explains how the one-time powerful Alpha AXP system came out of retirement to help develop a new generation of 64-bit systems.

By Raymond Chen (August 2008)
Microsoft Bob is a lot more prevalent than you might think. Raymond Chen explains how Microsoft Bob made its way into millions of homes.

By Raymond Chen (July 2008)
Raymond Chen fondly reminisces about working with the two worst computers ever made.

By Raymond Chen (June 2008)
Raymond Chen looks at why Windows Vista doesn't support 16-bit icons, and wonders whether anybody has even noticed.

By Raymond Chen (May 2008)
"Are you sure you want to remove this shared file?" Raymond Chen explains why an uninstaller may ask this question when you remove a program.

By Raymond Chen (April 2008)
Raymond Chen discusses the intriguing backstory of how naming conventions for non-final releases have changed. And he gives a gentle plea for companies to take beta testing more seriously.

By Raymond Chen (March 2008)
Here's some history about how a couple of not so incredibly popular features disappeared.

By Raymond Chen (February 2008)
More ...
Popular Articles
Windows PowerShell has been integrated into System Center Operations Manager 2007, offering a powerful way to perform and automate common administrative tasks. Get an overview of how you can use Windows PowerShell in OpsMgr to perform routine maintenance, manage agents, and more.

By Marco Shaw (August 2008)
Security by obscurity involves taking measures that don't remove an attack vector but instead conceal it. Some argue that this is a bad practice while others claim that as part of a larger strategy, every bit counts. The debate is quite heated, and some of our finest security experts face off, explaining security by obscurity and presenting both sides of the debate.

By Jesper M. Johansson and Roger Grimes (June 2008)
The recent update to the Windows Vista Firewall offers some impressive new features that make it a compelling choice for the corporate environment. Jesper M. Johansson gives a brief overview of the evolution of the Windows Firewall and delves into enhancements—such as new rules and profiles, domain isolation, and encryption—that will have administrators taking a closer look.

By Jesper M. Johansson (June 2008)
The new System Center Mobile Device Manager provides a complete set of tools for managing Windows Mobile devices through an MMC snap-in or via Windows PowerShell. Find out how this vital tool will allow you to manage mobile devices, increase security, and deliver mobile VPN capabilities.

By Matt Fontaine (May 2008)
More ...
Read the Blog
Pav Cherny discusses the limitations of the built-in Directory Management Service in SharePoint and explains how you can replace this component with a custom solution that lets you synchronize SharePoint recipient information with other directory solutions. In particular, he ...
Read more!
"One of the common things that administrators must deal with on an ever-increasing basis is the regular changing of the password for shared and privileged accounts, such as the built-in administrator or root account, a firecall account, or perhaps even a process account." In the Read more!
Suppose one of the PCs you support is acting up—freezing, crashing, blue screening. Is some piece of hardware failing? Is some newly installed application causing trouble? Or could it be faulty memory? One way to find out for sure is with the free Microsoft Windows Memory Diagnostic ...
Read more!
Henrik Walther answers your questions about Microsoft Exchange. Here’s just a sample of the ones he tackles in the September issue of TechNet Magazine: ...
Read more!
Beyond traditional voice, messaging, and productivity functions, many businesses today want mobile professionals to have access to the same line of business systems they use in the office through mobile LOB applications, adding new considerations for those tasked with deploying and maintaining IT systems. In ...
Read more!
Back in the Winter 2005 issue of TechNet Magazine, when TechNet Magazine was still in its infancy, Jesper Johansson wrote a fantastic article called "Anatomy Of A Hack: How A Criminal Might Infiltrate Your Network". ...
Read more!
More ...
Windows Confidential Getting Out of DLL Hell
Raymond Chen


DLL HELL. A problem so insidious it has its own pejorative nickname. You install one program and suddenly some seemingly unrelated program stops working. This is because, unknown to you, the two programs are connected via a shared DLL file. The two programs might have different ideas of what version of the MSVCRT.DLL file should be in the system directory. Or the first program may upgrade an ActiveX® control that the second program uses-an upgrade that the second program is not entirely compatible with.
If both programs are essential to your company's day-to-day operations, it doesn't really matter which program is to blame. The important thing is that you need to get them up and running. There isn't much difference between "We're losing money" and "We're losing money because of Bob." Either way, your company is losing money and it's your job to fix the problem right away.
It used to be that you had to choose which program won and which program lost. Starting with Windows® 2000, bandages were made available to help you patch over these conflicts. These bandages, however, are only temporary solutions, allowing you to get your system back on its feet while you investigate a more permanent resolution to the conflict.
Windows 2000 implemented a rudimentary version of what now goes by the fancy name of Dynamic-Link Library Redirection. To enable DLL redirection, create a file with the same name as the program whose DLLs you wish to redirect, but with .local appended to the name. For example, to apply redirection to C:\Program Files\Litware Inc\Invoice.exe, create the file C:\Program Files\Litware Inc\Invoice .exe.local. The contents of the file aren't important; what's important is that the file exists.
Once you've enabled redirection for a program, all attempts by that program to load a DLL will first look in the directory that contains the program before the usual search locations. Therefore, in the case of the conflicting MSVCRT.DLL file, you can enable redirection in each program and put a private copy of MSVCRT.DLL into each program's installation directory. Each program then receives its own version of MSVCRT.DLL-the version of the DLL with which the program was tested.
The magic of this technique is that it works even if the program uses a full path to load the DLL. For example, suppose the program tries to load C:\Program Files\Common Files\Proseware Inc\taxplugin.dll. After upgrading to Proseware 2.0, you discover that its tax plug-in is incompatible with your invoice program. What you can do is copy an old version of the tax plug-in to C:\Program Files\Litware Inc\taxplugin.dll. Even though the program uses a full path to load the tax plug-in, DLL redirection will still look in the current directory and use the local override instead of the one in the Proseware Inc directory.
In Windows XP and Windows Vista™, the rules for DLL redirection are a little different, but the general principle remains the same. In addition to creating a .local file, you can also create a .local directory. In that case, the .local directory is searched rather than the program's install directory. This allows you to apply redirection to multiple programs in the same directory without conflict.
Note that you cannot apply redirection to programs that contain an application manifest, and so-called known DLLs are also exempt from redirection. (For further details, see "Dynamic-Link Library Redirection".)
DLL redirection won't entirely get you out of DLL Hell, but at least it gives you some first-aid techniques for tending the wound while you sort out the problem.
Figure 1   

Raymond Chen writes about both Windows history and Win32 programming on his Web site, The Old New Thing, as well as in his new book also titled The Old New Thing (Addison-Wesley, 2007). He does not, however, have a pet cat named The Old New Thing.
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.
Page view tracker