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.

时间: 2024-08-01 08:21:31

Dynamic-Link Library Redirection的相关文章

Custom Action : dynamic link library

工具:VS2010, Installshield 2008 实现功能: 创建一个C++ win32 DLL的工程,MSI 工程需要调用这个DLL,并将MSI工程中的两个参数,传递给DLL, 参数1:Property 表中的 ProductName 参数2:操作 MSI 工程的 installer database 的 Handle 对参数1的操作:通过对话框的方式显示出来. 对参数2的操作:读取 Property 表中的 ProductName 属性,通过对话框的方式显示出来. 步骤一.VS20

注意 electron 的 Error: A dynamic link library (DLL) initialization routine failed

把dll的load放在Electron中,就会报一个错: Error: A dynamic link library (DLL) initialization routine failed 这显然就是dll没有加载成功,为什么在Node中已经试过没问题的方法会在Electron中出问题,我此刻内心是惶恐的,因为Electron是我们最终的javascript运行容器,如果这种加载外部库的方式不可用,那意味着之前的一些技术方案都要重来,怀着忐忑的心情,我搜了一下,好在有非常贴合的问题并有相当具体的

[DLL] Dynamic link library (dll) 的编写和使用教程

前一阵子,项目里需要导出一个DLL,但是导出之后输出一直不怎么对,改了半天才算改对...读了一些DLL教程,感觉之后要把现在的代码导出,应该还要花不少功夫...下面教程参照我读的3个教程写成,所以内容比较多: http://www.tutorialspoint.com/dll/index.htm http://www.tuicool.com/articles/ZVBnE3b http://www.cnblogs.com/cswuyg/archive/2011/10/06/DLL2.html 第三

动态链接库(Dynamic Link Library)学习笔记(附PE文件分析)

转载:http://www.cnblogs.com/yxin1322/archive/2008/03/08/donamiclinklibrary.html 作者:EricYou 转载请注明出处 注:本文所写的动态链接库指传统的DLL,并非是.NET中的Assembly. 我对动态链接和动态链接库的概念并不陌,但一直以来就停留在概念的层面上,没有更深入的了解.今天抽空看了一下有关动态链接和动态链接库的文章,有了一些新的认识,当然不能忘了写在这里.那么现在就开始... 什么是动态链接和动态链接库  

How to Creat DLL(Dynamic link library)

该文章属于在YouTube视频上看到的,链接如下: https://www.youtube.com/watch?v=EmDJsl7C9-k&t=3s 1.创建一个工程并建立一个控制台程序 2.Solution-->右键新建dll工程 3.Solution-->右键属性,选择依赖项,确定 4.CppClient-->右键设置属性$(SolutionDir)myLib\,inherit打勾,确定 5.VC++Directories-->Library Directories--

Linux Programe/Dynamic Shared Library Entry/Exit Point && Glibc Entry Point/Function

目录 1. 引言 2. C/C++运行库 3. 静态Glibc && 可执行文件 入口/终止函数 4. 动态Glibc && 可执行文件 入口/终止函数 5. 静态Glibc && 共享库 入口/终止函数 6. 动态Glibc && 共享库 入口/终止函数 1. 引言 0x1: glibc Any Unix-like operating system needs a C library: the library which defines t

gcc dynamic load library

Linux下一般都是直接在编译生成时挂接上链接库,运行时,把链接库放到系统环境里就可以了 但是windows出现带来了动态链接的概念,也就兴起了非windows世界的插件的概念的范潮 对应于windows下的 LoadLibrary GetProcAddress FreeLibrary Linux提出了 dlopen dlsym dlclose 的相关系统调用 哎,全是抄啊!!!! 一把泪 好了,我想你应该明白怎么回事了吧 下面,带你进入linux动态加载库的世界 这个是由libdl库来运作的噢

Delphi DLL制作和加载 Static, Dynamic, Delayed 以及 Shared-Memory Manager

一 Dll的制作一般分为以下几步:1 在一个DLL工程里写一个过程或函数2 写一个Exports关键字,在其下写过程的名称.不用写参数和调用后缀.二 参数传递1 参数类型最好与window C++的参数类型一致.不要用DELPHI的数据类型.2 最好有返回值[即使是一个过程],来报出调用成功或失败,或状态.成功或失败的返回值最好为1[成功]或0[失败].一句话,与windows c++兼容.3 用stdcall声明后缀.4 最好大小写敏感.5 无须用far调用后缀,那只是为了与windows 1

PatentTips - Systems, methods, and devices for dynamic resource monitoring and allocation in a cluster system

BACKGROUND? 1. Field? The embodiments of the disclosure generally relate to computer clusters, and more particularly to systems, methods, and devices for the efficient management of resources of computer clusters.? 2. Description of the Related Art?