Skip to content

Expand safe Classic COM coverage and add explicit raw ABI opt-in - #84

Merged
leileizhang (lei9444) merged 5 commits into
mainfrom
leilzh/comcodegen
Aug 6, 2026
Merged

leileizhang (lei9444) merged 5 commits into
mainfrom
leilzh/comcodegen

Conversation

@lei9444

Copy link
Copy Markdown
Contributor

Summary

Reworks Classic COM support around an explicit native ABI and ownership model, while preserving the existing WinRT API and behavior.

Safe complete-interface coverage for Windows.Win32.winmd is now:

5,558 / 7,929 interfaces (70.097%)

Highlights

  • Adds a COM-specific semantic pipeline:
    metadata → ABI model → validated projection → call plan → libffi
  • Preserves pointer depth, direction, layout, count relationships, ownership, cleanup, IID, vtable slot, and return convention.
  • Adds architecture-aware POD structs, tagged unions, counted buffers, owning arrays, BSTR, VARIANT, SAFEARRAY, PROPVARIANT, DISPPARAMS, and EXCEPINFO.
  • Adds exact registries for:
    • 97 standard enumerator contracts
    • 209 SAFEARRAY subtype contracts
    • 22 documented borrowed HWND outputs
  • Supports x86 COM stdcall and validates layouts against windows-rs.
  • Keeps unknown ownership, allocator, layout, callback, and pointer contracts fail-closed.

JavaScript API

  • Keeps @microsoft/dynwinrt WinRT-only.
  • Exposes initialization and managed COM value types through:
    @microsoft/dynwinrt/com
  • Adds an isolated explicit raw ABI entrypoint:
    @microsoft/dynwinrt/com/unsafe
  • Unsafe declarations require explicit:
    • IID and absolute vtable slot
    • ABI types and parameter directions
    • count/capacity/actual-length relationships
    • return convention
    • output ownership and cleanup
  • Separates borrowed pointer QI from consuming an existing +1 COM reference.
  • Rejects Buffer backing addresses for raw COM ownership operations.

Code generation

  • Generates idiomatic JavaScript and TypeScript declarations for supported COM interfaces and coclasses.
  • Generated implementation files use the private unsafe runtime internally.
  • Public declarations reference only safe COM value types.
  • Generated IID_* constants are typed as WinGuid.
  • Adds complete GUID/IID/CLSID/REFIID and COM usage documentation.

Compatibility

  • Existing WinRT metadata, codegen, package root, constructors, and runtime semantics remain unchanged.
  • Shared libffi infrastructure remains private and behavior-neutral for WinRT.
  • Repository, documentation, benchmark, sample, and E2E directory changes from the latest main are included.

Add fail-closed semantic ABI projection, exact ownership registries, generated JavaScript bindings, and an isolated explicit unsafe COM entrypoint.

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

Copilot-Session: 6307886d-3c24-4596-8924-ba44b0e850a5
Integrate the repository reorganization and latest Python/WinUI changes while preserving the expanded Classic COM runtime, codegen, tests, and documentation.

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

Copilot-Session: 6307886d-3c24-4596-8924-ba44b0e850a5
Run registry and E2E validation against Microsoft.Windows.SDK.Win32Metadata 71.0.14-preview, the baseline used by the exact SAFEARRAY evidence and coverage census.

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

Copilot-Session: 6307886d-3c24-4596-8924-ba44b0e850a5
@lei9444
leileizhang (lei9444) merged commit 8b6a37c into main Aug 6, 2026
24 checks passed
@lei9444
leileizhang (lei9444) deleted the leilzh/comcodegen branch August 6, 2026 08:05
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.

3 participants