On 2020-01-28 18:18, Trey Harris wrote:
my uint $z = -32;
224
Another misunderstanding on my part. I thought it
would barf.
All I really need to know is what is expected.
To me I am getting wrong answers back, but as
long as they are consistent answers I can deal
with it:
if $ValueData.^name ne "Int" || $ValueData < 0 { # UInt gets "boxed
to an Int
Thank you for all the time you have spent with me on this!
-T
This all came up when I tried to match
RegSetValueExW(
_In_ HKEY hKey,
_In_opt_ LPCWSTR lpValueName,
_Reserved_ DWORD Reserved,
_In_ DWORD dwType,
_In_reads_bytes_opt_(cbData) CONST BYTE * lpData,
_In_ DWORD cbData
where CbData can either be a UTF little endian C string,
terminated by a nul or a four byte little endian
unsigned integer (no two's complement allowed) depending
on the value of lpValueName (REG_SZ, REG_DWORD, etc.)
I wound up doing this:
subset StrOrDword where Str | UInt;
sub WinRegSetValue( WinRegHives $Hive, Str $SubKey, Str $KeyName,
ValueNames $ValueType, StrOrDword $ValueData, Bool $Debug = False )
returns DWORD is export( :WinRegSetValue ) {