System.RegGetValue{,s} does not handle DWORD entries correctly.
src/modules/system/nt.c:push_regvalue()
uses the wrong shifts for bytes other than the LSB:
case REG_DWORD_LITTLE_ENDIAN:
push_int(EXTRACT_UCHAR(buffer)+
(EXTRACT_UCHAR(buffer+1)<<1)+
(EXTRACT_UCHAR(buffer+2)<<2)+
(EXTRACT_UCHAR(buffer+3)<<3));
break;
case REG_DWORD_BIG_ENDIAN:
push_int(EXTRACT_UCHAR(buffer+3)+
(EXTRACT_UCHAR(buffer+2)<<1)+
(EXTRACT_UCHAR(buffer+1)<<2)+
(EXTRACT_UCHAR(buffer)<<3));
break;
Fortunately it seems like the most common DWORD entries in the registry are <= 255.
This bug has been there since the original implementation of System.RegGetValues()
et al in commit 53bdc644 (src/modules/system/nt.c:1.18
) in Pike 7.1.5.
Note that the bug is also present in Pike 7.0.318 and later due to a backport in commit 9481e19e (src/modules/system/nt.c:1.19
).
The bug should be fixed in all relevant versions of Pike.