Closed Amedama96 closed 7 years ago
I want to create binary registry value with data '0x00', but xRegistry resource set none value.
I want to create binary reg value with data zero
For that, write and exec psdsc configuration like...
xRegistry Zero_RegBinary { Ensure = "Present" Key = "HKEY_LOCAL_MACHINE\SYSTEM\Tests" ValueName = "TestValue" ValueData = "0x00" # same result if you set ValueData="0", ValueType = "Binary" }
Then, sadly, xRegistry resource create a reg value that has 'zero-length binary value'
I confirmed the issue also have the In-box Regisrtry resource in Windows 10 1607.
I've discovered the issue caused by this code.
$val = $Data[0].TrimStart('0x')
Apparently the code is intended to remove the first '0x' of $Data[0]. but if $Data[0] = '0' or '0x00', empty value is set in $val. Perhaps this is undesired behavior.
I would like to propose to modify the code like...
if($Data[0].StartsWith('0x')) { $val = $Data[0].Substring(2) } else { $val = $Data[0] }
It's a little redundant, but I think it is easy to understand and behave properly.
This issue fixed and merged #299 by @kwirkykat
Description
I want to create binary registry value with data '0x00', but xRegistry resource set none value.
Detail
I want to create binary reg value with data zero
For that, write and exec psdsc configuration like...
Then, sadly, xRegistry resource create a reg value that has 'zero-length binary value'
I confirmed the issue also have the In-box Regisrtry resource in Windows 10 1607.
How to fix
I've discovered the issue caused by this code.
Apparently the code is intended to remove the first '0x' of $Data[0]. but if $Data[0] = '0' or '0x00', empty value is set in $val. Perhaps this is undesired behavior.
I would like to propose to modify the code like...
It's a little redundant, but I think it is easy to understand and behave properly.