Ejemplo n.º 1
0
            private unsafe fxIStream OpenHostFileInternal(string fileName)
            {
                IntPtr retVal = IntPtr.Zero;

                IntPtr stringRef = Marshal.StringToHGlobalAnsi(fileName);

                try
                {
                    IntPtr *retValRef = &retVal;

                    Marshal.ThrowExceptionForHR(openHostFileMethod.method(hostPtr, stringRef, new IntPtr(retValRef)));
                }
                finally
                {
                    Marshal.FreeHGlobal(stringRef);
                }

                return((fxIStream)Marshal.GetObjectForIUnknown(retVal));
            }
Ejemplo n.º 2
0
            public void InvokeNative([MarshalAs(UnmanagedType.Struct)] IntPtr context)
            {
                var hr = invokeNativeMethod.method(hostPtr, context);

                Marshal.ThrowExceptionForHR(hr);
            }