简体   繁体   中英

Log calls to QueryInterface in managed COM server

I followed the example here to create a C# out-of-process COM server.

My server is used from a third-party application I don't have control over. In order to find out which interfaces they ask for when loading my component, I'd like to log all their calls to the QueryInterface method. However, because I'm using .NET I can't implement IUnknown::QueryInterface on my own - it is instead automatically provided by the CCW (COM callable wrapper).

Is there a way to log all the calls to QueryInterface for my C# COM server?

I'm sorry for answering my own question, but after some very research intensive days of work, I found that since .NET 4 one can implement ICustomQueryInterface and provide his own managed implementation of QueryInterface. Adding logging to it will be very easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM