我怎么配置DCOM将我的DLL加载到一个单独的进程? [英] How exactly do I config DCOM to load my DLL into a separate process?
问题描述
我试图强制一个现有的本地C + ATL in-proc COM服务器进入一个单独的进程。我希望DCOM可以为我做这个而不改变COM服务器。
I'm trying to force an existing native C++ ATL in-proc COM server into a separate process. I hope DCOM can do this for me without changing the COM server.
我开始与一个通常的注册表设置 - 我有一个HKCR\CLSID {classId}条目和InProcServer32键,其中指定.dll文件的路径。
I started with a usual registry setup - I have a HKCR\CLSID{classId} entry and an InProcServer32 key there specifying the path to the .dll file.
我生成了一个应用程序ID(GUID),并将其添加到此处。具体来说,我在HKCR\CLSID {classId}下添加了一个等于应用程序ID的字符串值AppId。我还添加了一个HKCR\AppId {applicationId}键和一个等于空字符串的字符串值DllSurrogate。我认为这足以强制我的COM服务器进入默认的系统提供的代理。
I generated an application id (GUID) and added it here and there. Specifically I added a string value "AppId" under HKCR\CLSID{classId} equal to the application id. I also added a HKCR\AppId{applicationId} key and a string value "DllSurrogate" equal to an empty string. I thought it would be enough for forcing my COM server into a default system-provided surrogate.
DCOM应用程序出现在DCOM配置控制台中。但是当我调用 CoCreateInstance()
或 CoGetClassObject()
并提供类id和 CLSCTX_LOCAL_SERVER
它返回类未注册。我做错了什么?
The DCOM application appears in the DCOM configuration console. However when I call CoCreateInstance()
or CoGetClassObject()
and provide the class id and CLSCTX_LOCAL_SERVER
it returns "Class not registered". What am I doing wrong?
UPD:已解决。所采取的步骤足以使它工作除了我正在编辑错误的类ID,由于某种原因在InProcServer32键下有相同的路径 - 也许这是一个COM地狱问题。
UPD: Resolved. The steps taken were enough to make it work except that I was editing the registry for the wrong class id that for some reason had the same path under InProcServer32 key - perhaps that was a COM hell issue.
推荐答案
- 必须在注册表中的CLSID键下指定AppID值,相应的AppID密钥。 (已选中)
- 在激活调用中,
CLSCTX_LOCAL_SERVER
位置1且CLSID键不指定LocalServer32,LocalServer或LocalService。 (选中) - CLSID键包含InprocServer32子项。 (选中)
- InprocServer32键中指定的代理/存根DLL存在。
- DIDSurrogate值位于AppID键下方。 (已选中)
- There must be an AppID value specified under the CLSID key in the registry, and a corresponding AppID key. (checked)
- In an activation call, the
CLSCTX_LOCAL_SERVER
bit is set and the CLSID key does not specify LocalServer32, LocalServer, or LocalService. (checked) - The CLSID key contains the InprocServer32 subkey. (checked)
- The proxy/stub DLL specified in the InprocServer32 key exists. ???
- The DllSurrogate value exists under the AppID key. (checked)
这篇关于我怎么配置DCOM将我的DLL加载到一个单独的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!