title: Changing/Creating Windows registry.pol using Rust
body: <p>I'm trying to edit registry.pol file.
  , but I do not know how to save changes.</p>
  
  <p>I used crate registry-pol (<a href="https://docs.rs/registry-pol/1.0.0/registry_pol/v1/fn.parse.html" rel="nofollow noreferrer">https://docs.rs/registry-pol/1.0.0/registry_pol/v1/fn.parse.html</a>) to read content of the current file.</p>
  
  <pre><code>let mut f = File::open("c:\\windows\\System32\\GroupPolicy\\machine\\registry.pol").unwrap();
  let mut buffer = Vec::new();
  f.read_to_end(&amp;mut buffer).unwrap();
  let mut x = registry_pol::v1::parse(&amp;buffer).unwrap();
  let value: u32 = 1;
  let bytes = value.to_le_bytes();
  x.push(registry_pol::v1::RegistryValue {
      key: "any key".to_string(),
      value: Some("any value".to_string()),
      data_type: Some(registry_pol::v1::RegistryValueType::REG_DWORD),
      data: Some(bytes.to_vec()),
  });
  </code></pre>
  
  <p>But if I add anything to Vec I do not have a clue how to save it as new registry.pol file.
  Thanks</p>