注册DLL是做什么的? [英] What does registering a DLL do?

查看:328
本文介绍了注册DLL是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何注册dll,但我从来没有真正地确定为什么我做它或在什么条件下必须注册一个dll。有人能解释或指点我的一些文件吗?

解决方案

注册DLL时, DllRegisterServer 您的DLL被调用。类似地,当未注册DLL时调用 DllUnregisterServer
$ b 此MSDN文章



< blockquote>

指示进程内服务器
为此服务器
模块中支持的所有
类创建其注册表项。如果此函数失败,注册表对所有
类的
状态是不确定的。


对于COM DLLs,你将需要实现你自己的 DllRegisterServer DllUnregisterServer 入口点方法,注册/取消注册适当。可以找到 DllRegisterServer 的示例代码 here



注册DLL的最终结果是DLL中组件的所有CLSID都注册在 HKEY_CLASSES_ROOT\CLSID 。这允许 CoCreateInstance 在从另一个DLL或应用程序实例化COM对象时找到正确的服务器。



DllUnregisterServer 将执行相反的操作,并从 DllRegisterServer 中删除​​注册表中的所有CLSID。



有关 DllRegisterServer 的更多一般信息,请访问此处


I know how to register dlls but I've never really been sure why I'm doing it or under what conditions a dll must be registered. Could somebody explain or point me to some documentation?

解决方案

When a DLL is registered, the DllRegisterServer method entry point in your DLL is invoked. Similarly, DllUnregisterServer is invoked when a DLL is unregistered.

As described in this MSDN article:

Instructs an in-process server to create its registry entries for all classes supported in this server module. If this function fails, the state of the registry for all its classes is indeterminate.

For COM DLLs, you will need to implement your own DllRegisterServer and DllUnregisterServer entry point methods which do the registering/unregistering as appropriate. Example code for DllRegisterServer can be found here.

The end result of registering a DLL is that all of the CLSIDs for the components in the DLL are registered under HKEY_CLASSES_ROOT\CLSID. This allows CoCreateInstance to find the correct server when instantiating COM objects from another DLL or application.

DllUnregisterServer will do the reverse, and remove all of the CLSIDs from the registry that were put in there by DllRegisterServer.

More general information about DllRegisterServer can be found here.

这篇关于注册DLL是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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