Skip to content

Generate focused Windows bindings - #1939

Open
Kenny Kerr (kennykerr) wants to merge 2 commits into
microsoft:mainfrom
kennykerr:windows-bindgen
Open

Kenny Kerr (kennykerr) wants to merge 2 commits into
microsoft:mainfrom
kennykerr:windows-bindgen

Conversation

@kennykerr

@kennykerr Kenny Kerr (kennykerr) commented Dec 4, 2026 •

Copy link
Copy Markdown

Switch from windows to focused bindings generated by windows-bindgen. This keeps our Windows API compilation smaller and avoids coupling our bindings to the umbrella crate's release cycle. The generated code is checked in, so SDK consumers don't build or run the generator.

Most of the changes are mechanical:

  • Generate bindings for the SDK runtime, build script, IsolationSession, and test proxy, with a shared regeneration command and CI drift check.
  • Update windows-core, windows-collections, and windows-future.
  • Adapt callers to raw handles and flags, explicit buffer lengths and output pointers, native error returns, and explicit COM interface casts.
  • Generate IsolationSession bindings from published windows-default metadata, replacing the private WinMD workflow and its version checks.

No supported SDK API or backend behavior changes are intended. Rust 1.93 remains supported.

Microsoft Reviewers: Open in CodeFlow

@kennykerr
Kenny Kerr (kennykerr) requested a review from a team as a code owner December 4, 2026 22:47
Copilot AI max review requested due to automatic review settings December 4, 2026 22:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Routine workspace tests can overwrite local binding edits, the missing dependency-feed entry blocks native builds, and access-check errors lose readable system explanations.

3 open issues
What changed in this PR

Replaces MXC’s umbrella Windows dependency with focused, checked-in bindings to reduce compilation scope without intended SDK or backend behavior changes.

Changes:

  • Adds binding generation filters, regeneration guidance, and CI drift checks.
  • Migrates Windows callers and updates supporting crates.
  • Replaces private IsolationSession metadata and version checks with public metadata.
