Skip to content

Generate safe COM output pointer ABI - #1829

Closed
Jevan Saks (jevansaks) wants to merge 1 commit into
microsoft:mainfrom
jevansaks:feature/com-out-ptr-abi
Closed

Jevan Saks (jevansaks) wants to merge 1 commit into
microsoft:mainfrom
jevansaks:feature/com-out-ptr-abi

Conversation

@jevansaks

Copy link
Copy Markdown
Member

Summary

  • project canonical COM IID + [ComOutPtr] void** interface parameters as implementation-safe out void*
  • generate Windows.Win32.ComOutPtr.FromManaged to return the exact requested interface with caller-owned COM reference semantics
  • preserve generic out T friendly overloads and adaptive COM/WinRT projection
  • preserve flat P/Invoke, no-marshalling, and UseIntPtrForComOutPointers behavior
  • cover IClassFactory implementations across source-generated COM, built-in COM, and auto-WinRT enabled/disabled configurations

Fixes #1827

Validation

  • 129 COM generator tests passed
  • source-generated COM runtime tests passed on .NET 9 and .NET 10
  • built-in COM runtime tests passed on .NET 9 and .NET 10
  • auto-WinRT-disabled IClassFactory runtime tests passed on .NET 9 and .NET 10
  • affected projects build with zero warnings
  • git diff --check passed

Project canonical IID/ComOutPtr pairs as out void* and provide ComOutPtr.FromManaged for managed COM implementers. Preserve friendly generic overloads and cover source-generated, built-in, and WinRT marshalling configurations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jevansaks

Copy link
Copy Markdown
Member Author

Superseded by #1831, which uses the branch hosted directly in microsoft/CsWin32.

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.

IClassFactory.CreateInstance returns IUnknown instead of the interface requested by riid

1 participant