Skip to content

0x5bfa/VTableFunctionGenerator

Repository files navigation

VTable Function Generator

Generates vtable function compatible with the COM and WinRT ABI in C# struct.

Installing the package

> dotnet add package 0x5BFA.VTableFunctionGenerator --prerelease

Usage

using Windows.Win32.Foundation;

namespace Windows.Win32.System.WinRT;

public unsafe partial struct IStorageProviderQuotaUI
{
    [GeneratedVTableFunction(Index = 6)]
    public partial HRESULT GetQuotaTotalInBytes(ulong* value);

    [GeneratedVTableFunction(Index = 8)]
    public partial HRESULT GetQuotaUsedInBytes(ulong* value);
}

generates

// <auto-generated/>
#pragma warning disable

namespace Windows.Win32.System.WinRT;

public unsafe partial struct IStorageProviderQuotaUI
{
	private void** lpVtbl;

	[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	public partial global::Windows.Win32.Foundation.HRESULT GetQuotaTotalInBytes(ulong* value)
	{
		return (global::Windows.Win32.Foundation.HRESULT)((delegate* unmanaged[MemberFunction]<global::Windows.Win32.System.WinRT.IStorageProviderQuotaUI*, ulong*, int>)(lpVtbl[6]))
			((global::Windows.Win32.System.WinRT.IStorageProviderQuotaUI*)global::System.Runtime.CompilerServices.Unsafe.AsPointer(ref this), value);
	}

	[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	public partial global::Windows.Win32.Foundation.HRESULT GetQuotaUsedInBytes(ulong* value)
	{
		return (global::Windows.Win32.Foundation.HRESULT)((delegate* unmanaged[MemberFunction]<global::Windows.Win32.System.WinRT.IStorageProviderQuotaUI*, ulong*, int>)(lpVtbl[8]))
			((global::Windows.Win32.System.WinRT.IStorageProviderQuotaUI*)global::System.Runtime.CompilerServices.Unsafe.AsPointer(ref this), value);
	}
}

Building from the source

  1. Prerequisites
    • Windows 10 (Build 10.0.17763.0) onwards and Windows 11
    • Visual Studio 2022
    • .NET 10 SDK
  2. Clone the repo
  3. Open the solution
  4. Build the solution

About

Generates vtable function compatible with the COM and WinRT ABI in C# struct

Resources

License

Stars

Watchers

Forks

Languages