Skip to content

Commit 891f9bd

Browse files
committed
Update CsWin32 version
1 parent c54532b commit 891f9bd

File tree

14 files changed

+35
-31
lines changed

14 files changed

+35
-31
lines changed

src/thirtytwo/DeviceContext.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public unsafe void Dispose()
143143
}
144144

145145
public static implicit operator HDC(DeviceContext context) => context.Handle;
146-
public static unsafe explicit operator DeviceContext(WPARAM wparam) => Create(new(new(wparam)));
146+
public static unsafe explicit operator DeviceContext(WPARAM wparam) => Create(new((nint)wparam));
147147

148148
[Flags]
149149
private enum ContextState

src/thirtytwo/Wdk/Interop.NtQueryKey.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.Runtime.InteropServices;
5-
using Windows.Wdk.System.SystemServices;
5+
using Windows.Wdk.System.Registry;
66
using Windows.Win32.System.Registry;
77

88
namespace Windows.Wdk;

src/thirtytwo/Win32/Foundation/HANDLE.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Windows.Win32.Foundation;
1010
{
1111
public unsafe void Dispose()
1212
{
13-
if (Value != 0 && Value != -1)
13+
if ((nint)Value != 0 && (nint)Value != -1)
1414
{
1515
Interop.CloseHandle(this).ThrowLastErrorIfFalse();
1616
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) Jeremy W. Kuhne. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
namespace Windows.Win32.Foundation;
5+
6+
public unsafe readonly partial struct LRESULT
7+
{
8+
public static explicit operator void*(LRESULT value) => (void*)value.Value;
9+
public static explicit operator LRESULT(void* value) => new((nint)value);
10+
}

src/thirtytwo/Win32/Foundation/WPARAM.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
namespace Windows.Win32.Foundation;
77

8-
public readonly partial struct WPARAM
8+
public unsafe readonly partial struct WPARAM
99
{
10-
public static unsafe implicit operator void*(WPARAM value) => (void*)value.Value;
11-
public static unsafe implicit operator WPARAM(void* value) => new((nuint)value);
10+
public static implicit operator void*(WPARAM value) => (void*)value.Value;
11+
public static implicit operator WPARAM(void* value) => new((nuint)value);
1212

1313
public static explicit operator HWND(WPARAM value) => (HWND)(nint)value.Value;
1414
public static explicit operator WPARAM(HWND value) => new((nuint)value.Value);

src/thirtytwo/Win32/Graphics/Gdi/HBRUSH.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static explicit operator HBRUSH(HGDIOBJ handle)
2424

2525
public void Dispose()
2626
{
27-
if (Value != 0 && Value != -1)
27+
if ((nint)Value != 0 && (nint)Value != -1)
2828
{
2929
Interop.DeleteObject(this);
3030
Unsafe.AsRef(in this) = default;

src/thirtytwo/Win32/Graphics/Gdi/HDC.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55

66
namespace Windows.Win32.Graphics.Gdi;
77

8-
public partial struct HDC : IHandle<HDC>
8+
public unsafe partial struct HDC : IHandle<HDC>
99
{
1010
HDC IHandle<HDC>.Handle => this;
1111
object? IHandle<HDC>.Wrapper => null;
1212

13-
public bool IsNull => Value == 0;
14-
1513
public static explicit operator HDC(HGDIOBJ handle)
1614
{
1715
Debug.Assert(handle.IsNull || (OBJ_TYPE)Interop.GetObjectType(handle) == OBJ_TYPE.OBJ_DC);

src/thirtytwo/Win32/Graphics/Gdi/HGDIOBJ.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ public unsafe partial struct HGDIOBJ
77
{
88
public OBJ_TYPE GetObjectType() => (OBJ_TYPE)Interop.GetObjectType(this);
99

10-
public static implicit operator HGDIOBJ(StockFont font) => new(Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)font));
11-
public static implicit operator HGDIOBJ(StockBrush brush) => new(Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)brush));
12-
public static implicit operator HGDIOBJ(SystemColor color) => new(Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)color));
13-
public static implicit operator HGDIOBJ(StockPen pen) => new(Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)pen));
14-
public static implicit operator HGDIOBJ(GET_STOCK_OBJECT_FLAGS stockObject) => new(Interop.GetStockObject(stockObject));
10+
public static implicit operator HGDIOBJ(StockFont font) => new((nint)Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)font));
11+
public static implicit operator HGDIOBJ(StockBrush brush) => new((nint)Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)brush));
12+
public static implicit operator HGDIOBJ(SystemColor color) => new((nint)Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)color));
13+
public static implicit operator HGDIOBJ(StockPen pen) => new((nint)Interop.GetStockObject((GET_STOCK_OBJECT_FLAGS)pen));
14+
public static implicit operator HGDIOBJ(GET_STOCK_OBJECT_FLAGS stockObject) => new((nint)Interop.GetStockObject(stockObject));
1515
}

