refactor: replace direct windows-sys usage with windows/windows-registry crates - #2778
Merged
Conversation
…t-windows-sys # Conflicts: # CHANGELOG.md
DavSanchez
enabled auto-merge (squash)
August 7, 2026 07:46
sigilioso
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on #2760 I noticed an area of improvement regarding the Windows API crates.
Summary
agent-control'sis_elevated.rsnow useswindows::Win32::{Foundation,Security,System::Threading}instead ofwindows_sys, same logic,Result-based error handling.resource-detection's registry read (MachineGuidlookup) is rewritten on top ofwindows-registry'sKeyAPI, dropping ~100 lines of unsafeRegOpenKeyExW/RegQueryValueExWFFI entirely.windows-sysdependency from both crates'Cargo.toml(workspace-level entry stays —fsonmainstill needs it until fix(fs): make Windows admin ACE inheritable #2760 merges).Follow-up to #2760, but branched independently from
mainsince there's no file overlap.Test plan
cargo check --workspace(host target)cargo zigbuild --target x86_64-pc-windows-gnu -p newrelic_agent_control -p resource-detection— real Windows cross-compile, not justcfgskipcargo fmt --checkon touched cratespush_pr_checks_tests.yml) as final confirmation