Exemplo n.º 1
0
        public object MarshalNativeToManaged(IntPtr pNativeData)
        {
#if RECURSIVE_WRAPPING
            pNativeData = ManagedToNativeWrapper.GetInterface(NativeToManagedWrapper.GetInterface(pNativeData, true));
#endif
            return(NativeToManagedWrapper.GetInterface(pNativeData, false));
        }
Exemplo n.º 2
0
        public IntPtr MarshalManagedToNative(object managedObj)
        {
#if RECURSIVE_WRAPPING
            managedObj = NativeToManagedWrapper.GetInterface(ManagedToNativeWrapper.GetInterface((IStream)managedObj), true);
#endif
            return(ManagedToNativeWrapper.GetInterface((IStream)managedObj));
        }
Exemplo n.º 3
0
            public void Clone(out IStream ppstm)
            {
                IntPtr newInterface;

                ThrowExceptionForHR(managedVtable.Clone(comInterface, out newInterface));
                ppstm = NativeToManagedWrapper.GetInterface(newInterface, true);
            }
Exemplo n.º 4
0
            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);
                }
            }
Exemplo n.º 5
0
            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);
            }
Exemplo n.º 6
0
 public void CleanUpManagedData(object managedObj)
 {
     NativeToManagedWrapper.ReleaseInterface((IStream)managedObj);
 }