Regashii
Regashii is a Rust crate that lets you (de)serialize Windows Regedit *.reg files.
Design
-
This crate aims to be as tolerant as Regedit itself. Regedit will generally ignore lines that it can't handle and even ignore garbage in some positions (e.g., after a key name). When you parse a
*.regfile with this crate, the output should include the keys/values that Regedit would actually import. -
On the other hand, if Regedit would ignore some text, then this crate won't include it in the parsed output. This crate does not preserve formatting or comments.
-
This crate can (de)serialize from string data, or it can read/write the files for you. Regedit uses UTF-8 or UTF-16 depending on the export format, which this crate automatically handles accordingly.
-
This crate attempts to handle various edge cases in a way compatible with Regedit. This includes:
- Preserving invalid values that Regedit is willing to import
(e.g., a
hex(4)dword value with the wrong number of bytes) - Serializing
szstrings values ashex(1)bytes if they contain illegal characters - Handling strings which may or may not be null-terminated
If you find an edge case that's handled poorly, please report it.
- Preserving invalid values that Regedit is willing to import
(e.g., a
-
It also supports registry files from Wine.
Sample
Read
use ;
let registry = deserialize_file.unwrap;
for in registry.keys
Write
use ;
let registry = new
.with;
registry.serialize_file.unwrap;