Skip to content

Add copied IBuffer byte conversions - #129

Merged
leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-ibuffer-copied-conversions
Sep 3, 2026
Merged

leileizhang (lei9444) merged 2 commits into
mainfrom
lei9444-ibuffer-copied-conversions

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a shared core copied-conversion boundary for Windows.Storage.Streams.IBuffer, including Length/Capacity validation and an exact typed IBufferByteAccess cast
  • reject malformed QueryInterface success with a null output as E_POINTER before pointer adoption or vtable access
  • retain the WinRT owner while copying its borrowed byte pointer; handle empty and null pointers safely without exposing or adopting native addresses
  • create owned WinRT buffers for Python bytes/bytearray and JavaScript Buffer/Uint8Array, with generated wrapper methods, declarations, and stubs
  • preserve existing WinRT UInt8[] behavior and keep Classic COM models and public APIs separate
  • update package docs, the Python cryptography sample, and live Windows E2E coverage

Validation

  • cargo test -p dynwinrt: 266 passed, 1 ignored
  • cargo test -p dynwinrt-codegen: 478 passed across all test targets, including generated tsc --noEmit
  • JavaScript lint/build/test: 0 lint warnings/errors; 42 passed, 2 skipped
  • python -m pytest bindings\py\tests: 133 passed
  • live Windows E2E: Python 42/42 and TypeScript 38/38 passed
  • generated Python API mypy check passed
  • ARM64 JavaScript and Python native package builds passed
  • x64 core and JavaScript compile checks passed
  • cargo fmt --all -- --check passed
  • updated Python cryptography sample generated and ran successfully

cargo clippy -p dynwinrt -p dynwinrt-codegen --all-targets -- -D warnings was also run; it remains blocked by existing repository-wide warnings outside the added code under the current Rust toolchain.

Closes #123

Add shared safe copying through IBufferByteAccess and expose copied byte-container APIs for Python, JavaScript, and generated wrappers.

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

Copilot-Session: 877667c9-bbc4-4950-b7d3-d03826a19853
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 82.86% 79.2% 82.75% regions
Generated Python projections 70.5% n/a 21.71% branches
JavaScript aggregate 21.28% 20.6% 54.04% branches
JavaScript runtime 19.91% 14.28% 7.14% branches
Generated WinRT projections 25.8% 19.3% 54.74% branches
Generated Classic COM projections 14.64% 24.46% 53.75% branches

View workflow run and download full HTML/LCOV/XML reports

Use a typed exact-IID QueryInterface cast so malformed successful queries with null outputs return E_POINTER before pointer adoption or vtable access.

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

Copilot-Session: 877667c9-bbc4-4950-b7d3-d03826a19853
@lei9444
leileizhang (lei9444) merged commit 24157f1 into main Sep 3, 2026
24 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-ibuffer-copied-conversions branch September 3, 2026 06:43
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.

Add safe copied byte conversion for WinRT IBuffer values

2 participants