Thursday, April 30, 2009

How can you prevent and fix DLL corruption problems?

Introduction

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.


DLL Corruption

In addition to blaming the programmers for the new drivers development mistakes, there are other reasons of DLL files get corrupted or missing. Among them:
  1. Removal of an important DLL file by mistake.
  2. Performing illegal operation during the new software install or uninstall. That might be also related to the unclean installation or un-installation process, when user is trying to exit it on the middle being frustrated by the appeared computer freezing.
  3. Operation system damage and other problems in your hard disk.
  4. Infection by spyware or virus.
  5. A hardware issue exists with the computer, such as a bad hard disk drive, causing the data on the drive to become corrupt, leading to the .dll problems display.
Fixing DLL Problems

There are numerous ways to resolve DLL errors. Whenever your PC warns you of a DLL error, usually it displays the name of the specific DLL file such as xvidcore.dll, msvcr71.dll or msvcrt.dll that has become corrupt or has been deleted. You can note down the file name and perform a search for this DLL file on the internet. By downloading this file and replacing the old one, you may rectify the problem.

Another easy method to correct the DLL error may be to perform a system restore. Make sure to set the date of the system restore to the day before you started encountering this error. If the DLL error does not allow your PC to start, just restart your PC in Safe mode and start system restore.

In case you encounter a DLL error just after you have installed a new program, you should uninstall the program and see if the error goes away. If it does, you should contact the manufacturer of the program and seek technical support to resolve the issue.
Sometimes, however, a DLL file error will make it impossible for your computer to start. If that’s the case, simply start your computer in safe mode then you can run the system restore.

It is important to mention that trying to repair DLL errors can be cumbersome and even risky at times. Therefore, a popular way to repair DLL errors is to use a registry cleaner tool. This tool will help you look for invalid DLL entries in the registry and repair them.


DLL Error Prevention

  1. The first DLL error prevention measure would be to NOT install and uninstall programs any more often than you have to. In other words, unless you are certain that the program that you are about to install is one that you are going to use and keep, do not install it!
  2. Be extra careful when uninstalling programs from your machine. For example, if you have ever uninstalled programs, you have probably seen a message telling you that the program is going to uninstall ABC.dll as part of the process, after which, it asked you whether it should go ahead and do so. If it tells you that it is about to uninstall a DLL, go find out what that DLL actually does before giving the machine the go-ahead! (check out Microsoft’s own site for the answer to this question, or run a search on Google or Yahoo).
  3. Be patient when installing and uninstalling new programs. Sometimes a very complicated setup is long and demanding extensive resources. At this time, it is not recommended to use your computer for anything else. Give your PC a rest and let it concentrate on the task. Even thou you do not touch it, it might become unresponsive for some time. Be patient and give your computer a fair chance to complete the process normally. Trust me, trying to repair the damage later will be more time and nerves consuming.
Sources and additional information:
http://bucarotechelp.com/computers/windowsts/95071401.asp
http://www.instant-registry-fixes.org/repair-dll-errors/
http://pcperformancetools.com/30-common-dll-errors.html
http://www.dll-error.com/dll-error-prevention.php

4 comments:

Business Web Design UK said...

Hey,
Great Podcast! I most certainly wouldn't give up :)

Brad Fallon said...

What are the possible ways for the corruption of system32 and its supporting files, what will be the solution?

Michael Pekker said...

Hi Brad,
System 32 contains the most important drivers for the system functionality. In most cases, there is just one or few drivers damaged, not entire system folder, but that depends on the problem appearance. Several ways of recovery:
1. Roll back to the last Good Configuration.
2. Structure repair with ScanDisk or other system repair utilities.
3. Repair Windows through boot-up disk.
4. Reinstall HDD from the saved good drive image.
But, first, before going for big time-consuming steps, identify and try to address the particular problem you are facing.

Anonymous said...

Very nice post. I just stumbled upon your blog and wanted to say
that I have truly enjoyed surfing around your blog posts.
After all I will be subscribing to your rss feed and I hope you write again very soon!


My webpage; cpanel

Related Posts Plugin for WordPress, Blogger...