Windows 95, Windows 98, or Windows Me Uses KnownDLLs Registry Key to Find 32-bit DLLs

Article translations Article translations
Article ID: 151646 - View products that this article applies to.
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
Expand all | Collapse all

SUMMARY

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 is found or all search efforts are exhausted. In Windows 95, the string values associated with the KnownDLLs Registry key have the ability to reset the normal search order used to locate and load a 32-bit DLL to a new predefined order. Thus, a string value that identifies a 32-bit DLL and is also 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.

MORE INFORMATION


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:
  1. The directory from which the application loaded.
  2. The current directory.
  3. The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
  4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
  5. The directories that are listed in the PATH environment variable.
This search order is reset if:
  1. The DLL name passed to LoadLibrary specifies the .DLL extension.
  2. 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:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager
The data associated with the DLL string value must specify the actual DLL name for the DLL to be found and loaded. This DLL name does not need to match the string value name and is not required to following any naming convention. 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 the Windows system directory is as follows:
  1. If MYDLL1.DLL is passed to LoadLibrary, the Registry key MYDLL1 is used to load MYDLL.DLL.
  2. 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".
  3. 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.

    -or-
  • 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 be removed.

Properties

Article ID: 151646 - Last Review: September 30, 2013 - Revision: 4.2
APPLIES TO
  • Microsoft Win32 Application Programming Interface, when used with:
    • Microsoft Windows 95
    • Microsoft Windows 98 Standard Edition
    • Microsoft Windows Millennium Edition
Keywords: 
kbnosurvey kbarchive kbdll kbenv kbkernbase kbprogramming kbusage KB151646

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com