The information in this article applies to:
- Microsoft Win32 Application Programming Interface included with:
- Microsoft Windows 95
- Microsoft Win32 Software Development Kit for:
- Microsoft Windows 95
SUMMARY
The process of loading a DLL, 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 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 to
begin its search for the DLL in the System directory, not the current
directory.
MORE INFORMATION
In Windows 95, 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:
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:
- 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.
-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.
|