Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Feb 8, 2025

This PR contains the following updates:

Package Change Age Confidence
Microsoft.Windows.CsWin32 (source) 0.3.1620.3.269 age confidence

Release Notes

microsoft/CsWin32 (Microsoft.Windows.CsWin32)

v0.3.269

Changes:

  • #​1613: Use Marshal.InitHandle API to avoid memory leak when OOM happens
  • #​1614: Update to latest win32metadata
  • #​1603: Generate SafeHandle when freeing method accepts additional reserved parameters
  • #​1597: Add more examples to the docs

This list of changes was auto generated.

v0.3.264

Changes:

  • #​1593: Fix IDispatch property returns with built-in COM
  • #​1591: Update README.md & add sample snippets
  • #​1589: Add [Optional] on optional params

This list of changes was auto generated.

v0.3.259

Changes:

  • #​1545: Generate struct wrapper around function pointer to make a native delegate typedef
  • #​1578: Update win32metadata to latest (68.0.4-preview)

This list of changes was auto generated.

v0.3.257

Changes:

  • #​1575: Fix bug when multiple Span-params share a CountParamIndex and one param is null
  • #​1567: Fix mis-handling of parameters that are arrays of HANDLE
  • #​1565: Switch CsWin32RunAsBuildTask to EmitSingleFile by default (for VS incremental scenario)
  • #​1562: Move to .NET 10 SDK, add test coverage for net10 TFM

This list of changes was auto generated.

v0.3.253

Changes:

  • #​1557: Improve intellisense experience with CsWin32RunAsBuildTask mode

This list of changes was auto generated.

v0.3.252

Changes:

  • #​1550: Support $(ProjectName).NativeMethods.txt pattern for single-file-app projects
  • #​1555: Downgrade dependencies so the source analyzer works with .NET 8 SDK again

This list of changes was auto generated.

v0.3.250

Changes:

  • #​1554: Translate VARIANT to ComVariant when using COM source generators
  • #​1548: Add common Win32 message parameter extraction macros

This list of changes was auto generated.

v0.3.248

Changes:

  • #​1544: Improve optional out interface arguments (e.g. IWbemServices.GetObject) and other minor tweaks
  • #​1547: Add test for cross-winmd IInspectable derivation and fix a tiny bug
  • #​1541: Don't emit friendly overload of Span param for flexible array structs
  • #​1536: Handle struct returns for COM interface methods across all marshalling modes
  • #​1534: Preserve pointer return types
  • #​1533: Fix out ** pointer parameters

This list of changes was auto generated.

v0.3.242

Changes:

  • #​1524: Add an option to FriendlyOverloads to request previous pointer overloads
  • #​1526: Generate real IDispatch when requested
  • #​1522: [Retained] parameters need to project as pointer
  • #​1521: Add implicit IntPtr casts to void* typedefs

This list of changes was auto generated.

v0.3.238

Changes:

  • #​1520: Don't make void* params Span in friendly methods
  • #​1517: CsWin32Generator should allow newer language versions

This list of changes was auto generated.

v0.3.236

NOTE: This changes the signature of methods with optional parameters. This change is also documented at https://microsoft.github.io/CsWin32/docs/getting-started.html:

Optional out/ref parameters

Some parameters in win32 are [optional, out] or [optional, in, out]. C# does not have an idiomatic way to represent this concept, so for any method that has such parameters, CsWin32 will generate two versions: one with all ref or out parameters included, and one with all such parameters omitted. For example:

// Omitting the optional parameter:
IsTextUnicode(buffer);

// Passing ref for optional parameter:
IS_TEXT_UNICODE_RESULT result = default;
IsTextUnicode(buffer, ref result);
Working with Span-typed and MemorySize-d parameters

In the Win32 APIs there are many functions where one parameter is a buffer (void* or byte*) and another parameter is the size of that buffer. When generating for a target framework that supports Spans, there will be overloads of these functions that take a Span<byte> which represents both of these parameters, since a Span refers to a chunk of memory and a length. For example, an API like IsTextUnicode has a void* parameter whose length is described by the iSize parameter in the native signature. The CsWin32 projection of this method will be:

BOOL IsTextUnicode(ReadOnlySpan<byte> lpv, ref IS_TEXT_UNICODE_RESULT lpiResult)

Instead of passing the buffer and length separately, in this projection you pass just one parameter. Span is a flexible type with many things that can be converted to it safely. You will also see Span parameters for things that may look like a struct but are variable sized. For example, InitializeAcl looks like it returns an ACL struct but the parameter is annotated with a [MemorySize] attribute in the metadata, indicating it is variable-sized based on another parameter. Thus, the cswin32 projection of this method will project this parameter as a Span<byte> since the size of the parameter is variable:

// The cswin32 signature:
static BOOL InitializeAcl(Span<byte> pAcl, ACE_REVISION dwAclRevision) { ... }

And you would call this by creating a buffer to receive the ACL. Then, after the call you can reinterpret the buffer as an ACL:

// Make a buffer
Span<byte> buffer = new byte[CalculateAclSize(...)];
InitializeAcl(buffer, ACE_REVISION.ACL_REVISION);

// The beginning of the buffer is an ACL, so cast it to a ref:
ref ACL acl = ref MemoryMarshal.AsRef<ACL>(buffer);

// Or treat it as a Span:
Span<ACL> aclSpan = MemoryMarshal.Cast<byte, ACL>(buffer);

CsWin32 will also generate a struct-typed parameter for convenience but this overload will pass sizeof(T) for the length parameter to the underlying Win32 API, so this only makes sense in some overloads such as SHGetFileInfo where the parameter has an annotation indicating it's variable-sized, but the size is only ever sizeof(SHFILEINFOW):

