on 07-11-2016 1:56 PM
I'm using PB 12.5.2 and since it's a 32 bit application, I imagine I can't use RegistryKeys and RegistryGet to read the 64 bit registry -- as also noted in this thread...
I'm trying to use RegOpenKeyEx as described in this article, but with KEY_WOW64_64KEY (256) as the samDesired parameter, and I can't seen to get it to work...
SAP Sybase Forums - PowerBuilder - General Discussion - How do I determine type of Registry value
Here MSDN says that the KEY_WOW64_64KEY flag needs to be combined using the OR operator with the other flags in this table that either query or access registry values. Is it possible to pass KEY_WOW64_64KEY | KEY_QUERY_VALUE (256 OR 1)?
Hi Steve,
Here is the code that works for me (to get the limit of handles) :
CONSTANT ulong ERROR_NONE = 0
CONSTANT ulong KEY_QUERY_VALUE = 1
CONSTANT ulong KEY_ALL_ACCESS = 63
CONSTANT ulong KEY_WOW64_64KEY = 256
CONSTANT ulong HKEY_CURRENT_USER = 2147483649
CONSTANT ulong HKEY_LOCAL_MACHINE = 2147483650
String ls_Key = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows", &
ls_Value = "USERProcessHandleQuota"
uLong lul_Key, lul_Result, lul_Type, lul_Data = 4
Long ll_Handles
IF RegOpenKeyEx( HKEY_LOCAL_MACHINE, ls_Key, 0, KEY_QUERY_VALUE + KEY_WOW64_64KEY, lul_Key) = ERROR_NONE THEN
lul_Result = RegQueryValueEx( lul_Key, ls_Value, 0, lul_Type, ll_Handles, lul_Data)
RegCloseKey(lul_Key)
END IF
Regards,
Anthony
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And here is how my external functions are declared :
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"
Hi Steve;
How about using PB 12.6 and build a 64bit EXE to read the 64bit registry values? If you don't want to upgrade your entire PB 12.5.x application to v12.6, you could just build a small EXE from PB 12.6 and call it from your v12.5.x application to return the proper registry values.
Food for thought (note - I have not tried this approach personally - just an idea).
Regards .. Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Steve,
Just add them together...
256 = 0000000100000000
1 = 0000000000000001
----------------------
257 = 0000000100000001
So, passing 257 to the API should do the trick.
If you are using the PFC, you could use n_cst_numerical.of_bitWiseOr(256, 1), but that is probably overkill.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.