LoadLibrary 引用计数 [英] LoadLibrary Reference Counting

查看:141
本文介绍了LoadLibrary 引用计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 MSDN:

系统在所有加载的模块上维护每个进程的引用计数.调用 LoadLibrary 会增加引用计数.

The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count.

引用计数存储在哪里?

推荐答案

实际的 windows 加载器位于 NTDLL.dll 的 LdrLoadDll 函数.此功能未记录在案,其内部功能可能会在未来版本的 windows 中发生变化;只有那些有权访问 Windows 源代码的人才能确定幕后发生了什么.

The actual windows loader is found in NTDLL.dll's LdrLoadDll function. This function is undocumented, and its internal functionality is subject to change in future versions of windows; only those with access to the windows source code could state for certain what happens behind the scenes.

不过,wine 的源码是可以的,可以看到增加引用计数;它存储在 LDR_MODULE 堆结构.由于这似乎不是酒的内部结构,因此该结构很可能基于真实的、逆向工程的 windows 结构,因此 windows 可能以相同的方式存储它.但是,由于这是未记录的,因此它可能会在任何未来版本的 Windows 中更改,甚至可能会在 Windows 小补丁中更改.

However, wine's source is available, and you can see where it increments the reference count; it's stored in the LoadCount member of the LDR_MODULE heap structure. Since this doesn't seem to be a wine-internal structure, it's likely that this structure is based off the real, reverse-engineered windows structures, and thus windows probably stores it in the same way. However, since this is undocumented, it is subject to change in any future version of windows, or even with minor windows patches.

这篇关于LoadLibrary 引用计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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