问题描述
我正在尝试将现有的本机 C++ ATL 进程内 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.
我从通常的注册表设置开始 - 我有一个 HKCRCLSID{classId} 条目和一个 InProcServer32 键,用于指定 .dll 文件的路径.
I started with a usual registry setup - I have a HKCRCLSID{classId} entry and an InProcServer32 key there specifying the path to the .dll file.
我生成了一个应用程序 ID (GUID) 并随处添加了它.具体来说,我在 HKCRCLSID{classId} 下添加了一个字符串值AppId",等于应用程序 ID.我还添加了一个 HKCRAppId{applicationId} 键和一个等于空字符串的字符串值DllSurrogate".我认为这足以迫使我的 COM 服务器成为系统提供的默认代理.
I generated an application id (GUID) and added it here and there. Specifically I added a string value "AppId" under HKCRCLSID{classId} equal to the application id. I also added a HKCRAppId{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 的注册表,该类 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
位,并且 CLSID 键未指定 LocalServer32、LocalServer 或 LocalService.(已检查) - CLSID 键包含 InprocServer32 子键.(已检查)
- 在 InprocServer32 键中指定的代理/存根 DLL 存在.???
- DllSurrogate 值存在于 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 加载到单独的进程中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!