Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flexible registry type and byte query support #3120

Merged
merged 1 commit into from
Jun 23, 2024

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jun 21, 2024

The windows-registry crate is currently pretty strict when it comes to mapping registry values and types. You cannot for example read the bytes from a registry value unless the type of that value is REG_BINARY. This makes it a little difficult to gracefully deal with invalid registry values.

This update adds the get_type methods and the resulting Type enum so that the actual type of a value can be queried directly. It also updates the get_bytes method to support returning the raw byte value even if the type isn't known to be bytes.

Related: #3119

Copy link
Collaborator

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

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

Seems good to me. Arguably we shouldn't allow setting non-unicode registry values, even if we can read them, but it is convenient to be able to use OsStr and I don't feel there's a strong reason to implement checks.

@kennykerr
Copy link
Collaborator Author

Thanks, I'll work on OsStr support separately.

@kennykerr kennykerr merged commit 863a7cf into master Jun 23, 2024
81 checks passed
@kennykerr kennykerr deleted the registry-bad-string branch June 23, 2024 13:31
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