Roland -
Thanks for the response! I tried it both ways, including this way and still got a -1 result code.
ls_hklm = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node"
ll_rc = RegistryGet (ls_hklm, "", RegString!, ls_data)
// ll_rc = -1
According to the documentation that second parameter can be an empty string.
valuename A string containing the name of a value in the registry. Each key can have one unnamed value and several named values. For the unnamed value, specify an empty string.
After reading the SAP thread I've been trying to use the Microsoft Functions.
Tom -
Thanks for the response! Can you post examples of how to use the MS APIs?
Here's what I have from the SAP thread.
// External Function declarations
FUNCTION uLong RegOpenKeyEx(uLong hKey, Ref String lpSubKey, uLong ulOptions, &
uLong samDesired, Ref uLong phkResult) &
LIBRARY "advapi32.dll" ALIAS FOR "RegOpenKeyExW"
FUNCTION uLong RegCloseKey(uLong hKey) &
LIBRARY "advapi32.dll"
FUNCTION uLong RegQueryValueEx (uLong hKey, String lpValueName, uLong lpReserved, &
ref uLong lpType, ref Long lpData, ref uLong lpcbData) &
LIBRARY "advapi32.dll" ALIAS FOR "RegQueryValueExW"
// in a function - all of this is from the SAP thread and I'll test it today
CONSTANT ulong ERROR_NONE = 0
CONSTANT ulong KEY_QUERY_VALUE = 1 // 1 = READ access
CONSTANT ulong KEY_ALL_ACCESS = 983087 // ALL access: read, create, delete
//CONSTANT ulong KEY_ALL_ACCESS = 63
CONSTANT ulong KEY_SET_VALUE = 2 // Required to create, delete, or set a registry value.
CONSTANT ulong KEY_WOW64_64KEY = 256 // Use the 64-bit registry view
CONSTANT ulong HKEY_CURRENT_USER = 2147483649
CONSTANT ulong HKEY_LOCAL_MACHINE = 2147483650
Long ll_Handle, ll_rc
String ls_Key = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows"
String ls_Value = "USERProcessHandleQuota"
String ls_return, ls_data
uLong lul_Key, lul_Result, lul_Type, lul_Data = 4 // Types: REG_SZ, REG_DWORD, REG_BINARY
// Example from the thread:
ll_rc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, ls_Key, 0, KEY_QUERY_VALUE + KEY_WOW64_64KEY, lul_Key)
IF ll_rc = ERROR_NONE THEN
lul_Result = RegQueryValueEx ( lul_Key, ls_Value, 0, lul_Type, ll_Handle, lul_Data)
RegCloseKey (lul_Key)
END IF
// If I understand what is happening above,
RegOpenKeyEx - parameter #1 identifies the top layer in the registry to access
parameter #2 is the path to the folder of the subkey to be accessed
parameter #3 is reserved - do not touch
parameter #4 identifies if we are accessing a 32 or 64 bit version of the Registry,
and the action we are taking on the subkey entry
parameter #5 will be the pointer to the data to be read
RegQueryValueEx - parameter #1 is the pointer to the data to be read
parameter #2 indicates which subkey is to be read
parameter #3 is reserved - do not touch
parameter #4 a pointer to the datatype of the subkey
parameter #5 will be the pointer to the subkey data
parameter #6 is the lenfgth of the pointer of parm #5
Based on the above, the "lul_type" value is zero by default, so I assumethat zero indicates NUMERIC data is to be retrieved.
What I need is STRING data, but nowhere can I find the value of the parameter "lul_type" for string data.
Oh, it would be nice to have the values for the other datatypes as well! :)
UPDATE: Found that information: https://www.motobit.com/help/RegEdit/cl72.htm
Thanks,
Olan