Skip to content

Conversation

@InfyniteHeap
Copy link

@InfyniteHeap InfyniteHeap commented Jun 20, 2024

Closes #3779.

APIs provided by winreg crate is not safe, simple and abstract enough. Besides that, it probably also contains protential bugs. Because of that, it is better to replace it with windows-registry crate, which is officially published and maintained by Microsoft.

@rami3l rami3l changed the title Change dependency to windows-registry Replace winreg with windows-registry Jun 20, 2024
@InfyniteHeap InfyniteHeap marked this pull request as ready for review June 20, 2024 16:04
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

I haven't done a complete review yet, because I think there's a bunch of stuff left to clean up. The core change looks great though, thanks for working on this!

@InfyniteHeap InfyniteHeap reopened this Jun 21, 2024
@InfyniteHeap InfyniteHeap deleted the change-dependency branch June 21, 2024 03:30
@InfyniteHeap InfyniteHeap restored the change-dependency branch June 21, 2024 03:31
@InfyniteHeap InfyniteHeap reopened this Jun 21, 2024
@InfyniteHeap InfyniteHeap reopened this Jun 21, 2024
@InfyniteHeap InfyniteHeap requested review from djc and rami3l June 21, 2024 06:32
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Overall a really nice improvement!

@djc
Copy link
Contributor

djc commented Jun 22, 2024

Sorry, but it turns out I had to make some changes to registry-related API in #3893. Hopefully it won't be too hard to rebase on top of my changes.

@InfyniteHeap
Copy link
Author

Sorry, but it turns out I had to make some changes to registry-related API in #3893. Hopefully it won't be too hard to rebase on top of my changes.

Oh, I think I'd better replace dependency from scratch lest appear some unexpect problems.😅

@InfyniteHeap
Copy link
Author

This PR will keep closed until windows-registry updates.

@rami3l
Copy link
Member

rami3l commented Jun 29, 2024

@InfyniteHeap FYI microsoft/windows-rs#3119 has been closed, so you might restart your work on this one!

@InfyniteHeap
Copy link
Author

@InfyniteHeap FYI microsoft/windows-rs#3119 has been closed, so you might restart your work on this one!

Sounds great! I'll restart my work when new version of windows-registry is published on crates.io! :)

@InfyniteHeap InfyniteHeap reopened this Jul 5, 2024
@rami3l
Copy link
Member

rami3l commented Sep 22, 2024

It seems that the openssl-sys has some issues that prevent the commits from being passed.

@InfyniteHeap You shouldn't update Cargo.lock for dependencies irrelevant to this PR. That's automatically handled by renovate on our side.

@InfyniteHeap
Copy link
Author

It seems that the openssl-sys has some issues that prevent the commits from being passed.

@InfyniteHeap You shouldn't update Cargo.lock for dependencies irrelevant to this PR. That's automatically handled by renovate on our side.

It seems that I should only open VS Code to let it automatically update Cargo.lock instead of manually running cargo update...

Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

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

This PR is getting even clearer than the previous iteration, modulo some eventual rebases (esp. after @kennykerr's possible API adjustments). Good job!

PS: As a favor, please consider listing @ChrisDenton as a co-author of some (or all) of your commits when applicable :)

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks for all the work!

@kennykerr
Copy link
Contributor

I could implement Deref in place of as_wide and that would provide all of this directly.

@rami3l
Copy link
Member

rami3l commented Sep 22, 2024

Current status: Waiting for a new upstream release to ship microsoft/windows-rs#3148...

@kennykerr
Copy link
Contributor

Here's the Deref implementation for HSTRING. microsoft/windows-rs#3291

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

@kennykerr what's the rationale for using all-uppercase names for stuff like HSTRING and HRESULT? Are you trying to match the upstream names exactly? It looks rather unidiomatic.

@kennykerr
Copy link
Contributor

what's the rationale for using all-uppercase names for stuff like HSTRING and HRESULT? Are you trying to match the upstream names exactly? It looks rather unidiomatic.

There are countless identifiers in the Windows API. It's just not very practical to come up with different names - it has been attempted. It also makes it a lot harder to cross-reference documentation and source code for equivalent types.

@InfyniteHeap
Copy link
Author

What about these changes?

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

I think this is looking great. @InfyniteHeap and @kennykerr thanks for all the work! Would be nice to get that windows-registry release out so that we can move forward with this.

@kennykerr
Copy link
Contributor

Coming up: microsoft/windows-rs#3293

@InfyniteHeap InfyniteHeap marked this pull request as ready for review September 25, 2024 05:05
@kennykerr
Copy link
Contributor

Version 0.3.0 of the windows-registry crate has been published. https://github.com/microsoft/windows-rs/releases/tag/0.60.0

@djc
Copy link
Contributor

djc commented Sep 25, 2024

Can you squash all of your changes into a single commit?

@InfyniteHeap
Copy link
Author

Can you squash all of your changes into a single commit?

I've done this.

Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

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

LGTM, and thanks for your work @InfyniteHeap!

PS: You may proceed with cleanup PRs such as the one discussed in #3896 (comment) shortly after.

@djc djc added this pull request to the merge queue Sep 26, 2024
Merged via the queue into rust-lang:master with commit bce3ed6 Sep 26, 2024
@InfyniteHeap InfyniteHeap deleted the change-dependency branch September 26, 2024 07:47
@rami3l rami3l mentioned this pull request Oct 6, 2024
3 tasks
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.

rustup fails to open non-existing windows registry path

5 participants