mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 08:06:02 +08:00
Map more foundation types.
This commit is contained in:
@@ -40,17 +40,31 @@ public static class Program
|
|||||||
{"Char", "ushort" },
|
{"Char", "ushort" },
|
||||||
|
|
||||||
{ "Foundation.BOOL", "Bool32" },
|
{ "Foundation.BOOL", "Bool32" },
|
||||||
|
{ "Foundation.BOOLEAN", "byte" },
|
||||||
|
{ "Foundation.BSTR", "char*" },
|
||||||
|
{ "Foundation.HANDLE", "IntPtr" },
|
||||||
|
{ "Foundation.HINSTANCE", "IntPtr" },
|
||||||
{ "Foundation.HRESULT", "HResult" },
|
{ "Foundation.HRESULT", "HResult" },
|
||||||
|
{ "Foundation.HWND", "IntPtr" },
|
||||||
|
{ "Foundation.LPARAM", "IntPtr" },
|
||||||
|
{ "Foundation.LRESULT", "IntPtr" },
|
||||||
|
{ "Foundation.WPARAM", "UIntPtr" },
|
||||||
|
{ "Foundation.PSTR", "byte*" },
|
||||||
|
{ "Foundation.PWSTR", "char*" },
|
||||||
|
{ "Foundation.CHAR", "byte" },
|
||||||
|
|
||||||
{ "Foundation.LUID", "Luid" },
|
{ "Foundation.LUID", "Luid" },
|
||||||
{ "Foundation.LARGE_INTEGER", "LargeInterger" },
|
{ "Foundation.LARGE_INTEGER", "LargeInterger" },
|
||||||
|
|
||||||
{ "System.Com.IUnknown", "IUnknown" },
|
{ "System.Com.IUnknown", "IUnknown" },
|
||||||
|
|
||||||
// TODO: Understand those ->
|
// TODO: Understand those ->
|
||||||
{ "Foundation.HWND", "IntPtr" },
|
|
||||||
{ "Foundation.HANDLE", "IntPtr" },
|
|
||||||
{ "Foundation.POINT", "System.Drawing.Point" },
|
|
||||||
{ "Foundation.RECT", "RawRect" },
|
{ "Foundation.RECT", "RawRect" },
|
||||||
|
{ "Foundation.RECTL", "RawRect" },
|
||||||
|
{ "Foundation.POINT", "System.Drawing.Point" },
|
||||||
|
{ "Foundation.POINTL", "System.Drawing.Point" },
|
||||||
|
{ "Foundation.SIZE", "System.Drawing.Size" },
|
||||||
|
|
||||||
{ "Graphics.Gdi.HMONITOR", "IntPtr" },
|
{ "Graphics.Gdi.HMONITOR", "IntPtr" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ public unsafe partial struct IUnknown : IUnknown.Interface
|
|||||||
[VtblIndex(0)]
|
[VtblIndex(0)]
|
||||||
public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
|
public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
|
||||||
{
|
{
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
return ((delegate* unmanaged<IUnknown*, Guid*, void**, int>)(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||||
|
#else
|
||||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, Guid*, void**, int>)(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
return ((delegate* unmanaged[Stdcall]<IUnknown*, Guid*, void**, int>)(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -25,7 +29,11 @@ public unsafe partial struct IUnknown : IUnknown.Interface
|
|||||||
[return: NativeTypeName("ULONG")]
|
[return: NativeTypeName("ULONG")]
|
||||||
public uint AddRef()
|
public uint AddRef()
|
||||||
{
|
{
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
return ((delegate* unmanaged<IUnknown*, uint>)(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||||
|
#else
|
||||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
|
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -33,7 +41,11 @@ public unsafe partial struct IUnknown : IUnknown.Interface
|
|||||||
[return: NativeTypeName("ULONG")]
|
[return: NativeTypeName("ULONG")]
|
||||||
public uint Release()
|
public uint Release()
|
||||||
{
|
{
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
return ((delegate* unmanaged<IUnknown*, uint>)(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||||
|
#else
|
||||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
|
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Interface
|
public interface Interface
|
||||||
@@ -53,6 +65,16 @@ public unsafe partial struct IUnknown : IUnknown.Interface
|
|||||||
public partial struct Vtbl<TSelf>
|
public partial struct Vtbl<TSelf>
|
||||||
where TSelf : unmanaged, Interface
|
where TSelf : unmanaged, Interface
|
||||||
{
|
{
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
[NativeTypeName("HRESULT (const IID &, void **) __attribute__((stdcall))")]
|
||||||
|
public delegate* unmanaged<TSelf*, Guid*, void**, int> QueryInterface;
|
||||||
|
|
||||||
|
[NativeTypeName("ULONG () __attribute__((stdcall))")]
|
||||||
|
public delegate* unmanaged<TSelf*, uint> AddRef;
|
||||||
|
|
||||||
|
[NativeTypeName("ULONG () __attribute__((stdcall))")]
|
||||||
|
public delegate* unmanaged<TSelf*, uint> Release;
|
||||||
|
#else
|
||||||
[NativeTypeName("HRESULT (const IID &, void **) __attribute__((stdcall))")]
|
[NativeTypeName("HRESULT (const IID &, void **) __attribute__((stdcall))")]
|
||||||
public delegate* unmanaged[Stdcall]<TSelf*, Guid*, void**, int> QueryInterface;
|
public delegate* unmanaged[Stdcall]<TSelf*, Guid*, void**, int> QueryInterface;
|
||||||
|
|
||||||
@@ -61,5 +83,6 @@ public unsafe partial struct IUnknown : IUnknown.Interface
|
|||||||
|
|
||||||
[NativeTypeName("ULONG () __attribute__((stdcall))")]
|
[NativeTypeName("ULONG () __attribute__((stdcall))")]
|
||||||
public delegate* unmanaged[Stdcall]<TSelf*, uint> Release;
|
public delegate* unmanaged[Stdcall]<TSelf*, uint> Release;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user