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.

Dynamic-Link Library Redirection的更多相关文章

  1. Walkthrough: Creating and Using a Dynamic Link Library (C++)

    Original Link: http://msdn.microsoft.com/zh-cn/library/ms235636.aspx Following content is only used ...

  2. Custom Action : dynamic link library

    工具:VS2010, Installshield 2008 实现功能: 创建一个C++ win32 DLL的工程,MSI 工程需要调用这个DLL,并将Basic MSI工程中的两个参数,传递给DLL, ...

  3. How to Use the Dynamic Link Library in C++ Linux (C++调用Delphi写的.so文件)

    The Dynamic Link Library (DLL) is stored separately from the target application and shared among dif ...

  4. DYNAMIC LINK LIBRARY - DLL

    https://www.tenouk.com/ModuleBB.html MODULE BB DYNAMIC LINK LIBRARY - DLL Part 1: STORY What do we h ...

  5. Walkthrough: Create and use your own Dynamic Link Library (C++)

    参考网站:https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-librar ...

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

    前一阵子,项目里需要导出一个DLL,但是导出之后输出一直不怎么对,改了半天才算改对...读了一些DLL教程,感觉之后要把现在的代码导出,应该还要花不少功夫...下面教程参照我读的3个教程写成,所以内容 ...

  7. 动态链接库(Dynamic Link Library)

    DLL INTRODUCTION A DLL is a library that contains code and data that can be used by more than one pr ...

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

    转载:http://www.cnblogs.com/yxin1322/archive/2008/03/08/donamiclinklibrary.html 作者:EricYou 转载请注明出处   注 ...

  9. How to Create DLL(Dynamic link library)

    该文章属于在YouTube视频上看到的,链接如下: https://www.youtube.com/watch?v=EmDJsl7C9-k&t=3s 1.创建一个工程并建立一个控制台程序 2. ...

  10. Linux Dynamic Shared Library && LD Linker

    目录 . 动态链接的意义 . 地址无关代码: PIC . 延迟版定(PLT Procedure Linkage Table) . 动态链接相关结构 . 动态链接的步骤和实现 . Linux动态链接器实 ...

随机推荐

  1. shell ssh 批量执行

    ssh 批量执行命令 #版本1 #!/bin/bash while read line do Ip=`echo $line|awk '{print $1}'` Passwd=`echo $line|a ...

  2. [转]CMake cache

    CMakeCache.txt 可以将其想象成一个配置文件(在Unix环境下,我们可以认为它等价于传递给configure的参数). CMakeLists.txt 中通过 set(... CACHE . ...

  3. c++ 函数指针简单实例

    一开始看函数指针的时候我是很懵的,因为不知道它有什么用,之后慢慢就发现了自己的愚昧无知. 假设我们想实现一个数据结构,比如二叉搜索树,堆.又或者是一个快排,归并排序. 我们一般是直接在两个数要比较的时 ...

  4. 春夏秋冬又一春之Redis持久化

    历史文章推荐: 一只准程序猿的唠叨 可能是最漂亮的Spring事务管理详解 Java多线程学习(八)线程池与Executor 框架 面试中关于Redis的问题看这篇就够了 非常感谢<redis实 ...

  5. CentOS安装SVN客户端(rpm)

    http://mirrors.163.com/centos/6/os/x86_64/Packages/ 1.检查是已经安装了svn: rpm -qa subversion subversion-1.7 ...

  6. activiti流程跟踪图算法

    流程跟踪图-推导算法 工作中使用activiti实现流程图相关业务,但是上线后遇到问题,偶尔流程图出不来.查阅了一下画流程图的实现,基本上是参见:activiti-流程图颜色变化之一篇. 核心类,参见 ...

  7. Windows caffe VGG人脸识别

    caffe自带的例子有mnist和cifar10,cifar10和mnist的运行方式类型,下好图片数据文件后,训练例子中的模型,然后测试模型,也可以自己用图片进行预测分类(自己图片最好是cifar1 ...

  8. vim 如何与外界粘贴复制

    在学习使用vim 的过程序,我们知道在vim 里面,粘贴复制的命令是y/p ,但是我们总会碰到这样的问题:如何把vim 里面复制的内容粘贴到vim 之外或者把vim 外面复制的内容粘贴到vim 里面? ...

  9. How to return plain text from AWS Lambda & API Gateway

    With limited experience in AWS Lambda & API Gateway, it's struggling to find the correct way to ...

  10. shiro中async-supported报错 cvc-complex-type.2.4.a: Invalid content was found starting with element 'async-supported'. One of '{"http://java.sun.com/xml/ns/ javaee":init-param}' is expected.

    最近都在研究shiro这个框架,今天实施了一下,就报了如下错误: cvc-complex-type.2.4.a: Invalid content was found starting with ele ...