Can a COM object outside a process define its parent process?

From a COM object outside the process (LocalServer32), you can determine the client process that requested the creation of the object? - To be specific, I need to get the command line of client processes.

This question arises due to the fact that (due to poor standardization, implementation, and support) potential third-party clients of the object have many idiosyncrasies that the object must solve.

For this, the object must be able to identify its current client.

Expanding the interface of a COM object so that a client can identify itself, unfortunately, is not possible ... or, more precisely, the interface can be expanded, but I can not force clients to call the extension.

+5
source share
3 answers

Looking further at this, I suspect that the answer will be “NO,” but by all means, tell me that I'm wrong.

Using Process Explorer I can see that the parent process for my COM object is an instance of "svchost.exe" and not a client application.

+2
source

Since the processes of the COM server are shared by all clients of the same AppID, it is not possible to obtain the PID of the client application. As @Anders said, you can use CoImpersonateClient(or, better, call CoGetCallContextand poll received IServerSecurity ) to find the account and login session of the caller, but you cannot get the process itself.

, CLSID ( IIDs, , ) (non-legacy ) CLSID. CLSID, ( , ).

+1
0
source

All Articles