// Span<byte> overload:
static nuint SHGetFileInfo(string pszPath, FILE_FLAGS_AND_ATTRIBUTES dwFileAttributes, Span<byte> psfi, SHGFI_FLAGS uFlags)
// ref SHGETFILEINFOW overload:
static nuint SHGetFileInfo(string pszPath, FILE_FLAGS_AND_ATTRIBUTES dwFileAttributes, ref SHFILEINFOW psfi, SHGFI_FLAGS uFlags)

Changes:

  • #​1511: Improve projection of MemorySize-d and optional ref/out parameters

v0.3.235

What's Changed

Full Changelog: microsoft/CsWin32@v0.3.228...v0.3.235

v0.3.228

What's Changed

New Contributors

Full Changelog: microsoft/CsWin32@v0.3.217...v0.3.228

https://www.nuget.org/packages/Microsoft.Windows.CsWin32/0.3.228

v0.3.217

What's Changed

Full Changelog: microsoft/CsWin32@v0.3.213...v0.3.217

v0.3.213

What's Changed

Full Changelog: microsoft/CsWin32@v0.3.205...v0.3.213

v0.3.205

What's Changed

New Contributors

Full Changelog: microsoft/CsWin32@v0.3.183...v0.3.205

v0.3.183

Fixes

  • Generate WinRTCustomMarshaler when referenced from extern methods by @​AArnott in #​1335
  • Fix build break when friendly methods are turned off and IUnknown is generated by @​AArnott in #​1337

Enhancements

  • Use C# 13 overload resolution attribute to improve friendly overloads by @​AArnott in #​1336
  • Improve [Out] PWSTR parameters in friendly overloads by @​AArnott in #​1341
  • Friendly overloads replace PCWSTR* parameters with ReadOnlySpan<string> by @​AArnott in #​1346
  • Implement LOWORD and HIWORD Macros for Extracting Low-Order and High-Order Words from a 32-Bit Value by @​vitkuz573 in #​1300

New Contributors

Full Changelog: microsoft/CsWin32@v0.3.162...v0.3.183


Configuration

📅 Schedule: Branch creation - "before 1am,before 5am,before 9am" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 5 times, most recently from 0145f2b to 33ba38c Compare February 13, 2025 11:01
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 3 times, most recently from b3d65f0 to 784e29b Compare March 3, 2025 05:26
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 5 times, most recently from 32a94d1 to a40a451 Compare March 11, 2025 11:15
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 6 times, most recently from 921dca8 to 2062f11 Compare March 18, 2025 16:48
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 4 times, most recently from 6be036c to b82e461 Compare March 31, 2025 06:32
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 3 times, most recently from b2bb0dc to 4c3d75f Compare April 9, 2025 10:24
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch 3 times, most recently from b82bbc3 to 848f7a7 Compare April 14, 2025 10:30
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.205 Update dependency Microsoft.Windows.CsWin32 to 0.3.213 Oct 15, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from b22d805 to bf5c293 Compare October 19, 2025 11:29
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.213 Update dependency Microsoft.Windows.CsWin32 to 0.3.217 Oct 19, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from bf5c293 to c929cb4 Compare October 22, 2025 18:52
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.217 Update dependency Microsoft.Windows.CsWin32 to 0.3.228 Oct 22, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from c929cb4 to cf61a6a Compare October 29, 2025 11:45
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.228 Update dependency Microsoft.Windows.CsWin32 to 0.3.235 Oct 29, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from cf61a6a to afdbe2e Compare October 30, 2025 06:46
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.235 Update dependency Microsoft.Windows.CsWin32 to 0.3.236 Oct 30, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from afdbe2e to 3e94f66 Compare October 31, 2025 20:45
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.236 Update dependency Microsoft.Windows.CsWin32 to 0.3.238 Oct 31, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 3e94f66 to 0a82632 Compare November 4, 2025 12:04
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.238 Update dependency Microsoft.Windows.CsWin32 to 0.3.242 Nov 4, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 0a82632 to 5617e26 Compare November 15, 2025 05:08
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.242 Update dependency Microsoft.Windows.CsWin32 to 0.3.248 Nov 15, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 5617e26 to 6314ef5 Compare November 20, 2025 09:40
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.248 Update dependency Microsoft.Windows.CsWin32 to 0.3.250 Nov 20, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 6314ef5 to 1ec3530 Compare November 21, 2025 02:31
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.250 Update dependency Microsoft.Windows.CsWin32 to 0.3.252 Nov 21, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 1ec3530 to 7a48e64 Compare November 23, 2025 01:26
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.252 Update dependency Microsoft.Windows.CsWin32 to 0.3.253 Nov 23, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 7a48e64 to 8979b11 Compare November 25, 2025 08:53
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.253 Update dependency Microsoft.Windows.CsWin32 to 0.3.257 Nov 25, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 8979b11 to 940da10 Compare December 4, 2025 06:58
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.257 Update dependency Microsoft.Windows.CsWin32 to 0.3.259 Dec 4, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 940da10 to 843c150 Compare December 13, 2025 02:01
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.259 Update dependency Microsoft.Windows.CsWin32 to 0.3.264 Dec 13, 2025
@renovate renovate bot force-pushed the renovate/microsoft.windows.cswin32-0.x branch from 843c150 to 35d0be5 Compare January 16, 2026 05:51
@renovate renovate bot changed the title Update dependency Microsoft.Windows.CsWin32 to 0.3.264 Update dependency Microsoft.Windows.CsWin32 to 0.3.269 Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants