microsoft / windows-rs

Rust for Windows
https://kennykerr.ca/rust-getting-started/
Apache License 2.0
10.35k stars 486 forks source link

Add flexible registry type and byte query support #3120

Closed kennykerr closed 3 months ago

kennykerr commented 3 months ago

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

kennykerr commented 3 months ago

Thanks, I'll work on OsStr support separately.