CoSetProxyBlanket not supported from managed code

COM objects are represented in managed code by runtime callable wrappers. I have written a reasonable summary of runtime callable wrappers (RCWs) here that you should read to understand the concepts in this entry.   CoSetProxyBlanket is a useful API to have control over COM security settings such as authentication and impersonation at the granularity…

1

The mapping between interface pointers and runtime callable wrappers (RCWs)

The term COM object is frequently thrown around, but people really access interfaces off of objects. The objects themselves are hidden. Managed is quite a bit different since interfaces are part of the system, but people can also access objects directly. When COM objects are accessed from managed, they are wrapped by a managed object…

3

ClassInterfaceType.None is my recommended option over AutoDispatch & AutoDual

Advanced to intermediate COM programmers are well aware of the problems with dual interfaces. I won’t discuss that here, but people should read Don Box’s book Essential COM if they want an excellent explanation of this. There is a good discussion of avoiding ClassInterfaceType.AutoDual at:   http://msdn2.microsoft.com/en-us/library/ms182205(VS.80).aspx   I will go further and recommend that…

1

A single Interop assembly does not work for different architectures

One of the exciting things about managed code is that it is quite a bit easier to write code that is portable across architectures. There is no question about the size of a short, int, or long integer. In fact, it is possible to write assemblies that run unaltered on 32 and 64 bit platforms….

1

Non-Cocreatable Class Objects No Longer Wrapped in NDP 2.0 and Later

I dealt with a customer attempting to automate Microsoft Outlook 2003 using the Outlook Primary Interoperability Assembly (Microsoft.Office.Interop.Outlook.dll) for the Microsoft Outlook 11.0 Object Library type library version 9.2.   The type library contains the following items:   … […noncreatable…] coclass MailItem {     [default] interface _MailItem;     [source] dispinterface ItemEvents;     [default, source] dispinterface…

5

Mismatch between object lifetime when bridging between COM and managed code

From time to time, I see object hierarchies like: interface IParent : IUnknown {     [propget] HRESULT Child([out, retval] IChild ** ppChild); } dispinterface IChildEvents {     // … } interface IChild : IUnknown { } coclass Parent {     [default] interface IParent; } [noncreatable] coclass Child {     [default] interface IChild;     [default, source]…

1