diff --git a/samples/ComputeSharp.SwapChain.D2D1/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs b/samples/ComputeSharp.SwapChain.D2D1/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
index ba7a363a..c5bd740f 100644
--- a/samples/ComputeSharp.SwapChain.D2D1/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
+++ b/samples/ComputeSharp.SwapChain.D2D1/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
@@ -1,8 +1,10 @@
+using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
using TerraFX.Interop;
-using System;
+using WinRT;
+using WinRT.Interop;
#pragma warning disable CS0649, IDE1006
@@ -79,12 +81,23 @@ internal unsafe struct ICanvasFactoryNative : IUnknown.Interface
}
///
- /// The COM import interface for .
+ /// The managed interface for .
///
[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
- [ComImport]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [WindowsRuntimeType]
+ [WindowsRuntimeHelperType(typeof(Interface))]
public interface Interface
{
+ ///
+ /// The vtable type for .
+ ///
+ [Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
+ public readonly struct Vftbl
+ {
+ ///
+ /// Allows CsWinRT to retrieve a pointer to the projection vtable (the name is hardcoded by convention).
+ ///
+ public static readonly IntPtr AbiToProjectionVftablePtr = IUnknownVftbl.AbiToProjectionVftblPtr;
+ }
}
}
\ No newline at end of file
diff --git a/samples/ComputeSharp.SwapChain.D2D1/Backend/Win32Application.cs b/samples/ComputeSharp.SwapChain.D2D1/Backend/Win32Application.cs
index c100ad18..18378ed5 100644
--- a/samples/ComputeSharp.SwapChain.D2D1/Backend/Win32Application.cs
+++ b/samples/ComputeSharp.SwapChain.D2D1/Backend/Win32Application.cs
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
using ABI.Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -122,7 +121,7 @@ internal sealed class Win32Application
{
ICanvasFactoryNative.Interface canvasDeviceActivationFactory = CanvasDevice.As();
- canvasFactoryNativeUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDeviceActivationFactory));
+ canvasFactoryNativeUnknown.Attach((IUnknown*)MarshalInterface.FromManaged(canvasDeviceActivationFactory));
hresult = canvasFactoryNativeUnknown.CopyTo(canvasFactoryNative.GetAddressOf());