Number 203 - April 2000
Troubleshooting DLL Conflicts
This article by Russell James originally appeared in the October 1999 issue of PC Alamode, the magazine published by the Alamo PC Organization, San Antonio, Texas.
What are DLLs?
    Dynamic Link Libraries. What does a DLL do? DLLs are best thought of as programmer's toolkits. They contain programming code that is often reused from one application to another. Some DLLs have one or two routines, while others may have a hundred or more. Rather than reinvent 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 DLLs:

      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 scenario:

    A program is launched from your Startup group or folder when you boot your system. That program was distributed with an early version DLL that is stored in the program's local directory. The DLL has 20 internal functions and is loaded into memory.

    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.

    Since the early version DLL is already in memory everything may seem OK when the program is first launched.

    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.

Where Are They Found?
    The most common DLLs are those that are part of a programming language such as C++, VISUAL BASIC, etc. These DLLs 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 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 WIN98'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.

How Can We Locate DLL Problems?
    The following process is intended to let a user check their 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 DLLs are available in two updates:
    Windows 95 Service Pack 1
    OLE 32 Update to Service Pack 1

    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. The site will take a look at you system and give you a list of what has not been installed on your machine. There are also some other cool add-ons to your Windows 98 that will make the trip more of a fun time.

    Now let's check for duplicate DLLs in those Windows 95 systems. Close any programs that are running and tap the F3 key to bring up the Find window. In the "Named" field type in *.dll. In the "Look in:" field look to see that "My Computer" or "Local Hard Drives" is the selection. Make sure that the "Include Subfolders" box is checked. Click the "Find Now" button and wait a few minutes while the list is generated. This could take a while on some of the newer systems. When the search is completed click on the "Name" bar above the list to sort the files alphabetically by name.

    Look through the list for duplicates. The files that will cause problems will be those with copies in the \windows\system folder and in some other program folder. The most critical files will also be listed in the \windows\sysbckup folder. These will usually be the same version as one in the \windows\system folder. Now comes the time consuming part of the process. Check the search listing for duplicate files that have a copy in the \windows\system, a possible copy in \windows\sysbckup and a copy that is anywhere else. These are the files that we are concerned with.

    Be sure that you understand the process before continuing any further. Some of you may wish to contact a computer specialist who is experienced in dealing with software conflicts. Compare the duplicates by holding the Alt key down and double clicking on the duplicates. Click on the Version tab and compare. The one in the \windows\system folder should have the latest version. If the file in a programs folder has a lower version number, change the extension to .d_l. Do not delete any files. Renaming the file will prevent the old version from loading and force the program to look in the System folder for the right DLL. Make a note of the programs where you changed the filenames for future reference. After changing the extensions on the duplicate files reboot your system and load the programs that used the older DLLs one at a time. If the program runs then it is probably okay. If it doesn't run then restore the original name of the old DLL.

    If this is too complicated or time consuming, there is a program that will help with checking for duplicates called DLL Checker. You can download a trial version. The program does the job of finding the duplicate file and highlighting it and the version information is part of the list of file information. It is a $15 shareware program until December 1, 1999, but if you are having problems with Windows error messages it could be worth your time especially if your system has many programs loaded. It will also scan your system for VBXs and OCXs. [Note: check the Web site to see if the shareware version is still available. The registered version is just $25._Ed.]

    The registered version allows you to scan more than one drive, not just the drive that the Windows operating system (any 32-bit flavor) resides on. Using the context menu mouse button, you can select a duplicate file name and have DLL Checker rename the file for you. For example, if the file c:\windows\mso97.dll is a duplicate file, DLL Checker will rename it to c:\windows\mso97.d_l. This will also be noted in the log file, DLLCHK_R.LOG, located in the directory where DLL Checker resides. The default size of the grid font is 8 point. Using the two font buttons in the toolbar allows you increase or decrease the font size.

Is It Better to Do It Yourself?
    If you feel comfortable working with your files and troubleshooting your system errors then maybe this is the route for you to go. If you don't feel comfortable changing file names and tempting the software demons then be sure to write down the error messages exactly as they appear and any information about what programs you were running at the time, any changes that have been made and brother-in-laws that have been "helping" you. This will save you a lot of labor costs if you decide to have a qualified technician try to troubleshoot your problems. I can tell you for sure that it does no good at all to write "fatal error" on the work order.

    Russell James is Operations Manager at BJ Associates of San Antonio. They are the laptop specialist and also handle system-builds and parts for desktops.
  Number 203 - April 2000