diff --git a/Directory.Build.props b/Directory.Build.props
index f6f9153..ac736f9 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -12,10 +12,9 @@
embedded
strict
true
- true
$(MSBuildThisFileDirectory)NuGet.config
- 1.8.9
+ 1.9.0
true
@@ -44,9 +43,4 @@
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
-
-
-
-
-
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 9873016..fb878df 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,23 +1,21 @@
+
+
+ true
+ true
+
-
-
-
-
-
+
+
+
+
+
+
-
+
-
diff --git a/README.md b/README.md
index 78e5672..7272822 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[](https://github.com/amerkoleci/Vortice.Win32/actions)
[](https://www.nuget.org/packages/Vortice.Win32)
-**Vortice.Win32** is a .NET Standard 2.0 and .NET 6.0 low-level bindings for Win32, generation is based on json files from [win32json](https://github.com/marlersoft/win32json), follows naming conventions of Vortice.Windows but small GC allocation and using unsafe struct for COM objects.
+**Vortice.Win32** is a .NET Standard 2.0, .NET 6.0 and .NET 7.0 low-level bindings for Win32, generation is based on json files from [win32json](https://github.com/marlersoft/win32json), follows naming conventions of Vortice.Windows but small GC allocation and using unsafe struct for COM objects.
## Sponsors
To further help development of these bindings library or other projects, please consider [SPONSOR](https://github.com/sponsors/amerkoleci) my profile in order to allow faster issue triaging and new features to be implemented.
diff --git a/global.json b/global.json
index a870941..6b8ab50 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,11 @@
{
"sdk": {
"version": "7.0.100",
- "rollForward": "latestFeature"
+ "rollForward": "latestMinor",
+ "allowPrerelease": false
},
"msbuild-sdks": {
- "MSBuild.Sdk.Extras": "3.0.44"
+ "MSBuild.Sdk.Extras": "3.0.44",
+ "Microsoft.Build.NoTargets": "3.3.0"
}
}
diff --git a/src/Vortice.Win32.Graphics.Direct2D/Vortice.Win32.Graphics.Direct2D.csproj b/src/Vortice.Win32.Graphics.Direct2D/Vortice.Win32.Graphics.Direct2D.csproj
index 1cf0cb9..d520ec5 100644
--- a/src/Vortice.Win32.Graphics.Direct2D/Vortice.Win32.Graphics.Direct2D.csproj
+++ b/src/Vortice.Win32.Graphics.Direct2D/Vortice.Win32.Graphics.Direct2D.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Direct2D1 bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Direct3D.Dxc/Vortice.Win32.Graphics.Direct3D.Dxc.csproj b/src/Vortice.Win32.Graphics.Direct3D.Dxc/Vortice.Win32.Graphics.Direct3D.Dxc.csproj
index 1812ea9..65bf16c 100644
--- a/src/Vortice.Win32.Graphics.Direct3D.Dxc/Vortice.Win32.Graphics.Direct3D.Dxc.csproj
+++ b/src/Vortice.Win32.Graphics.Direct3D.Dxc/Vortice.Win32.Graphics.Direct3D.Dxc.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
DXC bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Direct3D.Fxc/Vortice.Win32.Graphics.Direct3D.Fxc.csproj b/src/Vortice.Win32.Graphics.Direct3D.Fxc/Vortice.Win32.Graphics.Direct3D.Fxc.csproj
index 51e12d8..3ebf372 100644
--- a/src/Vortice.Win32.Graphics.Direct3D.Fxc/Vortice.Win32.Graphics.Direct3D.Fxc.csproj
+++ b/src/Vortice.Win32.Graphics.Direct3D.Fxc/Vortice.Win32.Graphics.Direct3D.Fxc.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
FXC bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Direct3D11/Vortice.Win32.Graphics.Direct3D11.csproj b/src/Vortice.Win32.Graphics.Direct3D11/Vortice.Win32.Graphics.Direct3D11.csproj
index a17e51e..062a819 100644
--- a/src/Vortice.Win32.Graphics.Direct3D11/Vortice.Win32.Graphics.Direct3D11.csproj
+++ b/src/Vortice.Win32.Graphics.Direct3D11/Vortice.Win32.Graphics.Direct3D11.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Direct3D11 bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Direct3D11on12/Vortice.Win32.Graphics.Direct3D11on12.csproj b/src/Vortice.Win32.Graphics.Direct3D11on12/Vortice.Win32.Graphics.Direct3D11on12.csproj
index 907a776..fd752a6 100644
--- a/src/Vortice.Win32.Graphics.Direct3D11on12/Vortice.Win32.Graphics.Direct3D11on12.csproj
+++ b/src/Vortice.Win32.Graphics.Direct3D11on12/Vortice.Win32.Graphics.Direct3D11on12.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Direct3D11on12 bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Direct3D12/Vortice.Win32.Graphics.Direct3D12.csproj b/src/Vortice.Win32.Graphics.Direct3D12/Vortice.Win32.Graphics.Direct3D12.csproj
index 5c896bc..614d146 100644
--- a/src/Vortice.Win32.Graphics.Direct3D12/Vortice.Win32.Graphics.Direct3D12.csproj
+++ b/src/Vortice.Win32.Graphics.Direct3D12/Vortice.Win32.Graphics.Direct3D12.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Direct3D12 bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.DirectComposition/Vortice.Win32.Graphics.DirectComposition.csproj b/src/Vortice.Win32.Graphics.DirectComposition/Vortice.Win32.Graphics.DirectComposition.csproj
index 37c3dc1..ae8bd1e 100644
--- a/src/Vortice.Win32.Graphics.DirectComposition/Vortice.Win32.Graphics.DirectComposition.csproj
+++ b/src/Vortice.Win32.Graphics.DirectComposition/Vortice.Win32.Graphics.DirectComposition.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
DirectComposition bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.DirectWrite/Vortice.Win32.Graphics.DirectWrite.csproj b/src/Vortice.Win32.Graphics.DirectWrite/Vortice.Win32.Graphics.DirectWrite.csproj
index 95bbc2b..7e66129 100644
--- a/src/Vortice.Win32.Graphics.DirectWrite/Vortice.Win32.Graphics.DirectWrite.csproj
+++ b/src/Vortice.Win32.Graphics.DirectWrite/Vortice.Win32.Graphics.DirectWrite.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
DirectWrite bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Dxgi/Apis.cs b/src/Vortice.Win32.Graphics.Dxgi/Apis.cs
new file mode 100644
index 0000000..7280217
--- /dev/null
+++ b/src/Vortice.Win32.Graphics.Dxgi/Apis.cs
@@ -0,0 +1,12 @@
+// Copyright © Amer Koleci and Contributors.
+// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
+
+namespace Win32.Graphics.Dxgi;
+
+unsafe partial class Apis
+{
+ public static HResult CreateDXGIFactory2(bool debug, Guid* riid, void** ppFactory)
+ {
+ return CreateDXGIFactory2(debug ? DXGI_CREATE_FACTORY_DEBUG : 0u, riid, ppFactory);
+ }
+}
diff --git a/src/Vortice.Win32.Graphics.Dxgi/Vortice.Win32.Graphics.Dxgi.csproj b/src/Vortice.Win32.Graphics.Dxgi/Vortice.Win32.Graphics.Dxgi.csproj
index b786af0..2cde3ed 100644
--- a/src/Vortice.Win32.Graphics.Dxgi/Vortice.Win32.Graphics.Dxgi.csproj
+++ b/src/Vortice.Win32.Graphics.Dxgi/Vortice.Win32.Graphics.Dxgi.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Dxgi bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32.Graphics.Imaging/Vortice.Win32.Graphics.Imaging.csproj b/src/Vortice.Win32.Graphics.Imaging/Vortice.Win32.Graphics.Imaging.csproj
index 874ac94..cbf5c6a 100644
--- a/src/Vortice.Win32.Graphics.Imaging/Vortice.Win32.Graphics.Imaging.csproj
+++ b/src/Vortice.Win32.Graphics.Imaging/Vortice.Win32.Graphics.Imaging.csproj
@@ -1,8 +1,8 @@
- netstandard2.0;net6.0;net7.0
- DXC bindings.
+ netstandard2.0;netstandard2.1;net6.0;net7.0
+ WIC bindings.
$(NoWarn);CS0419;IDE0017
diff --git a/src/Vortice.Win32/Com/IErrorLog.cs b/src/Vortice.Win32/Com/IErrorLog.cs
index eae7791..668fca9 100644
--- a/src/Vortice.Win32/Com/IErrorLog.cs
+++ b/src/Vortice.Win32/Com/IErrorLog.cs
@@ -1,10 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices.ComTypes;
-
namespace Win32.Com;
[Guid("3127CA40-446E-11CE-8135-00AA004BB851")]
diff --git a/src/Vortice.Win32/IUnknown.cs b/src/Vortice.Win32/IUnknown.cs
index b749b0e..01dce37 100644
--- a/src/Vortice.Win32/IUnknown.cs
+++ b/src/Vortice.Win32/IUnknown.cs
@@ -41,20 +41,32 @@ public unsafe partial struct IUnknown : INativeGuid
[VtblIndex(0)]
public HResult QueryInterface(Guid* riid, void** ppvObject)
{
+#if NET6_0_OR_GREATER
+ return ((delegate* unmanaged)(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
+#else
return ((delegate* unmanaged[Stdcall])(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
+#endif
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(1)]
public uint AddRef()
{
+#if NET6_0_OR_GREATER
+ return ((delegate* unmanaged)(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
+#else
return ((delegate* unmanaged[Stdcall])(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
+#endif
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(2)]
public uint Release()
{
+#if NET6_0_OR_GREATER
+ return ((delegate* unmanaged)(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
+#else
return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
+#endif
}
}
diff --git a/src/Vortice.Win32/LargeInteger.cs b/src/Vortice.Win32/LargeInteger.cs
index fc9398d..647bfe9 100644
--- a/src/Vortice.Win32/LargeInteger.cs
+++ b/src/Vortice.Win32/LargeInteger.cs
@@ -1,13 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.CompilerServices;
-
-#if NETSTANDARD2_0
-using MemoryMarshal = Win32.MemoryMarshal;
-#endif
-
namespace Win32;
[StructLayout(LayoutKind.Explicit)]
@@ -18,7 +11,6 @@ public partial struct LargeInteger
public _Anonymous_e__Struct Anonymous;
[FieldOffset(0)]
- [NativeTypeName("struct (anonymous struct at C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um/winnt.h:879:5)")]
public _u_e__Struct u;
[FieldOffset(0)]
@@ -31,11 +23,7 @@ public partial struct LargeInteger
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if NET7_0_OR_GREATER
return ref Anonymous.LowPart;
-#else
- return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LowPart, 1));
-#endif
}
}
@@ -45,11 +33,7 @@ public partial struct LargeInteger
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if NET7_0_OR_GREATER
return ref Anonymous.HighPart;
-#else
- return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.HighPart, 1));
-#endif
}
}
@@ -69,4 +53,13 @@ public partial struct LargeInteger
[NativeTypeName("LONG")]
public int HighPart;
}
+
+ public static implicit operator long(LargeInteger value) => value.QuadPart;
+
+ public static implicit operator LargeInteger(long value)
+ {
+ Unsafe.SkipInit(out LargeInteger result);
+ result.QuadPart = value;
+ return result;
+ }
}
diff --git a/src/Vortice.Win32/ULargeInteger.cs b/src/Vortice.Win32/ULargeInteger.cs
index f1532ae..b2fbfa0 100644
--- a/src/Vortice.Win32/ULargeInteger.cs
+++ b/src/Vortice.Win32/ULargeInteger.cs
@@ -1,13 +1,6 @@
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.CompilerServices;
-
-#if NETSTANDARD2_0
-using MemoryMarshal = Win32.MemoryMarshal;
-#endif
-
namespace Win32;
[StructLayout(LayoutKind.Explicit)]
@@ -15,11 +8,9 @@ namespace Win32;
public partial struct ULargeInteger
{
[FieldOffset(0)]
- [NativeTypeName("_ULARGE_INTEGER::(anonymous struct at C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um/winnt.h:895:5)")]
public _Anonymous_e__Struct Anonymous;
[FieldOffset(0)]
- [NativeTypeName("struct (anonymous struct at C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um/winnt.h:899:5)")]
public _u_e__Struct u;
[FieldOffset(0)]
@@ -32,11 +23,7 @@ public partial struct ULargeInteger
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if NET7_0_OR_GREATER
return ref Anonymous.LowPart;
-#else
- return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LowPart, 1));
-#endif
}
}
@@ -46,11 +33,7 @@ public partial struct ULargeInteger
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
-#if NET7_0_OR_GREATER
return ref Anonymous.HighPart;
-#else
- return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.HighPart, 1));
-#endif
}
}
diff --git a/src/Vortice.Win32/Vortice.Win32.csproj b/src/Vortice.Win32/Vortice.Win32.csproj
index f4d4abd..cde8baf 100644
--- a/src/Vortice.Win32/Vortice.Win32.csproj
+++ b/src/Vortice.Win32/Vortice.Win32.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;net6.0;net7.0
+ netstandard2.0;netstandard2.1;net6.0;net7.0
Windows API low level bindings.
true
$(NoWarn);CS0419;IDE0017