You just experienced a (known) Plus! bug
:
1) Plus! can't handle numbers larger than 0x80000000. (this should be fixed in next update). In fact, every interop function of Plus! requires SIGNED numbers instead of UNSIGNED numbers.
eg: ReadWord(), ReadDWord(), WriteDWord(), etc all require signed numbers.
so, instead of:
code:
var HKEY_CURRENT_USER = 0x80000001;
which will return the unsigned number 2147483649, use this:
code:
var HKEY_CURRENT_USER = 0x80000000 | 1;
which will return the equivalent, but signed, number -2147483647...
[edit]
or:
code:
var HKEY_CURRENT_USER = 0x80000001 & 0xFFFFFFFF;
[/edit]
The reason why certain keys do work is because Plus! interprets that provided unsigned number as a signed one (thus wrongly) and thus you actually open the key under a different main hive, namely HKEY_CLASSES_ROOT in this case (which does has a "Software" subkey).
2)
quote:
Return Values
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
Thus those registry APIs don't use GetLastError, they return the error directly as the return value...
However, I must say
Interop.GetLastError always returns 0 with me too with certain APIs (APIs which do provide the error in GetLastError).