This article was previously published under Q151646
This article has been archived. It is offered "as is" and will no longer be updated.
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry
The process of loading a DLL, implicitly or explicitly, invokes Microsoft Windows 95, Windows 98, or Windows Millennium Edition (Me)to search for the specified DLL in a predefined order until the DLL isfound or all search efforts are exhausted. In Windows 95, the string valuesassociated with the KnownDLLs Registry key have the ability to reset thenormal search order used to locate and load a 32-bit DLL to a newpredefined order. Thus, a string value that identifies a 32-bit DLL and isalso associated with the KnownDLLs Registry key will force Windows 95, Windows 98, or Windows Me to begin its search for the DLL in the System directory, not the current directory.
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
In Windows 95, Windows 98, or Windows Me, the predefined order used to locate and load a 32-bit DLL is specified as follows:
The directory from which the application loaded.
The current directory.
The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
This search order is reset if:
The DLL name passed to LoadLibrary specifies the .DLL extension.
The 32-bit DLL specified has a Registry string value with the same name, excluding the extension, as the 32-bit DLL specified in the KnownDLLs Registry key. The KnownDLLs Registry key is located at:
The data associated with the DLL string value must specify the actual DLLname for the DLL to be found and loaded. This DLL name does not need tomatch the string value name and is not required to following any namingconvention. Some examples of such string values are:
Name Data ----------------------------------------------- MYDLL1 MYDLL.DLL MYDLL2 MYREALDLL2.DLL
When a string value for a 32-bit DLL exists, the new search order in theWindows system directory is as follows:
If MYDLL1.DLL is passed to LoadLibrary, the Registry key MYDLL1 is used to load MYDLL.DLL.
If the DLL name specified in the data value, MYDLL.DLL for example, cannot be found, LoadLibrary on MYDLL1.DLL will fail and a call to GetLastError will return error 2 "The system cannot find the file specified".
If MYDLL.DLL or MYDLL is passed to LoadLibrary, the normal search pattern is used to locate and load MYDLL.DLL.
Following are ways that this DLL string value can be added to the Registry:
An end user can use Regedit.exe to add the 32-bit DLL string value to the KnownDLLs Registry key.
The 32-bit DLL string value can be added programmatically to the Known32DLLs Registry key using Registry APIs.
To revert back to the default search pattern, the Registry key must beremoved.