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)); }
public void InvokeNative([MarshalAs(UnmanagedType.Struct)] IntPtr context) { var hr = invokeNativeMethod.method(hostPtr, context); Marshal.ThrowExceptionForHR(hr); }