Wrong Integer Type Returned
Brought to you by:
apnadkarni
Hello.
I have problem with reading dword registry values that are larger than int32. The code simply returns -1.
For example I have a dword value for FileSizeLimitInBytes as 0xffffffff (uint32 - 4294967295), however, TWAPI is treating the value as int32 and returns -1.
Anonymous
Forgot to point to the MS doc page for DWORD.
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2?redirectedfrom=MSDN
Thanks for the report. It might a bit of time before I put out a new release though. Have you tried reading using Tcl's registry command? As a work around in the meanwhile perhaps you can do a
format 0x%x $regdwordvalue
when you read.
I appreciate your quick response.
Unfortunately, Tcl's registry command returns -1 as well.
However, the workaround you provided works fine with a minor modification. I needed a decimal number to calculate the max file size.
format %u $regdwordvalueI didn't realize that the value of -1 can be converted, I thought it was just an error.
Thank you for the help.
Finally revisiting this, I agree that the value should be unsigned. However, not just Tcl's registry command, but .Net as well (see https://github.com/dotnet/runtime/issues/24954) treat
REG_DWORDas signed. So I am hesitant to change it to return unsigned values. Closing.