How to get process handle of a local COM server?

2019-02-26 00:56发布

I have an IUnknown pointer to a COM local (out of process) server in my Windows client application. Would like to get a handle to the window process that is running the local COM server.

Any way to do this via COM without adding a new interface to the server to request the process handle? (I can't easily change the server).

Why do I want to do this? Because I am trying to make sure the out-of-proc COM server gets shutdown IF my application crashes. I wanted to use windows job objects for this.

标签: com
1条回答
beautiful°
2楼-- · 2019-02-26 01:34

I assume you mean an out-of-process server. No, COM is heavily invested in preventing you from retrieving this information. Important so it can host the COM object as it sees fit. Which enables things like surrogates, DCOM and the COM+ stuff.

You'll need the interface method.

查看更多
登录 后发表回答