diff --git a/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs b/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs
index 42347133..6e94d749 100644
--- a/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs
+++ b/src/ComputeSharp.NetStandard/System/IO/StreamExtensions.cs
@@ -36,7 +36,7 @@ internal static class StreamExtensions
///
/// The input instance.
/// A region of memory. This method copies the contents of this region to the current stream.
- public static void Write(this Stream stream, Span span)
+ public static void Write(this Stream stream, ReadOnlySpan span)
{
if (span.IsEmpty)
{
diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.STGM.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.STGM.cs
new file mode 100644
index 00000000..74c6c521
--- /dev/null
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.STGM.cs
@@ -0,0 +1,20 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/coml2api.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+#if NET6_0_OR_GREATER
+
+namespace TerraFX.Interop.Windows;
+
+// TODO: remove this once TerraFX.Interop.Windows is updated
+internal static partial class STGM
+{
+ public const int STGM_READ = 0x00000000;
+
+ public const int STGM_WRITE = 0x00000001;
+
+ public const int STGM_READWRITE = 0x00000002;
+}
+
+#endif
\ No newline at end of file
diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.cs
new file mode 100644
index 00000000..b2e0c83f
--- /dev/null
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.cs
@@ -0,0 +1,585 @@
+using System;
+using System.IO;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Threading;
+using Microsoft.Toolkit.Diagnostics;
+using TerraFX.Interop.Windows;
+using static TerraFX.Interop.Windows.E;
+using static TerraFX.Interop.Windows.IID;
+using static TerraFX.Interop.Windows.S;
+using static TerraFX.Interop.Windows.STATFLAG;
+using static TerraFX.Interop.Windows.STG;
+using static TerraFX.Interop.Windows.STGM;
+using static TerraFX.Interop.Windows.STGTY;
+#if NET6_0_OR_GREATER
+using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers;
+#else
+using RuntimeHelpers = ComputeSharp.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
+using UnmanagedCallersOnlyAttribute = ComputeSharp.NetStandard.System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute;
+#endif
+
+namespace ComputeSharp.Graphics.Extensions;
+
+///
+/// A with extensions for the type.
+///
+internal static unsafe class IWICStreamExtensions
+{
+ ///
+ /// Initializes an input wrapping a given instance.
+ ///
+ /// The target object to initialize.
+ /// The input instance to wrap.
+ /// An value indicating the operation result.
+ public static HRESULT InitializeFromStream(this ref IWICStream stream, Stream source)
+ {
+ using ComPtr streamWrapper = default;
+
+ IStreamWrapper.Create(source, streamWrapper.GetAddressOf());
+
+ return stream.InitializeFromIStream((IStream*)streamWrapper.Get());
+ }
+
+ ///
+ /// A manual CCW implementation for an object wrapping a instance.
+ ///
+ internal unsafe partial struct IStreamWrapper
+#if NET6_0_OR_GREATER
+ : IUnknown.Interface
+#endif
+ {
+#if !NET6_0_OR_GREATER
+ ///
+ private delegate int QueryInterfaceDelegate(IStreamWrapper* @this, Guid* riid, void** ppvObject);
+
+ ///
+ private delegate uint AddRefDelegate(IStreamWrapper* @this);
+
+ ///
+ private delegate uint ReleaseDelegate(IStreamWrapper* @this);
+
+ ///
+ private delegate HRESULT ReadDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbRead);
+
+ ///
+ private delegate HRESULT WriteDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbWritten);
+
+ ///
+ private delegate HRESULT SeekDelegate(IStreamWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition);
+
+ ///
+ private delegate HRESULT SetSizeDelegate(IStreamWrapper* @this, ULARGE_INTEGER libNewSize);
+
+ ///
+ private delegate HRESULT CopyToDelegate(IStreamWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten);
+
+ ///
+ private delegate HRESULT CommitDelegate(IStreamWrapper* @this, uint grfCommitFlags);
+
+ ///
+ private delegate HRESULT RevertDelegate(IStreamWrapper* @this);
+
+ ///
+ private delegate HRESULT LockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
+
+ ///
+ private delegate HRESULT UnlockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
+
+ ///
+ private delegate HRESULT StatDelegate(IStreamWrapper* @this, STATSTG* pstatstg, uint grfStatFlag);
+
+ ///
+ private delegate HRESULT CloneDelegate(IStreamWrapper* @this, IStream** ppstm);
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly AddRefDelegate AddRefWrapper = AddRef;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly ReleaseDelegate ReleaseWrapper = Release;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly ReadDelegate ReadWrapper = Read;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly WriteDelegate WriteWrapper = Write;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly SeekDelegate SeekWrapper = Seek;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly SetSizeDelegate SetSizeWrapper = SetSize;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly CopyToDelegate CopyToWrapper = CopyTo;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly CommitDelegate CommitWrapper = Commit;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly RevertDelegate RevertWrapper = Revert;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly LockRegionDelegate LockRegionWrapper = LockRegion;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly UnlockRegionDelegate UnlockRegionWrapper = UnlockRegion;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly StatDelegate StatWrapper = Stat;
+
+ ///
+ /// A cached instance wrapping .
+ ///
+ private static readonly CloneDelegate CloneWrapper = Clone;
+#endif
+
+ ///
+ /// The shared vtable pointer for instances.
+ ///
+ private static readonly void** Vtbl = InitVtbl();
+
+ ///
+ /// Setups the vtable pointer for .
+ ///
+ /// The initialized vtable pointer for .
+ private static void** InitVtbl()
+ {
+ void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IStreamWrapper), sizeof(void*) * 14);
+
+#if NET6_0_OR_GREATER
+ lpVtbl[0] = (delegate* unmanaged)&QueryInterface;
+ lpVtbl[1] = (delegate* unmanaged)&AddRef;
+ lpVtbl[2] = (delegate* unmanaged)&Release;
+ lpVtbl[3] = (delegate* unmanaged)&Read;
+ lpVtbl[4] = (delegate* unmanaged)&Write;
+ lpVtbl[5] = (delegate* unmanaged)&Seek;
+ lpVtbl[6] = (delegate* unmanaged)&SetSize;
+ lpVtbl[7] = (delegate* unmanaged)&CopyTo;
+ lpVtbl[8] = (delegate* unmanaged)&Commit;
+ lpVtbl[9] = (delegate* unmanaged)&Revert;
+ lpVtbl[10] = (delegate* unmanaged)&LockRegion;
+ lpVtbl[11] = (delegate* unmanaged)&UnlockRegion;
+ lpVtbl[12] = (delegate* unmanaged)&Stat;
+ lpVtbl[13] = (delegate* unmanaged)&Clone;
+#else
+ lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(QueryInterfaceWrapper);
+ lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(AddRefWrapper);
+ lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ReleaseWrapper);
+ lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ReadWrapper);
+ lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(WriteWrapper);
+ lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(SeekWrapper);
+ lpVtbl[6] = (void*)Marshal.GetFunctionPointerForDelegate(SetSizeWrapper);
+ lpVtbl[7] = (void*)Marshal.GetFunctionPointerForDelegate(CopyToWrapper);
+ lpVtbl[8] = (void*)Marshal.GetFunctionPointerForDelegate(CommitWrapper);
+ lpVtbl[9] = (void*)Marshal.GetFunctionPointerForDelegate(RevertWrapper);
+ lpVtbl[10] = (void*)Marshal.GetFunctionPointerForDelegate(LockRegionWrapper);
+ lpVtbl[11] = (void*)Marshal.GetFunctionPointerForDelegate(UnlockRegionWrapper);
+ lpVtbl[12] = (void*)Marshal.GetFunctionPointerForDelegate(StatWrapper);
+ lpVtbl[13] = (void*)Marshal.GetFunctionPointerForDelegate(CloneWrapper);
+#endif
+
+ return lpVtbl;
+ }
+
+ ///
+ /// The vtable pointer for the current instance.
+ ///
+ public void** lpVtbl;
+
+ ///
+ /// The current reference count for the object (from IUnknown).
+ ///
+ public volatile int referenceCount;
+
+ ///
+ /// The to the captured .
+ ///
+ public GCHandle streamHandle;
+
+ ///
+ /// Creates and initializes a new instance.
+ ///
+ /// The input instance to wrap.
+ /// The target instance to initialize.
+ public static void Create(Stream stream, IStreamWrapper** streamWrapper)
+ {
+ IStreamWrapper* @this = (IStreamWrapper*)NativeMemory.Alloc((nuint)sizeof(IStreamWrapper));
+
+ @this->lpVtbl = Vtbl;
+ @this->referenceCount = 1;
+ @this->streamHandle = GCHandle.Alloc(stream);
+
+ *streamWrapper = @this;
+ }
+
+ ///
+ /// Gets the captured instance.
+ ///
+ /// The captured instance
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private Stream GetStream()
+ {
+ return Unsafe.As(this.streamHandle.Target!);
+ }
+
+#if NET6_0_OR_GREATER
+ ///
+ public HRESULT QueryInterface(Guid* riid, void** ppvObject)
+ {
+ return ((delegate* unmanaged)lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
+ }
+
+ ///
+ public uint AddRef()
+ {
+ return ((delegate* unmanaged)lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this));
+ }
+
+ ///
+ public uint Release()
+ {
+ return ((delegate* unmanaged)lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this));
+ }
+#endif
+
+ ///
+ [UnmanagedCallersOnly]
+ private static int QueryInterface(IStreamWrapper* @this, Guid* riid, void** ppvObject)
+ {
+ if (ppvObject is null)
+ {
+ return E_POINTER;
+ }
+
+ if (riid->Equals(IID_IUnknown) ||
+ riid->Equals(IID_ISequentialStream) ||
+ riid->Equals(IID_IStream))
+ {
+ _ = Interlocked.Increment(ref @this->referenceCount);
+
+ *ppvObject = @this;
+
+ return S_OK;
+ }
+
+ *ppvObject = null;
+
+ return E_NOINTERFACE;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static uint AddRef(IStreamWrapper* @this)
+ {
+ return (uint)Interlocked.Increment(ref @this->referenceCount);
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static uint Release(IStreamWrapper* @this)
+ {
+ uint referenceCount = (uint)Interlocked.Decrement(ref @this->referenceCount);
+
+ if (referenceCount == 0)
+ {
+ @this->streamHandle.Free();
+
+ NativeMemory.Free(@this);
+ }
+
+ return referenceCount;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Read(IStreamWrapper* @this, void* pv, uint cb, uint* pcbRead)
+ {
+ if (pv == null)
+ {
+ return E_POINTER;
+ }
+
+ if (cb > int.MaxValue)
+ {
+ return E_INVALIDARG;
+ }
+
+ if (pcbRead != null)
+ {
+ *pcbRead = 0;
+ }
+
+ try
+ {
+ Span dst = new(pv, (int)cb);
+
+ while (dst.Length > 0)
+ {
+ int bytesRead = @this->GetStream().Read(dst);
+
+ if (bytesRead == 0)
+ {
+ return S_FALSE;
+ }
+
+ if (pcbRead != null)
+ {
+ *pcbRead += (uint)bytesRead;
+ }
+
+ dst = dst.Slice(bytesRead);
+ }
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Write(IStreamWrapper* @this, void* pv, uint cb, uint* pcbWritten)
+ {
+ if (pv == null)
+ {
+ return E_POINTER;
+ }
+
+ if (cb > int.MaxValue)
+ {
+ return E_INVALIDARG;
+ }
+
+ if (pcbWritten != null)
+ {
+ *pcbWritten = 0;
+ }
+
+ try
+ {
+ @this->GetStream().Write(new ReadOnlySpan(pv, (int)cb));
+
+ if (pcbWritten != null)
+ {
+ *pcbWritten = cb;
+ }
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Seek(IStreamWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition)
+ {
+ SeekOrigin origin = (SeekOrigin)dwOrigin;
+
+ switch (origin)
+ {
+ case SeekOrigin.Begin:
+ case SeekOrigin.Current:
+ case SeekOrigin.End:
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+
+ if (plibNewPosition != null)
+ {
+ *plibNewPosition = default;
+ }
+
+ try
+ {
+ long newPosition = @this->GetStream().Seek(dlibMove.QuadPart, origin);
+
+ if (plibNewPosition != null)
+ {
+ plibNewPosition->QuadPart = (ulong)newPosition;
+ }
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT SetSize(IStreamWrapper* @this, ULARGE_INTEGER libNewSize)
+ {
+ if (libNewSize.QuadPart > long.MaxValue)
+ {
+ return E_INVALIDARG;
+ }
+
+ try
+ {
+ @this->GetStream().SetLength((long)libNewSize.QuadPart);
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT CopyTo(IStreamWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)
+ {
+ return E_NOTIMPL;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Commit(IStreamWrapper* @this, uint grfCommitFlags)
+ {
+ try
+ {
+ @this->GetStream().Flush();
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Revert(IStreamWrapper* @this)
+ {
+ return STG_E_INVALIDFUNCTION;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT LockRegion(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType)
+ {
+ return STG_E_INVALIDFUNCTION;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT UnlockRegion(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType)
+ {
+ return STG_E_INVALIDFUNCTION;
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Stat(IStreamWrapper* @this, STATSTG* pstatstg, uint grfStatFlag)
+ {
+ if (pstatstg == null)
+ {
+ return E_POINTER;
+ }
+
+ *pstatstg = default;
+
+ STATFLAG statFlag = (STATFLAG)grfStatFlag;
+
+ if ((statFlag & (STATFLAG_DEFAULT | STATFLAG_NONAME | STATFLAG_NOOPEN)) != statFlag)
+ {
+ return E_INVALIDARG;
+ }
+
+ try
+ {
+ Stream stream = @this->GetStream();
+
+ if (!statFlag.HasFlag(STATFLAG_NONAME))
+ {
+ if (stream is FileStream asFileStream)
+ {
+ pstatstg->pwcsName = (ushort*)Marshal.StringToCoTaskMemUni(asFileStream.Name);
+ }
+ }
+
+ bool canRead = stream.CanRead;
+ bool canWrite = stream.CanWrite;
+
+ if (canRead && !canWrite)
+ {
+ pstatstg->grfMode = STGM_READ;
+ }
+ else if (canRead && canWrite)
+ {
+ pstatstg->grfMode = STGM_READWRITE;
+ }
+ else if (!canRead && canWrite)
+ {
+ pstatstg->grfMode = STGM_WRITE;
+ }
+ else
+ {
+ ThrowHelper.ThrowNotSupportedException();
+ }
+
+ pstatstg->type = (uint)STGTY_STREAM;
+ pstatstg->cbSize.QuadPart = (ulong)stream.Length;
+
+ return S_OK;
+ }
+ catch (Exception ex)
+ {
+ if (pstatstg->pwcsName != null)
+ {
+ Marshal.FreeCoTaskMem((IntPtr)pstatstg->pwcsName);
+
+ pstatstg->pwcsName = null;
+ }
+
+ return ex.HResult;
+ }
+ }
+
+ ///
+ [UnmanagedCallersOnly]
+ private static HRESULT Clone(IStreamWrapper* @this, IStream** ppstm)
+ {
+ return STG_E_INVALIDFUNCTION;
+ }
+ }
+}
diff --git a/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems b/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems
index c5562388..af64755d 100644
--- a/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems
+++ b/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems
@@ -217,17 +217,25 @@
+
+
+
+
+
+
+
+
diff --git a/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs
new file mode 100644
index 00000000..0f4ac886
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/shared/minwindef/FILETIME.cs
@@ -0,0 +1,15 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/minwindef.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows;
+
+internal partial struct FILETIME
+{
+ [NativeTypeName("DWORD")]
+ public uint dwLowDateTime;
+
+ [NativeTypeName("DWORD")]
+ public uint dwHighDateTime;
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs b/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs
new file mode 100644
index 00000000..80db6d81
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/shared/winerror/STG.cs
@@ -0,0 +1,12 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/winerror.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows;
+
+internal static partial class STG
+{
+ [NativeTypeName("#define STG_E_INVALIDFUNCTION _HRESULT_TYPEDEF_(0x80030001L)")]
+ public const int STG_E_INVALIDFUNCTION = unchecked((int)(0x80030001));
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs b/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs
new file mode 100644
index 00000000..9a1a5369
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/shared/wtypes/STATFLAG.cs
@@ -0,0 +1,15 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/wtypes.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows;
+
+internal enum STATFLAG
+{
+ STATFLAG_DEFAULT = 0,
+
+ STATFLAG_NONAME = 1,
+
+ STATFLAG_NOOPEN = 2,
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs
new file mode 100644
index 00000000..e5f657bf
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/um/Unknwnbase/IID.cs
@@ -0,0 +1,37 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/Unknwnbase.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace TerraFX.Interop.Windows;
+
+internal static partial class IID
+{
+ public static ref readonly Guid IID_IUnknown
+ {
+ get
+ {
+ ReadOnlySpan data = new byte[] {
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0xC0,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x46
+ };
+
+ Debug.Assert(data.Length == Unsafe.SizeOf());
+ return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs b/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs
new file mode 100644
index 00000000..8e541953
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/um/coml2api/STGM.cs
@@ -0,0 +1,18 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/coml2api.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows;
+
+internal static partial class STGM
+{
+ [NativeTypeName("#define STGM_READ 0x00000000L")]
+ public const int STGM_READ = 0x00000000;
+
+ [NativeTypeName("#define STGM_WRITE 0x00000001L")]
+ public const int STGM_WRITE = 0x00000001;
+
+ [NativeTypeName("#define STGM_READWRITE 0x00000002L")]
+ public const int STGM_READWRITE = 0x00000002;
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs
new file mode 100644
index 00000000..4475b9f7
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IID.cs
@@ -0,0 +1,60 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace TerraFX.Interop.Windows;
+
+internal static partial class IID
+{
+ public static ref readonly Guid IID_ISequentialStream
+ {
+ get
+ {
+ ReadOnlySpan data = new byte[] {
+ 0x30, 0x3A, 0x73, 0x0C,
+ 0x1C, 0x2A,
+ 0xCE, 0x11,
+ 0xAD,
+ 0xE5,
+ 0x00,
+ 0xAA,
+ 0x00,
+ 0x44,
+ 0x77,
+ 0x3D
+ };
+
+ Debug.Assert(data.Length == Unsafe.SizeOf());
+ return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
+ public static ref readonly Guid IID_IStream
+ {
+ get
+ {
+ ReadOnlySpan data = new byte[] {
+ 0x0C, 0x00, 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0xC0,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x46
+ };
+
+ Debug.Assert(data.Length == Unsafe.SizeOf());
+ return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs
index 9481b8aa..637adbfc 100644
--- a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs
+++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/IStream.cs
@@ -102,6 +102,13 @@ namespace TerraFX.Interop.Windows
return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((IStream*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType);
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(12)]
+ public HRESULT Stat(STATSTG* pstatstg, [NativeTypeName("DWORD")] uint grfStatFlag)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((IStream*)Unsafe.AsPointer(ref this), pstatstg, grfStatFlag);
+ }
+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public HRESULT Clone(IStream** ppstm)
diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs
new file mode 100644
index 00000000..1f843abb
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STATSTG.cs
@@ -0,0 +1,40 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+
+namespace TerraFX.Interop.Windows;
+
+internal unsafe partial struct STATSTG
+{
+ [NativeTypeName("LPOLESTR")]
+ public ushort* pwcsName;
+
+ [NativeTypeName("DWORD")]
+ public uint type;
+
+ public ULARGE_INTEGER cbSize;
+
+ public FILETIME mtime;
+
+ public FILETIME ctime;
+
+ public FILETIME atime;
+
+ [NativeTypeName("DWORD")]
+ public uint grfMode;
+
+ [NativeTypeName("DWORD")]
+ public uint grfLocksSupported;
+
+ [NativeTypeName("CLSID")]
+ public Guid clsid;
+
+ [NativeTypeName("DWORD")]
+ public uint grfStateBits;
+
+ [NativeTypeName("DWORD")]
+ public uint reserved;
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs
new file mode 100644
index 00000000..7fd183ca
--- /dev/null
+++ b/src/TerraFX.Interop.Windows/Windows/um/objidlbase/STGTY.cs
@@ -0,0 +1,17 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/objidlbase.h in the Windows SDK for Windows 10.0.20348.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows;
+
+internal enum STGTY
+{
+ STGTY_STORAGE = 1,
+
+ STGTY_STREAM = 2,
+
+ STGTY_LOCKBYTES = 3,
+
+ STGTY_PROPERTY = 4,
+}
\ No newline at end of file