Windows some processing of DLL files

  
 

Windows
DLL files can be aliased, it is set in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\KnownDLLs, we can see the list of aliases with the registry editor .

For example, if there is a piece of data, kernel32 /kernel32.dll This record guarantees that the kernel32.dll version of system32 is always called when the LoadLibrary("kernel32.dll") is called. And it won't be the kernel32.dll in the current directory (if any). How is this done?

LoadLibrary found that the kernel32.dll (without explicitly specifying the path) needs to be loaded in the parameter string, then the DllDirectory item will be found in the registry, and kernel32.dll will be loaded in the specified path.

Note that the key names here are not suffixed with .dll. When the system recognizes whether the dll belongs to KnownDLLs, it can only work on files that need to be loaded with a .dll extension, and then cut off the suffix when matching the key name.

We can also change the registry to achieve the effect of renaming these system DLLs.

<strong>About COM object DLLs stored in local directories</strong>

Registered COM objects, if you are afraid of conflicting with other software, you can use DLL to transfer technology. However, this is not supported in Windows 98.

For example, myapp.exe wants to force the DLL in the current directory to be loaded first. Just create a file named myapp.exe.local. After starting myapp.exe, the DLL will be loaded from the current directory first.

Copyright © Windows knowledge All Rights Reserved