从exe检索COM ProgID而不注册它 [英] Retrieve COM ProgID from exe without registering it

查看:387
本文介绍了从exe检索COM ProgID而不注册它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:



我想从VB6应用程序中提取COM数据,所以我可以正确注册(根据Microsoft最佳实践)应用程序。我使用WiX 3.0和heat.exe将不会提取数据(已知问题与热),我没有准备访问相关的TLB文件。 VB6应用程序没有启用兼容性,因此它会重新生成每个版本的COM GUID(他们希望应用程序能够与旧版本并行运行。)



我创建了一个C#应用程序,它将从VB6应用程序收集TypeLib,接口和CoClass信息,而无需注册它,并创建一个蜡烛使用的wxs文件。



问题:



1.有没有办法从应用程序中收集项目或TLB文件中没有注册的trueProgID(程序员想要的)?



2.有没有办法从DLL中找出预期的线程模型而不注册它? (我打算可以处理所有COM活动项目,也可以完成)
谢谢。

解决方案

是的和没有。



据我所知,没有通用的方法来从typelib或COM服务器中获取ProgID。



DLL的入口点是 DllRegisterServer ,它应该将注册信息写入注册表,对于EXE服务器,它们通常有一个命令行参数类型库恰好包含组件中所有接口和类的描述,但它们很少包含人类可读的ProgID。



我可以看到和推荐的唯一清楚的方法是覆盖HKCR \CLSID键暂时指向某处,然后调用 DllRegisterServer 。由于注册表项覆盖是进程本地的,因此只对进程(DLL)服务器有效。



请参阅 http://msdn.microsoft.com/en-us/library/ms724901(v = VS.85) .aspx 查看重写注册表项的信息。



然后检查临时注册表,看看做了什么更改,例如CLSID < - > ProgID映射,线程模型等。


Background:

I would like to extract the COM data from a VB6 application so I can register it correctly (according to Microsoft best practice) the application. I am using WiX 3.0 and heat.exe will not extract the data (known issue with heat) and I do not have ready access to the associated TLB file. The VB6 application does not have compatibility turned on so it regenerates the COM GUIDs every build (They want to have the application be able to run side by side with an older version.)

I created a C# application that will collect the TypeLib, interface and CoClass information from the VB6 application without registering it and create a wxs file for candle to use. My company has several other older applications like this and I would like to make it a more generic solution.

The Issues:

1.Is there a way to collect the 'true' ProgID (programmer intended one) from the application with out the project or TLB file and without registering it?

2.Is there a way to find out the intended Threading Model from a DLL without registering it? (I intend that it can handle all COM active items, might as well be complete) Thank you.

解决方案

Yes and no.

As far as I know, there's no generic way to get ProgIDs out of a typelib or COM server.

The entry point for DLLs is DllRegisterServer which is supposed to write registration information to the registry, and for EXE servers they usually have a command-line argument that has the same implication.

Type libraries happen to contain a description of all interfaces and coclasses in the component, but they rarely contain the human-readable ProgID.

The only clear way I can see and recommend is to override HKCR\CLSID key to point to somewhere temporarily, and then call DllRegisterServer. As registry key overrides are process-local this will only work for in-process (DLL) servers.

See http://msdn.microsoft.com/en-us/library/ms724901(v=VS.85).aspx for info on overriding registry keys.

Then inspect the scratch registry and see what changes were made, e.g. CLSID<->ProgID mappings, threading model, etc.

这篇关于从exe检索COM ProgID而不注册它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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