Geting the ProcessID of the client that makes COM call running as dllSurrogate?

amrut anegundi 1 Reputation point
2021-04-15T09:26:08.087+00:00

I am kind of new to COM and had a query. We have registered a COM DLL as DLLSurrogate to run under default dllhost.exe.
We have an app/3rd party app that is consuming this COM, and when we try to get the current process id it is returning the process id of dllhost.exe and not the app.
Is there a way to get the process id of the client that made the COM call (app)?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,427 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,540 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Song Zhu - MSFT 906 Reputation points
    2021-04-16T07:18:15.97+00:00

    Refer to: Determine the Process ID of the Client Process communicating with a COM RPC Server
    I think you cannot get the identifier of the process.

    1 person found this answer helpful.

  2. RLWA32 40,656 Reputation points
    2021-04-17T17:21:02.537+00:00

    An out-of-process COM server handling an incoming call from a COM client can use the RpcServerInqCallAttributes function and request RPC_QUERY_CLIENT_PID in the RPC_CALL_ATTRIBUTES_V2 struct that is passed to the function.

    1 person found this answer helpful.