Skip to content

Commit

Permalink
Merge pull request #13 from tannergooding/master
Browse files Browse the repository at this point in the history
Generating bindings for WinGdi and WinUser
  • Loading branch information
tannergooding authored Sep 28, 2019
2 parents e2f06b9 + c5dd8a8 commit 9b164fc
Show file tree
Hide file tree
Showing 366 changed files with 21,248 additions and 649 deletions.
20 changes: 20 additions & 0 deletions TerraFX.Interop.Windows.sln
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "User32", "User32", "{12CA1D
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerraFX.Interop.User32.UnitTests", "tests\Interop\User32\TerraFX.Interop.User32.UnitTests.csproj", "{E1079FA4-5C96-45B4-8B51-C9DB23AB9831}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gdi32", "Gdi32", "{E4BACF79-1227-41F7-98BC-E07A8689FEAE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerraFX.Interop.Gdi32", "sources\Interop\Gdi32\TerraFX.Interop.Gdi32.csproj", "{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gdi32", "Gdi32", "{F7740CF9-604C-4701-BE19-3669E79CA39D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerraFX.Interop.Gdi32.UnitTests", "tests\Interop\Gdi32\TerraFX.Interop.Gdi32.UnitTests.csproj", "{794109BA-BF3E-4932-A723-7469C7BF6347}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -259,6 +267,14 @@ Global
{E1079FA4-5C96-45B4-8B51-C9DB23AB9831}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1079FA4-5C96-45B4-8B51-C9DB23AB9831}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1079FA4-5C96-45B4-8B51-C9DB23AB9831}.Release|Any CPU.Build.0 = Release|Any CPU
{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C}.Release|Any CPU.Build.0 = Release|Any CPU
{794109BA-BF3E-4932-A723-7469C7BF6347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{794109BA-BF3E-4932-A723-7469C7BF6347}.Debug|Any CPU.Build.0 = Debug|Any CPU
{794109BA-BF3E-4932-A723-7469C7BF6347}.Release|Any CPU.ActiveCfg = Release|Any CPU
{794109BA-BF3E-4932-A723-7469C7BF6347}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -312,6 +328,10 @@ Global
{5FEAAC67-AC1C-490D-86D2-24ABCCAC4D60} = {82F1C087-5129-4118-A446-269A6C2B657A}
{12CA1DDE-F03C-4903-8977-AF0BA73DD656} = {7E31C739-2787-44ED-8304-7EFCEE1A2B2C}
{E1079FA4-5C96-45B4-8B51-C9DB23AB9831} = {12CA1DDE-F03C-4903-8977-AF0BA73DD656}
{E4BACF79-1227-41F7-98BC-E07A8689FEAE} = {70FBCFD9-B96E-4E72-B35C-681D9B2DA3D6}
{C58F82C2-0906-4EE0-AEB7-C18D9E9A121C} = {E4BACF79-1227-41F7-98BC-E07A8689FEAE}
{F7740CF9-604C-4701-BE19-3669E79CA39D} = {7E31C739-2787-44ED-8304-7EFCEE1A2B2C}
{794109BA-BF3E-4932-A723-7469C7BF6347} = {F7740CF9-604C-4701-BE19-3669E79CA39D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2FE36DF8-2D9C-4F20-8787-45DC74B57461}
Expand Down
4 changes: 2 additions & 2 deletions sources/Interop/D3D12/um/d3d12/D3D12_BLEND_DESC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public unsafe struct _RenderTarget_e__FixedBuffer

public D3D12_RENDER_TARGET_BLEND_DESC e7;

public ref D3D12_RENDER_TARGET_BLEND_DESC this[int index] => ref AsSpan(int.MaxValue)[index];
public ref D3D12_RENDER_TARGET_BLEND_DESC this[int index] => ref AsSpan()[index];

public Span<D3D12_RENDER_TARGET_BLEND_DESC> AsSpan(int length) => MemoryMarshal.CreateSpan(ref e0, length);
public Span<D3D12_RENDER_TARGET_BLEND_DESC> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 8);
}
}
}
17 changes: 3 additions & 14 deletions sources/Interop/D3D12/um/d3dcommon/D3D12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,15 @@ namespace TerraFX.Interop
{
public static unsafe partial class D3D12
{
public static int D3D_SET_OBJECT_NAME_N_A(ID3D12Object* pObject, uint Chars, byte* pName)
{
var guid = WKPDID_D3DDebugObjectNameW;
return pObject->SetPrivateData(&guid, Chars, pName);
}

public static int D3D_SET_OBJECT_NAME_A(ID3D12Object* pObject, byte* pName)
{
return D3D_SET_OBJECT_NAME_N_A(pObject, (uint)lstrlenA(pName), pName);
}

public static int D3D_SET_OBJECT_NAME_N_W(ID3D12Object* pObject, uint Chars, ushort* pName)
public static int D3D_SET_OBJECT_NAME_N(ID3D12Object* pObject, uint Chars, ushort* pName)
{
var guid = WKPDID_D3DDebugObjectNameW;
return pObject->SetPrivateData(&guid, Chars * 2, pName);
}

public static int D3D_SET_OBJECT_NAME_W(ID3D12Object* pObject, ushort* pName)
public static int D3D_SET_OBJECT_NAME(ID3D12Object* pObject, ushort* pName)
{
return D3D_SET_OBJECT_NAME_N_W(pObject, (uint)lstrlenW(pName), pName);
return D3D_SET_OBJECT_NAME_N(pObject, (uint)lstrlen(pName), pName);
}
}
}
1 change: 1 addition & 0 deletions sources/Interop/DWrite/TerraFX.Interop.DWrite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<ProjectReference Include="..\DCommon\TerraFX.Interop.DCommon.csproj" />
<ProjectReference Include="..\Gdi32\TerraFX.Interop.Gdi32.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions sources/Interop/DXGI/shared/dxgitype/DXGI_GAMMA_CONTROL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2069,9 +2069,9 @@ public unsafe struct _GammaCurve_e__FixedBuffer

