Skip to content

Generate SafeHandle when freeing method accepts additional reserved parameters#1603

Merged
jevansaks merged 6 commits intomicrosoft:mainfrom
DoctorKrolic:wlan-close-handle
Jan 12, 2026
Merged

Generate SafeHandle when freeing method accepts additional reserved parameters#1603
jevansaks merged 6 commits intomicrosoft:mainfrom
DoctorKrolic:wlan-close-handle

Conversation

@DoctorKrolic
Copy link
Copy Markdown
Contributor

Fixes: #1078

We already handle out handle parameters annotated with [RAIIFree]. However, in this particular case WlanCloseHandle function accepts 2 parameters, which usually blocks us from turning raw handle into a SafeHandle. But the second parameter of WlanCloseHandle is a [Reserved] one, so we don't actually need to pass a value to it. So the fix is to recognize such cases and handle still allow SafeHandle to be used

@DoctorKrolic
Copy link
Copy Markdown
Contributor Author

@jevansaks PTAL

@jevansaks
Copy link
Copy Markdown
Member

/azp run

@jevansaks
Copy link
Copy Markdown
Member

@DoctorKrolic Does the whole solution build for you? When I checked this out and built locally, I got build breaks that SysFreeStringSafeHandle is no longer generated. Seems like this might have broken generation of some other SafeHandles.

DoctorKrolic and others added 2 commits January 8, 2026 23:05
Co-authored-by: Jevan Saks <jevansa@microsoft.com>
@jevansaks
Copy link
Copy Markdown
Member

/azp run

Copy link
Copy Markdown
Member

@jevansaks jevansaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jevansaks
Copy link
Copy Markdown
Member

/azp run

@jevansaks jevansaks enabled auto-merge (squash) January 12, 2026 18:29
@DoctorKrolic
Copy link
Copy Markdown
Contributor Author

It seems that CI failure is not real

@jevansaks
Copy link
Copy Markdown
Member

I'll try to re-run. We may need to scale back on some of the tests we run in the lab because of memory constraints. We're always just on the edge and some changes seem to cause the agents to blow up.

@AArnott any thoughts on how to request different agents with more memory for running the tests?

@jevansaks jevansaks merged commit 149d70a into microsoft:main Jan 12, 2026
3 checks passed
@DoctorKrolic DoctorKrolic deleted the wlan-close-handle branch January 13, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support [RAIIFree] on output parameters

2 participants