Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pointer to IUnknown in C#

.NET interop wraps COM objects into .NET objects (runtime-callable wrappers, RCWs), which hide the usual interface querying. In order to register a COM object representing a filter graph with the Running Objects Table, I need the (native) address of its IUnknown interface (see How can I reverse engineer a DirectShow graph?).

So the question is: How can I get a COM object's IUnknown pointer in C#?

like image 939
Daniel Wolf Avatar asked Oct 15 '10 10:10

Daniel Wolf


1 Answers

Use Marshal.GetIUnknownForObject().

like image 55
Hans Passant Avatar answered Nov 15 '22 15:11

Hans Passant