HOWTO: Win95 Uses Known16DLLs Registry Key to Find 16-bit DLLs

Article translations Article translations
Article ID: 141969 - View products that this article applies to.
This article was previously published under Q141969
Expand all | Collapse all

SUMMARY

The process of loading a DLL for the first time, implicitly or explicitly, invokes Windows 95 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 Known16DLLs registry key have the ability to reset the normal search order used to locate and load a 16-bit DLL to a new predefined order. Thus, a string value that identifies a 16- bit DLL and is also associated with the Known16DLLs registry key will force Windows 95 to begin its search for the DLL in the System directory - not the current directory.

MORE INFORMATION

In Windows 95, the predefined order that is used to locate and load a 16-bit DLL is specified as follows:
  1. The current directory.
  2. The Windows directory (the directory containing Win.com).
  3. The Windows system directory (the directory containing such system files as Gdi.exe).
  4. The directory containing the executable file for the current task.
  5. The directories listed in the PATH environment variable.
NOTE: If a 16-bit DLL is already loaded by some running application, Windows 95 does not search for the DLL to load, even if the full path name is supplied to LoadLibrary. Instead Windows 95 will resolve the imports to link to the DLL already in memory.

This search order is reset if a 16-bit DLL being loaded has a string value with the same name as the 16-bit DLL specified in the Known16DLLs registry key. The Known16DLLs registry key is located at:

   HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SessionManager
				


The data associated with the DLL string value can take any form. An example of such a string value is:

Name                       Data
-----------------------------------------------
"COMMCTRL.DLL"             "SYSTEM COMMCTRL.DLL"
				


When a string value for a 16-bit DLL exists, the new search order is as follows:
  1. The Windows system directory.
  2. The Windows directory.
  3. The current directory.
  4. The directory from which the application loaded.
  5. The directories that are listed in the PATH environment variable.
There are three ways that this DLL string value can be added to the registry:
  • An end user can use Regedit.exe to add the 16-bit DLL string value to the Known16DLLs registry key.

    -or-
  • The 16-bit DLL string value can be added programmatically to the Known16DLLs registry key using registry APIs.

    -or-
  • Windows 95 can automatically add the 16-bit DLL string value to the Known16DLLs registry key.
The first two ways to add the 16-bit DLL string value are basic and require no further explanation; however, the third method is more complex. Each time a 16-bit DLL is loaded from the Windows System directory, Windows 95 checks the Known16DLLs registry key for a string value that has that same name. If the string value does not exist, Windows 95 creates it in the Known16DLLs registry key. Thus, any application that uses a DLL that has the same name as a DLL listed in the Known16DLLs registry key will always use the reset search order to locate the DLL. As long as the DLL exists in the Windows System directory and can be loaded by another application, deletion of the string value will not be effective in returning the search order to its original predefined state.

Properties

Article ID: 141969 - Last Review: November 21, 2006 - 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: 
kbdll kbenv kbhowto kbkernbase KB141969
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

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