Dynamic-Link Library Redirection
Dynamic-Link Library Redirection
Applications can depend on a specific version of a shared DLL and start to fail if another application is installed with a newer or older version of the same DLL.
There are two ways to ensure that your application uses the correct DLL:
DLL redirection and side-by-side components.
Developers and administrators should use DLL redirection for existing applications, because it does not require any changes to the application.
If you are creating a new application or updating an application and want to isolate your application from potential problems, create a side-by-side component.
To use DLL redirection, create a redirection file for your application.
The redirection file must be named as follows:
App_name.local
For example, if the application name is Editor.exe, the redirection file should be named Editor.exe.local
You must install the .local file in the application directory.
You must also install the DLLs in the application directory.
The contents of a redirection file are ignored, but its presence causes Windows
to check the application directory first whenever it loads a DLL, regardless of the path specified to LoadLibrary or LoadLibraryEx.
If the DLL is not found in the application directory, then these functions use their usual search order.
For example, if the application c:\myapp\myapp.exe calls LoadLibrary using the following path:
c:\program files\common files\system\mydll.dll
And, if both c:\myapp\myapp.exe.local and c:\myapp\mydll.dll exist,
LoadLibrary loads c:\myapp\mydll.dll.
Otherwise,LoadLibrary loads c:\program files\common files\system\mydll.dll.
Alternatively, if a directory named c:\myapp\myapp.exe.local exists and contains mydll.dll,
LoadLibrary loads c:\myapp\myapp.exe.local\mydll.dll.
Known DLLs cannot be redirected.
For a list of known DLLs, see the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs.
The system uses Windows File Protection to ensure that system DLLs such as these are not updated or deleted
except by operating system updates such as service packs.
If the application has a manifest, then any .local files are ignored.
If you are using DLL redirection and the application does not have access to all drives and directories in the search order,
LoadLibrary stops searching as soon as access is denied.
(If you are not using DLL redirection, LoadLibrary skips directories that it cannot access and then continues searching.)
It is good practice to install application DLLs in the same directory that contains the application,
even if you are not using DLL redirection.
This ensures that installing the application does not overwrite other copies of the DLL and cause other applications to fail.
Also, if you follow this good practice, other applications do not overwrite your copy of the DLL and cause your application to fail.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
2013-09-06 Altium Protel PCB Layer
2012-09-06 BCM2046 Bluetooth on new 8,3 MacBook Pro -- USB Interface Descriptor -- bAlternateSetting