File Description
src/​tools/​wxc/​tests/​startup.rs Updates delayed COM import assertions.
src/​tools/​wxc/​src/​main.rs Migrates console control bindings.
src/​tools/​wxc/​Cargo.toml Replaces the Windows dependency.
src/​tools/​mxc_windows_bindgen/​tests/​generate_bindings.rs Generates four binding sets.
src/​tools/​mxc_windows_bindgen/​test-proxy.txt Selects test-proxy APIs.
src/​tools/​mxc_windows_bindgen/​isolation-session.txt Selects IsolationSession APIs.
src/​tools/​mxc_windows_bindgen/​Cargo.toml Declares generator dependencies.
src/​tools/​mxc_windows_bindgen/​build.txt Selects build-time APIs.
src/​tools/​mxc_diagnostic_console/​src/​etw.rs Migrates trace collection bindings.
src/​tools/​mxc_diagnostic_console/​Cargo.toml Removes the umbrella dependency.
src/​testing/​wxc_test_proxy/​src/​windows/​mod.rs Exposes local bindings.
src/​testing/​wxc_test_proxy/​src/​windows/​bindings.rs Adds generated shutdown APIs.
src/​testing/​wxc_test_proxy/​src/​main.rs Adapts shutdown handle operations.
src/​testing/​wxc_test_proxy/​Cargo.toml Uses Windows core types.
src/​mxc-sdk/​tests/​wslc_stdin_handle_probe.rs Migrates COM initialization.
src/​mxc-sdk/​tests/​w365_lifecycle/​execution.rs Adapts socket, console, and pipe fixtures.
src/​mxc-sdk/​tests/​w365_lifecycle.rs Adapts key deletion results.
src/​mxc-sdk/​tests/​streaming_processcontainer.rs Migrates output-handle checks.
src/​mxc-sdk/​tests/​nvx/​crate_bundle_integrity.rs Includes build-time verification bindings.
src/​mxc-sdk/​tests/​nvx_e2e.rs Migrates process and console fixtures.
src/​mxc-sdk/​tests/​module_lifetime.rs Adapts module-handle validation.
src/​mxc-sdk/​tests/​fixtures/​module_lifetime.rs Imports replacement bindings.
src/​mxc-sdk/​src/​windows/​mod.rs Exposes bindings and handle validation.
src/​mxc-sdk/​src/​lib.rs Wires bindings and updates impersonation.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​policy.rs Migrates parent-process inspection.
src/​mxc-sdk/​src/​core/​mxc_common/​telemetry/​correlation_state.rs Adapts file-lock calls.
src/​mxc-sdk/​src/​core/​mxc_common/​system_dir.rs Supplies explicit buffer lengths.
src/​mxc-sdk/​src/​core/​mxc_common/​string_util.rs Migrates string and SID helpers.
src/​mxc-sdk/​src/​core/​mxc_common/​state_aware_dispatch.rs Updates test pipe handles.
src/​mxc-sdk/​src/​core/​mxc_common/​state_aware_backend.rs Uses raw Windows pipe handles.
src/​mxc-sdk/​src/​core/​mxc_common/​script_runner.rs Updates test creation flags.
src/​mxc-sdk/​src/​core/​mxc_common/​module_lifetime.rs Migrates module pinning.
src/​mxc-sdk/​src/​core/​mxc_common/​microvm_staging.rs Adapts reparse-point flags.
src/​mxc-sdk/​src/​core/​mxc_common/​logger.rs Migrates pipe-server identity checks.
src/​mxc-sdk/​src/​core/​mxc_common/​filesystem_probe.rs Adapts worker impersonation.
src/​mxc-sdk/​src/​core/​mxc_common/​filesystem_object.rs Migrates file identity inspection.
src/​mxc-sdk/​src/​core/​mxc_common/​filesystem_canonical.rs Adapts path-resolution calls.
src/​mxc-sdk/​src/​core/​mxc_common/​filesystem_access.rs Migrates access checks and errors.
src/​mxc-sdk/​src/​core/​mxc_common/​exec_stream.rs Adapts stream handle conversion.
src/​mxc-sdk/​src/​core/​mxc_common/​diagnostic.rs Migrates token and process inspection.
src/​mxc-sdk/​src/​core/​mxc_common/​com_apartment.rs Migrates COM apartment calls.
src/​mxc-sdk/​src/​core/​mxc_common/​api_set.rs Declares the API-set import directly.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​tdh_decode.rs Adapts event decoding bindings.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​path_norm.rs Supplies explicit device-query buffers.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​network_extractors.rs Updates the GUID import.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​mod.rs Updates native error constants.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​ffi.rs Migrates dynamic loading and handles.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​extractors.rs Updates the GUID import.
src/​mxc-sdk/​src/​core/​learning_mode_windows/​capability_dacl.rs Migrates capability SID operations.
src/​mxc-sdk/​src/​bin/​wslc_daemon/​stdin_writer.rs Adapts cancellation and pipe fixtures.
src/​mxc-sdk/​src/​bin/​wslc_daemon/​session_manager.rs Migrates COM and capacity queries.
src/​mxc-sdk/​src/​bin/​wslc_daemon/​control_server.rs Migrates security descriptor operations.
src/​mxc-sdk/​src/​bin/​windows_sandbox_guest/​job.rs Adapts job-object management.
src/​mxc-sdk/​src/​backends/​wslc/​common/​wsl_container_runner.rs Migrates event waits and duplication.
src/​mxc-sdk/​src/​backends/​wslc/​common/​state_aware.rs Uses raw execution pipe handles.
src/​mxc-sdk/​src/​backends/​wslc/​common/​session_resources.rs Updates COM memory cleanup.
src/​mxc-sdk/​src/​backends/​wslc/​common/​sandbox.rs Migrates exit-watch events.
src/​mxc-sdk/​src/​backends/​wslc/​common/​registry_policy.rs Migrates parent-process inspection.
src/​mxc-sdk/​src/​backends/​wslc/​common/​image.rs Migrates pull-worker COM initialization.
src/​mxc-sdk/​src/​backends/​wslc/​common/​daemon_record.rs Adapts process inspection and locking.
src/​mxc-sdk/​src/​backends/​wslc/​common/​daemon_client.rs Migrates daemon launch and pipe operations.
src/​mxc-sdk/​src/​backends/​wslc/​common/​container_steps.rs Adapts capacity queries and exit waits.
src/​mxc-sdk/​src/​backends/​windows_sandbox/​lifecycle/​teardown.rs Migrates console control registration.
src/​mxc-sdk/​src/​backends/​windows_sandbox/​lifecycle/​state_aware.rs Updates absent-stream handles.
src/​mxc-sdk/​src/​backends/​windows_sandbox/​lifecycle/​control_plane.rs Migrates security descriptor tests.
src/​mxc-sdk/​src/​backends/​w365agents/​exec/​piped.rs Adapts pipe cancellation and handles.
src/​mxc-sdk/​src/​backends/​w365agents/​exec/​output.rs Migrates output handle operations.
src/​mxc-sdk/​src/​backends/​w365agents/​exec/​input.rs Adapts console reads and cancellation.
src/​mxc-sdk/​src/​backends/​process_container/​common/​secenv_policy_tests.rs Migrates native launch fixtures.
src/​mxc-sdk/​src/​backends/​process_container/​common/​process_mitigation.rs Updates binding references in comments.
src/​mxc-sdk/​src/​backends/​process_container/​common/​policy_preparation_backend_tests.rs Updates process creation flags.
src/​mxc-sdk/​src/​backends/​process_container/​common/​native_capture.rs Migrates capture handles and constants.
src/​mxc-sdk/​src/​backends/​process_container/​common/​launch_diagnostics.rs Adapts native error comparisons.
src/​mxc-sdk/​src/​backends/​process_container/​common/​environment.rs Migrates environment-block creation.
src/​mxc-sdk/​src/​backends/​nvx/​state_aware.rs Adapts stack and impersonation tests.
src/​mxc-sdk/​src/​backends/​nvx/​signature_verification.rs Migrates trust and certificate APIs.
src/​mxc-sdk/​src/​backends/​nvx/​runner.rs Uses raw streaming handles.
src/​mxc-sdk/​src/​backends/​nvx/​mod.rs Adapts stack-limit queries.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​state_aware.rs Updates absent-stream handles.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​sandbox.rs Adapts output reader ownership.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​process.rs Updates the process-status constant reference.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​process_options.rs Passes working directories as strings.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​process_new.rs Explicitly casts for process closure.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​process_legacy.rs Explicitly casts for process closure.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​owned_thread.rs Migrates impersonation and COM tests.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​manager_new.rs Adapts interface casts, strings, and handles.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​error.rs Updates native error assertions.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​console_relay.rs Migrates console relay APIs.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​availability.rs Updates activation-error imports.
src/​mxc-sdk/​src/​backends/​isolation_session/​bindings/​mod.rs Documents public metadata generation.
src/​mxc-sdk/​src/​backends/​hyperlight/​common/​mod.rs Migrates hypervisor library probing.
src/​mxc-sdk/​examples/​w365_execution.rs Imports replacement Windows bindings.
src/​mxc-sdk/​examples/​process_container_common_lm_capture.rs Migrates native launch examples.
src/​mxc-sdk/​Cargo.toml Replaces umbrella and provenance dependencies.
src/​mxc-sdk/​build/​windows/​mod.rs Exposes build-time bindings.
src/​mxc-sdk/​build/​isolation_session_bindings/​README.md Removes private metadata guidance.
src/​mxc-sdk/​build/​isolation_session_bindings/​GENERATION_INFO.toml Removes obsolete provenance metadata.
src/​mxc-sdk/​build/​build_mxc_telemetry_component.rs Migrates signature and DLL inspection.
src/​mxc-sdk/​build/​build_isolation_session_bindings.rs Removes the old version-coupling check.
src/​mxc-sdk/​build.rs Wires replacement build bindings.
src/​Cargo.toml Registers the generator and updates dependencies.
docs/​development/​build-and-test/​pull-requests.md Documents regeneration and drift validation.
docs/​development/​architecture/​backends/​isolation-session/​oneshot.md Documents the public metadata workflow.
.github/​workflows/​Versioning.Checks.Job.yml Adds generated-binding drift validation.

Review effort: Max

Comment thread src/Cargo.toml Outdated
windows-collections = "0.101"
windows-future = "0.101"
windows-bindgen = "=0.102.0"
windows-default = "=0.102.0"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The uncached windows-default dependency causes CI to skip platform and lint jobs, while incorrect indentation would independently fail the formatting gate.

3 open issues
2 resolved since last review

Review effort: Max

Comment thread src/mxc-sdk/src/lib.rs Resolved
Copilot AI max review requested due to automatic review settings December 5, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The dependency-feed check cannot fetch windows-default from MxcDependencies (HTTP 401), causing Windows, Linux, macOS, and lint jobs to be skipped.

2 open issues
2 resolved since last review

Review effort: Max

Comment thread src/Cargo.toml
windows-collections = "0.101"
windows-future = "0.101"
windows-bindgen = "=0.102.0"
windows-default = "=0.102.1"

This branch has not been deployed

No deployments
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.

2 participants