src/thirtytwo/Win32/Graphics/Gdi/HPEN.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static explicit operator HPEN(HGDIOBJ handle)
2121

2222
public void Dispose()
2323
{
24-
if (Value != 0 && Value != -1)
24+
if ((nint)Value != 0 && (nint)Value != -1)
2525
{
2626
Interop.DeleteObject(this);
2727
Unsafe.AsRef(in this) = default;

src/thirtytwo/Win32/Graphics/Gdi/HRGN.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Dispose()
2626
/// <summary>
2727
/// Special <see cref="HRGN"/> sent during WM_NCPAINT to indicate the entire window.
2828
/// </summary>
29-
public static HRGN Full { get; } = (HRGN)1;
29+
public static HRGN Full { get; } = (HRGN)(nint)1;
3030

3131
/// <summary>
3232
/// Is special <see cref="HRGN.Full"/> value.

src/thirtytwo/Win32/System/Registry/HKEY.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Windows.Win32.System.Registry;
77

8-
public partial struct HKEY : IDisposable
8+
public unsafe partial struct HKEY : IDisposable
99
{
1010
private const uint REMOTE_HANDLE_TAG = 0x00000001;
1111
private const uint REG_CLASSES_SPECIAL_TAG = 0x00000002;
@@ -16,13 +16,13 @@ public bool IsPerfKey()
1616
/// <summary>
1717
/// Returns true if the key is from the local machine.
1818
/// </summary>
19-
public bool IsLocalKey => (Value & REMOTE_HANDLE_TAG) == 0;
19+
public bool IsLocalKey => ((nuint)Value & REMOTE_HANDLE_TAG) == 0;
2020

2121
/// <summary>
2222
/// Returns true if the key is special (notably in <see cref="HKEY.HKEY_CLASSES_ROOT"/>, where
2323
/// it might be redirected to per user settings).
2424
/// </summary>
25-
public bool IsSpecialKey => (Value & REG_CLASSES_SPECIAL_TAG) != 0;
25+
public bool IsSpecialKey => ((nuint)Value & REG_CLASSES_SPECIAL_TAG) != 0;
2626

2727
public void Dispose()
2828
{

src/thirtytwo/Win32/System/Registry/Registry.cs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Buffers.Binary;
55
using System.Runtime.InteropServices;
66
using Windows.Support;
7+
using Windows.Wdk.System.Registry;
78
using Windows.Wdk.System.SystemServices;
89

910
namespace Windows.Win32.System.Registry;

src/thirtytwo/Win32/UI/HiDpi/DPI_AWARENESS_CONTEXT.cs

-9
This file was deleted.

src/thirtytwo/thirtytwo.csproj

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
16+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.151">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>
2020
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
24+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Folder Include="Win32\UI\HiDpi\" />
2529
</ItemGroup>
2630

2731
</Project>

0 commit comments

Comments
 (0)