public object MarshalNativeToManaged(IntPtr pNativeData) { #if RECURSIVE_WRAPPING pNativeData = ManagedToNativeWrapper.GetInterface(NativeToManagedWrapper.GetInterface(pNativeData, true)); #endif return(NativeToManagedWrapper.GetInterface(pNativeData, false)); }
public IntPtr MarshalManagedToNative(object managedObj) { #if RECURSIVE_WRAPPING managedObj = NativeToManagedWrapper.GetInterface(ManagedToNativeWrapper.GetInterface((IStream)managedObj), true); #endif return(ManagedToNativeWrapper.GetInterface((IStream)managedObj)); }
public void Clone(out IStream ppstm) { IntPtr newInterface; ThrowExceptionForHR(managedVtable.Clone(comInterface, out newInterface)); ppstm = NativeToManagedWrapper.GetInterface(newInterface, true); }
internal static IntPtr GetUnderlyingInterface(IStream managedInterface) { if (managedInterface is NativeToManagedWrapper) { NativeToManagedWrapper wrapper = (NativeToManagedWrapper)managedInterface; wrapper.managedVtable.AddRef(wrapper.comInterface); return(wrapper.comInterface); } else { return(IntPtr.Zero); } }
internal static IntPtr GetInterface(IStream managedInterface) { IntPtr comInterface; if (managedInterface == null) { return(IntPtr.Zero); } #if !RECURSIVE_WRAPPING else if ((comInterface = NativeToManagedWrapper.GetUnderlyingInterface(managedInterface)) == IntPtr.Zero) #endif comInterface = new ManagedToNativeWrapper(managedInterface).comInterface; return(comInterface); }
public void CleanUpManagedData(object managedObj) { NativeToManagedWrapper.ReleaseInterface((IStream)managedObj); }