MCPcopy Create free account
hub / github.com/PowerShell/DSC / convert_reg_value

Function convert_reg_value

lib/dsc-lib-registry/src/lib.rs:433–447  ·  view source on GitHub ↗
(value: &Data)

Source from the content-addressed store, hash-verified

431}
432
433fn convert_reg_value(value: &Data) -> Result<Option<RegistryValueData>, RegistryError> {
434 match value {
435 Data::String(s) => Ok(Some(RegistryValueData::String(s.to_string_lossy()))),
436 Data::ExpandString(s) => Ok(Some(RegistryValueData::ExpandString(s.to_string_lossy()))),
437 Data::Binary(b) => Ok(Some(RegistryValueData::Binary(b.clone()))),
438 Data::U32(d) => Ok(Some(RegistryValueData::DWord(*d))),
439 Data::MultiString(m) => {
440 let m: Vec<String> = m.iter().map(|s| s.to_string_lossy()).collect();
441 Ok(Some(RegistryValueData::MultiString(m)))
442 },
443 Data::U64(q) => Ok(Some(RegistryValueData::QWord(*q))),
444 Data::None => Ok(None),
445 _ => Err(RegistryError::UnsupportedValueDataType)
446 }
447}
448
449#[test]
450fn get_hklm_key() {

Callers 2

getMethod · 0.85
setMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected