gentoo90 / winreg-rs

Rust bindings to MS Windows Registry API
MIT License
168 stars 36 forks source link

switch from winapi-rs to windows-sys #51

Closed Philosobyte closed 1 year ago

Philosobyte commented 1 year ago

windows-sys is officially supported by Microsoft and contains many more APIs than winapi-rs does. Switching to windows-sys makes future work easier. I started from @sn99's PR #48 and discovered the reason for the test failure. HKEY is defined in windows-sys as an isize. It is possible for HKEY_CLASSES_ROOT to overflow this isize and break comparisons in the RegKey::close_(&mut self) method, thus resulting in RegKeys not being dropped when they go out of scope. The easiest fix I could think of is to cast HKEYs to a usize during the comparison.

With all due respect to @sn99, I've removed most of the stylistic changes so the PR is more focused and easier for @gentoo90 to review.

I'm pretty new to both Windows development and Rust, so I would take any feedback vigorously.

Philosobyte commented 1 year ago

Hmm, it appears @gentoo90 is working on a branch to switch to windows-sys as we speak. I will close this PR and eagerly await for gentoo90's work.

gentoo90 commented 1 year ago

Rebased onto the latest master and published as part of version 0.50.0

raymundane commented 1 year ago

Rebased onto the latest master and published as part of version 0.50.0

Thank you!