com interface impl IUnknown

This commit is contained in:
Lightczx
2024-01-25 11:24:17 +08:00
parent d686debbfb
commit f83174d690
12 changed files with 276 additions and 32 deletions

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IBindCtx
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IEnumMoniker
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IEnumString
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -2,6 +2,7 @@
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -11,6 +12,28 @@ internal unsafe struct IMoniker
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IPersistStreamVftbl.IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IPersistStream.Vftbl IPersistStreamVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IPersist
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal unsafe readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IPersistStream
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IPersistVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IPersistVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IPersist.Vftbl IPersistVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IRunningObjectTable
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct ISequentialStream
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -1,11 +1,8 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Win32.Foundation;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.System.Com;
@@ -15,6 +12,28 @@ internal unsafe struct IStream
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->ISequentialStreamVftbl.IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly ISequentialStream.Vftbl ISequentialStreamVftbl;

View File

@@ -3,6 +3,7 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32.UI.Shell;
@@ -12,6 +13,28 @@ internal unsafe struct IFileDialogEvents
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -3,6 +3,7 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
@@ -14,6 +15,28 @@ internal unsafe struct IModalWindow
private readonly Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal unsafe readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;

View File

@@ -3,6 +3,7 @@
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.System.Com;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
@@ -14,6 +15,28 @@ internal unsafe struct IShellItemFilter
private Vftbl* thisPtr;
public unsafe HRESULT QueryInterface<TInterface>(ref readonly Guid riid, out TInterface* pvObject)
where TInterface : unmanaged
{
fixed (Guid* riid2 = &riid)
{
fixed (TInterface** ppvObject = &pvObject)
{
return thisPtr->IUnknownVftbl.QueryInterface((IUnknown*)Unsafe.AsPointer(ref this), riid2, (void**)ppvObject);
}
}
}
public uint AddRef()
{
return thisPtr->IUnknownVftbl.AddRef((IUnknown*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return thisPtr->IUnknownVftbl.Release((IUnknown*)Unsafe.AsPointer(ref this));
}
internal readonly struct Vftbl
{
internal readonly IUnknown.Vftbl IUnknownVftbl;