Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Files.App.CsWin32/Windows.Win32.ComHeapPtr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public unsafe struct ComHeapPtr<T> : IDisposable where T : unmanaged
private T* _ptr;

public bool IsNull
=> _ptr == default;
=> _ptr == null;

public ComHeapPtr(T* ptr)
{
Expand Down
10 changes: 9 additions & 1 deletion src/Files.App.CsWin32/Windows.Win32.ComPtr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public unsafe struct ComPtr<T> : IDisposable where T : unmanaged
private T* _ptr;

public bool IsNull
=> _ptr == default;
=> _ptr == null;

public ComPtr(T* ptr)
{
Expand All @@ -38,6 +38,14 @@ public ComPtr(T* ptr)
return (T**)Unsafe.AsPointer(ref Unsafe.AsRef(in this));
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly ComPtr<U> As<U>(Guid riid) where U : unmanaged
{
ComPtr<U> pNewPtr = default;
((IUnknown*)_ptr)->QueryInterface(&riid, (void**)pNewPtr.GetAddressOf());
return pNewPtr;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Dispose()
{
Expand Down
Loading