NWA-PCUG 09/1999 NewsLetter Article 18861 N. Hwy 112, Springdale, AR 72762-9303 DLL Conflict Troubleshooting Tutorial Stop! Don't wipe that hard drive, there's a better way! What's a DLL? Dynamic Link Library What does a DLL do? DLLs are best thought of as programmer's toolkits. They contain programming code that is often re-used from one application to another. Some DLLs have one or two routines, while others may have a hundred or more. Rather then re-invent the wheel, a programmer will use a DLL containing optimized code for the task at hand. Dialing your modem, selecting fonts and colors or quickly sorting lists of information are examples of the types of work they perform. Why do they cause problems? There are two types of DLL's: Shared or common - Used by many programs. Proprietary - Used by one program or by one software publisher With the earliest versions of Windows, Microsoft established the \windows\system folder as the designated storage place for DLLs that are common. The proprietary DLLs were supposed to be installed in the program's own folder. As new and improved versions of DLLs were released it was intended that the updated version would replace the earlier version and that the DLL would be backward compatible. In a perfect world you'd have just one copy of a shared DLL on your system and it would be available to any application that needed it. The Windows operating system (any flavor) allows only one copy of a DLL to be in memory at any one time. The DLL will remain in memory until it's no longer needed. Let's start by looking at the following common scenario: 1.A program is launched from your Startup group or folder when you boot your system. That program was distributed with an early version DLL, which is stored in the program's local directory. The DLL has 20 internal functions and is loaded into memory. 2. A few minutes later you load a recently released program. That program needs the same DLL (by name), but is supposed to utilize the newer version that has 80 internal functions. 3.Since the early version DLL is already in memory everything may seem to be OK, when the program is first launched. 4.However, As soon as the more recent program asks for one of the 60 missing functions you're in trouble. You may get a complete crash, a lockup or a message blaming something that's completely unrelated. The most common DLL's are those that are part of a programming language such as C++, Visual Basic, etc. These DLL's provide the same "run time" environment as the developer's own system, but don't allow you to edit the program. Software publishers must include these critical DLLs with their programs because they can't assume you already have the right one on your system. Software publishers often seem to be careless or unable to follow the rules. In some cases, they just don't know better. Both small and large publishers are guilty of not keeping their programming utilities up to date, this results in distributing DLLs that are several years old. Distributing a new program with old DLL's has the same effect as loading an old program on your system. Microsoft has incorporated several features into the Windows 98 operating system that help to resolve the problem of an old DLL being installed into a shared directory; however it doesn't always work. The worst offenders are installation routines that don't do any version checking and simply unzip files directly into the shared directory, overwriting whatever is there. In many cases W98's System File Checker can recover the correct version. Having a current backup is still the best protection. One of the most common mistakes made by a program's installation routine is to place a common DLL in the program's own folder, rather then put it in the system folder where it belongs. That's the easiest thing to fix, if you're careful and follow some simple guidelines. Programs bearing the MS Windows 9x logo on the box generally don't cause problems as they have to meet some very strict and recently revised compliance standards. I'm guessing that the right to wear the logo doesn't come cheaply either. Searching the system The following process is intended to let a user check their own system for DLL version conflicts. Before doing so, I strongly recommend that any patches and updates available from MS be installed. Installing these updates will put the newest versions of the most problematic DLLs on your system and give you a valid reference point for what's really old on your system. The most critical DLL's are available in 3 updates: "Windows Library Update" "Windows 95 Service Pack 1" "OLE 32 Update to Service Pack 1" If you are running Windows 95, you'll find these updates at www.microsoft.com.windows95/downloads If you are running Windows 98, click on the Windows Update in the Start menu and you'll be taken to MS's semi-automated update site. If you're not sure whether the update is installed on your system or not, install it anyway! It doesn't hurt to be sure. Step-by-step 1.Open "My Computer" by Right clicking on the icon and selecting "Explore". Change your view to "Details" 2.Open the \windows\system folder and check that you can see files with a DLL extension. If not, you have to turn on the "view all files" option in Explorer. 3. Tap your F3 key to bring up the search window 4.In the "Named" field enter *.DLL 5.In the "Look in:" field open the drop down and select "My Computer" or "Local Hard Drives" if you are on a network. 6.Make sure the "Include subfolders" box is checked. 7.Click the "Find Now" button. 8.Be patient, this may take a few minutes on a large or slower system. 9.When the search is completed, click on the "Name" button (at the top of the "Name " column) to sort the entire list, alphabetically, by name. Don't be surprised by the number of DLLs on your system. In a new system, with little more then Windows98 installed you'll probably have three or four hundred of them, but on a large system like mine, there's nearly five thousand! Taking control Look through the list for duplicates. The ones that cause software conflicts are those with copies in the \windows\system folder and one or more copies somewhere else on your system. The most critical DLLs have a backup copy in \windows\sysbckup - that's a new safety feature introduced with Widows9x and these files are usually the same version. Check the search listing for files beginning with: BWCCCOCTL MFCMSVOLE Caution!! The following is intended for experienced users only . Some people may wish to contact a consultant or system specialist who is experienced in dealing with software conflicts. Don't get carried away in the following process. We are only concerned with duplicates that meet the following criteria: A copy in \windows\system A possible copy in \windows\sysbckup A copy that is anywhere else Example: (using mfc42.dll) C:\someprogram\mfc42.dll v4.25 old version (rename) C:\windows\systemv6.00.8267.0 Higher version, shared directory C:\windows\sysbckupv6.00.8267.0 Safety copy, don't touch 1.Right click on each of the duplicate files, beginning with the copy in the system folder, and select "Properties". In most systems you can speed this up by holding down the ALT key while you double click. 2.Click on the Version tab and make a note of the version number, it will be highlighted. 3.Repeat this for each of the duplicate files having the same name. Double check your work, some file name s are very similar. 4.You only need to keep the DLL having the highest version number and that copy should be the one in the shared \windows\system folder. 5.Do not delete any files!! 6.If any of the duplicates is in a program's own local folder and has an equal or lower version number then the copy in the \windows\system folder, change the file extension from DLL to D_L. This will stop the older version from loading and force it to look in the \windows\system folder for the file. 7.If you are a neat freak, you can consider deleting the renamed duplicate file when you are sure that everything is working properly. Because of the close similarity to some of the file names it's very easy to tag the wrong file! 8.Do only a few files at a time, until you are comfortable with the process. Reboot your system and run the programs where you may have disabled a DLL in a program's own local folder. If you are sure that everything is working, you can then delete the renamed DLL. 9.Some files that are currently active, in memory, may not permit renaming. In most cases, you can temporarily disable programs that in are in your Startup folder to complete the operation. In other cases you may have to reboot and perform the rename after starting the system at the DOS command prompt. Author's note: This troubleshooting process is not intended to solve all conflict situations. It does however, eliminate the most common problems. Duplicate DLL's, where no copy is in the common \windows\system directory, are a completely different situation and beyond the scope of this article. For those situations a thorough understanding of the operating system and a backup plan are required. I strongly advise the reader to leave these files as-is. In most cases they will not cause system problems, unless both programs are being run at the same time. This article is furnished as a benefit of our membership in the Association of Personal Computer User Groups (APCUG), an international organization to which this user group belongs. The author, Rod Ream is a full time, independent, PC Consultant and is also the Director of Technical Services for the Pasadena IBM Users Group (PIBMUG). His base is in Alhambra CA and he can be reached at rodream@techie.com.