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

This article was previously published under Q141969
This article has been archived. It is offered "as is" and will no longer be updated.
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 orderuntil the DLL is found or all search efforts are exhausted. In Windows 95,the string values associated with the Known16DLLs registry key have theability to reset the normal search order used to locate and load a 16-bitDLL 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 forceWindows 95 to begin its search for the DLL in the System directory - notthe current directory.
In Windows 95, the predefined order that is used to locate and load a16-bit DLL is specified as follows:
  1. The current directory.
  2. The Windows directory (the directory containing
  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 nameis supplied to LoadLibrary. Instead Windows 95 will resolve the imports tolink to the DLL already in memory.

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


The data associated with the DLL string value can take any form. An exampleof 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 asfollows:
  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 theregistry:
  • An end user can use Regedit.exe to add the 16-bit DLL string value to the Known16DLLs registry key.

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

  • 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 requireno further explanation; however, the third method is more complex. Eachtime a 16-bit DLL is loaded from the Windows System directory, Windows 95checks the Known16DLLs registry key for a string value that has that samename. If the string value does not exist, Windows 95 creates it in theKnown16DLLs registry key. Thus, any application that uses a DLL that hasthe same name as a DLL listed in the Known16DLLs registry key will alwaysuse the reset search order to locate the DLL. As long as the DLL exists inthe Windows System directory and can be loaded by another application,deletion of the string value will not be effective in returning the searchorder to its original predefined state.
search path 16 3.1 loadlibrary win95 order

Article ID: 141969 - Last Review: 01/16/2015 18:06:21 - Revision: 4.2

Microsoft Win32 Application Programming Interface

  • kbnosurvey kbarchive kbdll kbenv kbhowto kbkernbase KB141969