public DXGI_RGB e1024;

public ref DXGI_RGB this[int index] => ref AsSpan(int.MaxValue)[index];
public ref DXGI_RGB this[int index] => ref AsSpan()[index];

public Span<DXGI_RGB> AsSpan(int length) => MemoryMarshal.CreateSpan(ref e0, length);
public Span<DXGI_RGB> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 1025);
}
}
}
17 changes: 3 additions & 14 deletions sources/Interop/DXGI/um/d3dcommon/DXGI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,15 @@ namespace TerraFX.Interop
{
public static unsafe partial class DXGI
{
public static int D3D_SET_OBJECT_NAME_N_A(IDXGIObject* pObject, uint Chars, byte* pName)
{
var guid = WKPDID_D3DDebugObjectNameW;
return pObject->SetPrivateData(&guid, Chars, pName);
}

public static int D3D_SET_OBJECT_NAME_A(IDXGIObject* pObject, byte* pName)
{
return D3D_SET_OBJECT_NAME_N_A(pObject, (uint)lstrlenA(pName), pName);
}

public static int D3D_SET_OBJECT_NAME_N_W(IDXGIObject* pObject, uint Chars, ushort* pName)
public static int D3D_SET_OBJECT_NAME_N(IDXGIObject* pObject, uint Chars, ushort* pName)
{
var guid = WKPDID_D3DDebugObjectNameW;
return pObject->SetPrivateData(&guid, Chars * 2, pName);
}

public static int D3D_SET_OBJECT_NAME_W(IDXGIObject* pObject, ushort* pName)
public static int D3D_SET_OBJECT_NAME(IDXGIObject* pObject, ushort* pName)
{
return D3D_SET_OBJECT_NAME_N_W(pObject, (uint)lstrlenW(pName), pName);
return D3D_SET_OBJECT_NAME_N(pObject, (uint)lstrlen(pName), pName);
}
}
}
25 changes: 25 additions & 0 deletions sources/Interop/Gdi32/NativeTypeNameAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

using System;
using System.Diagnostics;

namespace TerraFX.Interop
{
/// <summary>Defines the type of a member as it was used in the native signature.</summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)]
[Conditional("DEBUG")]
internal sealed class NativeTypeNameAttribute : Attribute
{
private readonly string _name;

/// <summary>Initializes a new instance of the <see cref="NativeTypeNameAttribute" /> class.</summary>
/// <param name="name">The name of the type that was used in the native signature.</param>
public NativeTypeNameAttribute(string name)
{
_name = name;
}

/// <summary>Gets the name of the type that was used in the native signature.</summary>
public string Name => _name;
}
}
15 changes: 15 additions & 0 deletions sources/Interop/Gdi32/TerraFX.Interop.Gdi32.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<NoWarn>1573;1591;$(NoWarn)</NoWarn>
<RootNamespace>TerraFX.Interop</RootNamespace>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Windows\TerraFX.Interop.Windows.csproj" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/ABC.cs
Original file line number Diff line number Diff line change
@@ -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\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public partial struct ABC
{
public int abcA;

[NativeTypeName("UINT")]
public uint abcB;

public int abcC;
}
}
19 changes: 19 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/ABCFLOAT.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public partial struct ABCFLOAT
{
[NativeTypeName("FLOAT")]
public float abcfA;

[NativeTypeName("FLOAT")]
public float abcfB;

[NativeTypeName("FLOAT")]
public float abcfC;
}
}
12 changes: 12 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/ABORTPATH.cs
Original file line number Diff line number Diff line change
@@ -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 um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public partial struct ABORTPATH
{
public EMR emr;
}
}
14 changes: 14 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/ABORTPROC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

