any ReadReg(int RootKey, str SubKey, str? Name, any? Default)
Reads the value of the specified registry key. The first parameter is the root key, such as HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE_32, or HKEY_LOCAL_MACHINE_64. Constants for use with this parameter are declared in ISPPBuiltins.iss accompanying ISPP. The second parameter specifies a subkey. The third parameter specifies the name of the value to read; if it is omitted or empty, the key's default (unnamed) value is read. The last optional parameter specifies the value to return on failure.
Note that this function can return a value of any type depending on the type of actual value in the registry.
REG_DWORD values are treated as signed, so values of 0x80000000 or higher are returned as negative numbers. For example, 0xFFFFFFFF is returned as -1. To get the unsigned value, apply & 0xFFFFFFFF to the result. Because & has lower precedence than ==, use parentheses when comparing the unsigned value, as in the example below.
A compiler error will be raised if an invalid root key is specified or if 64-bit registry keys are requested on 32-bit Windows.
#if (ReadReg(HKEY_CURRENT_USER, "Software\My Company\My Program", "MyValue") & 0xFFFFFFFF) == 0xFFFFFFFF
#pragma
message
"MyValue is 0xFFFFFFFF"
#endif