更改DLL的CLSID [英] Changing the CLSID of a DLL

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

问题描述

我正在尝试使用涉及用C ++编写的DLL的旧代码创建应用程序.
我保留了基本接口不变,但是需要更改DLL和组件的名称.我还更改了所有GUID,包括coclass的CLSID.
但是,当我编译并链接DLL时,发现使用了
的应用程序. dll返回错误消息,提示我正在尝试的组件
实例化未注册.
我使用了Oleview,发现即使更改了组件的名称,
CLSID仍然相同.我尝试搜索与旧的CLSID匹配的代码,但在任何地方都找不到.我搜索了注册表,所有对COM组件的引用都具有新的CLSID.
我已经尝试了几次,但是结果总是一样的.该组件显示Oleview具有旧的CLSID.即使代码中已更改,我似乎也无法更改它.我什至在注册表中删除了它.还是没有运气.
我已经更改了.idl和.rgs文件
顺便说一句,请怜悯,我知道一些COM,但我还远不是专家.
我在这里想念什么?

附加信息:

首先,dll已成功通过编译和链接注册.我成功地在注册表中获得了与DLL相对应的四个条目,这是成功"的意思.问题在于某些条目具有与新DLL匹配的GUID(如IDL文件中列出的),而另一些条目则具有与旧DLL匹配的GUID:

HKEY_CLASSES_ROOT \ CLSID \-新的CLSID
HKEY_CLASSES_ROOT \ TypeLib \-类型库的旧CLSID
HKEY_CLASSES_ROOT \< interface class ="> -新的CLSID
HKEY_CLASSES_ROOT \ Interface \-类型库的旧GUID
HKEY_CLASSES_ROOT \ Interface \-事件库的旧GUID

我可以擦除它们,重新编译并链接,然后发生同样的事情.
当我使用OleView并打开TLB文件时,我得到了新的GUID.但是,
如果我打开DLL文件本身,则会显示所有旧的GUID.

我已经在与项目相关联的每个文件中搜索了旧的GUID字符串,但找不到任何东西.

有任何想法吗?

I am trying to create an application using legacy code involving a DLL written in C++.
I left the basic interface the same, but needed to change the name of the DLL and the component. I also changed all the GUID''s, including the CLSID of coclass.
However, when I compiled and linked the DLL, I found that the application that used
the dll came back with an error message to the effect that the component I was trying
to instantiate was not registered.
I used Oleview and found out that even though the name of the component was changed,
the CLSID was still the same. I tried searching to code to match to old CLSID, but could not find it anywhere. I searched the registry and all references to the COM component have the new CLSID.
I have tried several times, but the result is always the same. The component shows up Oleview as having the old CLSID. I can''t seem to change it, even though it is changed in the code. I even erased it in the registry. Still no luck.
I have changed both the .idl and .rgs files
BTW, have mercy, I know some COM, but I am far from an expert.
What am I missing here?

Additional Information:

First, the dll is successfully registered with the compile and link. "Successfully" in the sense that I get four entries in the registry corresponding to the DLL. The problem is that some of the entries have GUID''s matching the new DLL (as listed in the IDL file) and others have them matching the old DLL:

HKEY_CLASSES_ROOT\CLSID\ - New CLSID
HKEY_CLASSES_ROOT\TypeLib\ - OLD CLSID for type library
HKEY_CLASSES_ROOT\ <interface class=""> - NEW CLSID
HKEY_CLASSES_ROOT\Interface\ - Old GUID for type library
HKEY_CLASSES_ROOT\Interface\ - Old GUID for event library

I can erase these, recompile and link and I have the same thing happen.
When I use OleView and open the TLB file, I get the new GUID''s. However,
if I open the DLL file itself, all the old GUID''s show up.

I have searched through every file associated with the project for the old GUID strings and cannot find a thing.

Any ideas?

推荐答案

我想你打 ^ ]看起来网上没有太多有关它的信息.
I suppose you hit this[^] unfortunately it looks there isn''t much info about it on the web.


您应该调试DllRegisterServer()函数可找出您的COM-dll注册了哪个CLSID以及在何处进行更改.
祝你好运.
You should debug the DllRegisterServer() function to find out which CLSID is registered by your COM-dll and where to change it.
Good luck.


检查代码中的所有这些内容

1)Clsid,.idl文件中的接口名称
2)VS2008中有两个.rgs文件,也更改了接口名称,并且更改的clsid与您在.idl文件中指定的相同.
3)尝试直接直接手动执行.rgs文件,并检查其是否正确注册.可能是在更改期间文件已损坏.

可能对您有帮助....
Check all these things in your code

1) Clsid, Name of Interface in .idl file
2) There are two .rgs file in VS2008, change the name of interface also and changed clsid is same that you given in .idl file.
3) Try to directly execute the .rgs file manually and check is it properly registered or not. May be during changes the file is corrupted.

May be this will help you....


这篇关于更改DLL的CLSID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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