using System;
using System.Runtime.InteropServices;

namespace TerraFX.Interop
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[return: NativeTypeName("BOOL")]
public unsafe delegate int ABORTPROC([NativeTypeName("HDC")] IntPtr param0, int param1);
}
46 changes: 46 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/AXESLIST.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

using System;
using System.Runtime.InteropServices;

namespace TerraFX.Interop
{
public partial struct AXESLIST
{
[NativeTypeName("DWORD")]
public uint axlReserved;

[NativeTypeName("DWORD")]
public uint axlNumAxes;

[NativeTypeName("AXISINFOW [16]")]
public _axlAxisInfo_e__FixedBuffer axlAxisInfo;

public partial struct _axlAxisInfo_e__FixedBuffer
{
internal AXISINFO e0;
internal AXISINFO e1;
internal AXISINFO e2;
internal AXISINFO e3;
internal AXISINFO e4;
internal AXISINFO e5;
internal AXISINFO e6;
internal AXISINFO e7;
internal AXISINFO e8;
internal AXISINFO e9;
internal AXISINFO e10;
internal AXISINFO e11;
internal AXISINFO e12;
internal AXISINFO e13;
internal AXISINFO e14;
internal AXISINFO e15;

public ref AXISINFO this[int index] => ref AsSpan()[index];

public Span<AXISINFO> AsSpan() => MemoryMarshal.CreateSpan(ref e0, 16);
}
}
}
19 changes: 19 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/AXISINFO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public unsafe partial struct AXISINFO
{
[NativeTypeName("LONG")]
public int axMinValue;

[NativeTypeName("LONG")]
public int axMaxValue;

[NativeTypeName("WCHAR [16]")]
public fixed ushort axAxisName[16];
}
}
31 changes: 31 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/BITMAP.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public unsafe partial struct BITMAP
{
[NativeTypeName("LONG")]
public int bmType;

[NativeTypeName("LONG")]
public int bmWidth;

[NativeTypeName("LONG")]
public int bmHeight;

[NativeTypeName("LONG")]
public int bmWidthBytes;

[NativeTypeName("WORD")]
public ushort bmPlanes;

[NativeTypeName("WORD")]
public ushort bmBitsPixel;

[NativeTypeName("LPVOID")]
public void* bmBits;
}
}
25 changes: 25 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/BITMAPCOREHEADER.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

namespace TerraFX.Interop
{
public partial struct BITMAPCOREHEADER
{
[NativeTypeName("DWORD")]
public uint bcSize;

[NativeTypeName("WORD")]
public ushort bcWidth;

[NativeTypeName("WORD")]
public ushort bcHeight;

[NativeTypeName("WORD")]
public ushort bcPlanes;

[NativeTypeName("WORD")]
public ushort bcBitCount;
}
}
28 changes: 28 additions & 0 deletions sources/Interop/Gdi32/um/wingdi/BITMAPCOREINFO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um\wingdi.h in the Windows SDK for Windows 10.0.15063.0
// Original source is Copyright © Microsoft. All rights reserved.

using System;
using System.Runtime.InteropServices;

namespace TerraFX.Interop
{
public partial struct BITMAPCOREINFO
{
[NativeTypeName("BITMAPCOREHEADER")]
public BITMAPCOREHEADER bmciHeader;

[NativeTypeName("RGBTRIPLE [1]")]
public _bmciColors_e__FixedBuffer bmciColors;

public partial struct _bmciColors_e__FixedBuffer
{
internal RGBTRIPLE e0;

public ref RGBTRIPLE this[int index] => ref AsSpan(int.MaxValue)[index];

public Span<RGBTRIPLE> AsSpan(int length) => MemoryMarshal.CreateSpan(ref e0, length);
}
}
}
Loading

0 comments on commit 9b164fc

Please sign in to comment.