Troubleshooting DLL Problems
By Stephen Bucaro
When using an application, if you receive an error message like "Illegal Operation", "Incorrect
DLL Version" or similar types of errors, it could be because you don't have the latest DLL or it
could be because one of DLLs of that application was overwritten when you installed a new program.
In this article, you'll learn why DLLs are a problem and how to locate and replace the offending DLL.
What is a DLL?
In the early days, computer applications contained all their code in a single executable file.
But applications quickly grew larger than the available memory on most systems. So the code in an
application is divided into parts; the main executable file, and files containing functionality
that could be swapped in and out of memory as needed. A part that could be swapped in and out of
memory is called a Dynamically Linked Library (DLL).
Initially, the DLL of an application would be stored in the same folder as the main executable
file. But application developers soon realized that rather than re-inventing the wheel, they could
re-use code by sharing the same DLL between several different applications. Instead of writing new
code, developers can get functionality they need by licensing a DLL from another developer.
Companies were started just for the purpose of developing and licensing DLLs. Since these DLLs
could be shared among several different applications, they were stored in the operating system
folder (c:\Windows).
An application developer who wants to increase or improve the functionality of a DLL can
create a new version. The software community agreed that if one created a new version of a
DLL, along with the new functions, that DLL would continue to contain the interfaces implemented
by the old functions. That way, you could overwrite the old DLL without breaking existing
applications. In addition, the software community agreed that installation programs would check
the system for a newer version of a DLL before it installed a DLL. That way, the installation of
an older application wouldn't break new applications.
Causes of DLL Problems
Unfortunately, since anybody can write a software application, many amateur developers created
DLLs that did not implement existing interfaces correctly. When their applications where installed,
existing applications broke. Many amateur developers used installation programs that did not check
the version of the DLL before overwriting it. And, they thought their DLL was so wonderful that
everybody in the world would want to share it, so instead of putting it in the same folder with
their application, where it could cause less harm, they put it in the folder of the operating system.
Windows Installer Service
The InstallShield Corporation developed an installation program that carefully checked for
newer version DLLs before overwriting them. Their installer was used by many professional
application developers. Microsoft licensed InstallShield's technology and implemented it as part
of Windows Installer Service.
Windows Installer Service requires application developers to provide a special file in Windows
Installer format (.inf) that describes how the application is to be installed. The Windows
Installer Service will use the file to perform the installation. During the installation, the
Windows Installer Service creates an uninstall log.
System File Protection
The Windows 2000 and Windows XP operating systems implement the Windows File Protection (WFP)
feature. WFP keeps cached versions of the important operating system files. WFP runs in the
background to detects attempts to replace a system file. If a program tries to replace a system
file, WFP checks the digital signature of the replacement file to determine if it's a correct
version. If the file is not a correct version, WFP automatically replaces the file with a
cached version of the original DLL.
The Windows Installer works with WFP when installing essential system files. It calls WFP with
a request to install or replace the protected file. If the file version in the install package
is incompatible with the operating system, WFP informs the user that it cannot update the system
and that an update of the operating system may be required for the application.
|