Windows中COM注册如何工作 [英] How does COM registration work in Windows

查看:100
本文介绍了Windows中COM注册如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个应用程序包装商,试图弄清楚COM注册表项(SelfReg)与Windows中给定.dll的相互关系。

I'm an application packager trying to make sense of how the COM registry keys (SelfReg) interrelate to the given .dll in Windows.

ProgID,AppID, TypeLib,扩展和动词全都绑在CLSID上了吧?
CLSID是否总是使用Prog / App ID,还是只具有文件扩展名类?
哪些位是可选的?

ProgID's, AppID's, TypeLibs, Extensions & Verbs are all tied around the CLSID right? Do CLSID's always use Prog/App IDs or could you just have a file extension class? Which bits are optional?

其中有些好像是路由器,其中有两个接口(内部-.dll)和外部(扩展名等)。

Some of it seems to be 'like a router' where there's the two interfaces (internal - .dll) and external (the extension etc).

这一切如何适应? (SDK文档对我没有意义)

How does this all fit? (The SDK documentation doesn't make sense to me)

我问,因为这对于使用Windows Installer进行应用程序恢复至关重要(打包程序都是大程序)继续,但是由于它实际上是编码器,所以没有实质性的故障。

I ask as this is all pivotal to application 'healing' with Windows Installer (which packagers are all 'big' on, but there's no nitty-gritty breakdowns since its a coder-thing really)

---编辑:
我可以肯定地认为,对于COM已注册,它必须全部链接回CLSID,并且不能为死胡同吗?
动词需要扩展,需要progid的扩展。

--- Am I safe in assuming that for what COM is registered, it must all link back to the CLSID and cannot be a 'dead-end'? Verbs need extensions which need progid's...

AppId,TypeLib和接口如何?它们如何相互关联?

What about the AppId's, TypeLibs and Interfaces? How do they interrelate?

推荐答案

首先要认识到的是COM dll自己注册。他们会将所有必需的条目放入注册表中的正确位置。

The first thing to realise, is that COM dlls register themselves. They will put all the required entries into the correct places in the registry.

我认为,关于哪些位是可选的中心问题的答案可能是它们都是可选的用于不同类型的对象。如果自动化对象是可公共创建的,则它们需要Prog / AppID,但如果仅在内部创建,则不需要Prog / AppID,类似地,可以列出一个不可公共创建的COM类。

I think the answer to your central question about which bits are optional is probably that they are all optional for different types of objects. Automation objects require Prog/AppIDs if they are publicly creatable, but may not if they are only created internally, similarly a non- publicly creatable COM class can be listed.

许多不具有自动化接口的COM对象(例如,Microsoft在Windows内部使用的许多COM类将没有任何ProgId,而仅在其下有一个条目

Many COM objects that do not have automation interfaces (such as many of the COM classes microsoft uses internally in windows will not have any ProgId but will simply have an entry under their CLSID in HKCR\CLSID.

如果我对您的理解是正确的,那么您会从安装程序的角度对此感兴趣。我想您需要做的就是请用户指定要自动注册的dll,然后调用

If I understand you correctly you are interested in this from a installer perspective. I would imagine that all you need do is ask the user to specify which dlls are selfregistering and then call


regsvr32 dllname.dll

regsvr32 dllname.dll


exename.exe / Regserver

exename.exe /Regserver

用于进程外服务器。如果出现问题,您只需调用相反的命令即可。

for a out of process server. If something goes wrong you just need to call the opposites.


regsvr32 / u dllname.dll

regsvr32 /u dllname.dll


exename.exe / Unregserver

exename.exe /Unregserver

我希望这能回答您的问题。

I hope that this answers your question.

这篇关于Windows中COM注册如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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