LoadLibrary - 加载已由另一个进程加载的DLL [英] LoadLibrary - Load DLL already loaded by another process

查看:251
本文介绍了LoadLibrary - 加载已由另一个进程加载的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


关于LoadLibrary的MSDN文章 


msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v = vs.85).aspx


为Windows 7提及:"如果具有相同模块名称的DLL是已加载到内存中,系统使用加载的DLL,无论它在哪个目录。系统不搜索DLL。"
$


问题:



   这个声明是关于一个DLL加载到内存中的BY THE PROCESS调用LoadLibrary还是任何一个已经为给定模块名称调用了LoadLibrary的进程?

   指定模块的完整路径是否会产生影响?



    LoadLibrary在Windows 7和Windows 10之间的行为是否有所不同?
$


我正在尝试确定在我的Windows 7进程之前是否有另一个进程加载了libssl32.dll能够加载我自己的这个DLL的版本或受其他进程已加载的任何版本的限制。


谢谢。


Rex

解决方案

您好,


感谢您发布MSDN论坛。


>>"  这个声明是关于一个DLL加载到内存中的BY THE PROCESS调用LoadLibrary还是已经为给定模块名调用LoadLibrary的ANY PROCESS? " "


据我所知,进程环境块不包含该语句,以下是我的理解。


首先在同一个库中,如果要将其加载到两个进程中,则需要执行两次LoadLibrary。因为模块句柄不是全局的或可继承的。一个进程对LoadLibrary的调用不会产生另一个进程可以使用 b

的句柄,例如,在调用GetProcAddress时。在调用GetProcAddress之前,另一个进程必须为模块调用LoadLibrary。


>>"指定模块的FULL路径是否会产生影响? "


如果启用安全DLL搜索模式,此操作将更改搜索顺序。


>>"   LoadLibrary在Windows 7和Windows 10之间的行为是否有所不同? "


我认为Windows应用商店应用会有不同的行为。当Windows应用商店应用通过调用

LoadPackagedLibrary
函数,DLL必须在进程的包依赖关系图中。 


关于windows进程环境块,我建议你可以阅读这本名为windows internal的第六版。


PEB( 进程环境块)可以包含句柄表,我猜该表将包含库模块句柄。


我希望这个回复会对你有所帮助。


最好的问候,


Hart



An MSDN article on LoadLibrary  

(msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx)

mentions this for Windows 7: "If a DLL with the same module name is already loaded in memory, the system uses the loaded DLL, no matter which directory it is in. The system does not search for the DLL."

Questions:

    Is this statement about a DLL loaded in memory for BY THE PROCESS calling LoadLibrary or ANY PROCESS that has already called LoadLibrary for a given module name?
    Does specifying the FULL path to the module make a difference?

    Does LoadLibrary behave differently between Windows 7 and Windows 10?

I am trying to determine if another process loads libssl32.dll before my process in Windows 7 will I be able to load my own version of this DLL or be subject to whatever version that other process already loaded.

Thank you.

Rex

解决方案

Hi,

Thank you for posting MSDN forum.

>>"  Is this statement about a DLL loaded in memory for BY THE PROCESS calling LoadLibrary or ANY PROCESS that has already called LoadLibrary for a given module name? "

As far as I know that the process environment block doesn't contain the statement, The following is my understand.

First the same library, if you want to load it into two process, you need to perform LoadLibrary two times. because the module handles are not global or inheritable. A call to LoadLibrary by one process does not produce a handle that another process can use

for example, in calling GetProcAddress. The other process must make its own call to LoadLibrary for the module before calling GetProcAddress.

>>" Does specifying the FULL path to the module make a difference? "

If you enable the safe DLL search mode, this operation will change the search order.

>>"   Does LoadLibrary behave differently between Windows 7 and Windows 10? "

I think that the Windows Store apps will has different behave. When a Windows Store app loads a packaged module by calling the LoadPackagedLibrary function, the DLL must be in the package dependency graph of the process. 

About windows process environment block, I suggest that you can read the book called windows internal the sixth edition.

The PEB( process environment block) can contain the handle table, I guess that the table will contain the library module handle.

I hope that the reply would be helpful for you.

Best Regards,

Hart


这篇关于LoadLibrary - 加载已由另一个进程加载的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