tags:

views:

63

answers:

2

From an out-of-process COM object (LocalServer32) can I determine the client process that requested the creation of the object? - to be specific I need to get hold of the client processes command line.

This question arrises because (due to poor standardisation, implementation and support) the potential 3rd party clients of the object have a variety of idiosyncracies which the object needs to workaround.

To do this the object needs to be able to identify its current client.

Extending the interface of the COM object so that the client can identify itself is unfortunately not possible ... or to be more precise the interface can be extended but I won't be able to get the clients to call the extension.

+2  A: 

Having looked into this further I suspect the answer is going to be "NO", but by all means tell me 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 the client application.

Tom Williams
A: 

Maybe CoImpersonateClient()

Anders
I don't think so. That looks like it allows me to pretend that I have the clients security attributes.
Tom Williams
Did you try to call OpenThreadToken+GetTokenInformation (after CoImpersonateClient) You shoud at least be able to find the logon session luid and user logon sid.
Anders
I'm sorry, but given that information how would I get to the client process of the COM object?
Tom Williams