internal static ComInteropProxy GetProxy(IntPtr pItf, Type t)
{
Guid iid_IUnknown = __ComObject.IID_IUnknown;
IntPtr intPtr;
int errorCode = Marshal.QueryInterface(pItf, ref iid_IUnknown, out intPtr);
Marshal.ThrowExceptionForHR(errorCode);
ComInteropProxy comInteropProxy = ComInteropProxy.FindProxy(intPtr);
if (comInteropProxy == null)
{
Marshal.Release(pItf);
return(new ComInteropProxy(intPtr));
}
Marshal.Release(pItf);
Interlocked.Increment(ref comInteropProxy.ref_count);
return(comInteropProxy);
}