Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RegQueryInfoKey
Message
 
To
12/12/2003 03:41:12
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00858489
Message ID:
00858499
Views:
14
This message has been marked as the solution to the initial question of the thread.
#DEFINE HKEY_CLASSES_ROOT   0x80000000
#DEFINE HKEY_CURRENT_USER   0x80000001
#DEFINE HKEY_CURRENT_CONFIG 0x80000005
#DEFINE ERROR_SUCCESS 0

DECLARE INTEGER RegCloseKey IN advapi32 INTEGER hKey

DECLARE INTEGER RegOpenKeyEx IN advapi32;
	INTEGER hKey, STRING lpSubKey, INTEGER ulOptions,;
	INTEGER samDesired, INTEGER @phkResult

DECLARE INTEGER RegQueryInfoKey IN advapi32;
	INTEGER hKey, STRING @lpClass, INTEGER @lpcClass,;
	INTEGER lpReserved, INTEGER @lpcSubKeys,;
	INTEGER @lpcMaxSubKeyLen, INTEGER @lpcMaxClassLen,;
	INTEGER @lpcValues, INTEGER @lpcMaxValueNameLen,;
	INTEGER @lpcMaxValueLen, INTEGER @lpcbSecurityDescriptor,;
	STRING @lpftLastWriteTime

*|typedef struct _FILETIME {
*|  DWORD dwLowDateTime;
*|  DWORD dwHighDateTime;
*} FILETIME, *PFILETIME; 8 bytes

LOCAL lpClass, lpcClass, lpcSubKeys, lpcMaxSubKeyLen,;
	lpcMaxClassLen, lpcValues, lpcMaxValueNameLen,;
	lpcMaxValueLen, lpcbSecurityDescriptor,;
	lpftLastWriteTime, nResult

lpcClass = 64
lpClass = Repli(Chr(0), lpcClass)

STORE 0 TO lpcSubKeys, lpcMaxSubKeyLen, lpcMaxClassLen, lpcValues,;
	lpcMaxValueNameLen, lpcMaxValueLen, lpcbSecurityDescriptor

lpftLastWriteTime = Repli(Chr(0), 8)  && FILETIME, two DWORDs

nResult = RegQueryInfoKey(HKEY_CURRENT_USER,;
	@lpClass, @lpcClass, 0, @lpcSubKeys, @lpcMaxSubKeyLen,;
	@lpcMaxClassLen, @lpcValues, @lpcMaxValueNameLen,;
	@lpcMaxValueLen, @lpcbSecurityDescriptor, @lpftLastWriteTime)

IF nResult <> ERROR_SUCCESS
	? 'Error code:', nResult
	RETURN
ENDIF

? 'Class:', LEFT(lpClass, lpcClass)
? 'Number of subkeys:', lpcSubKeys
? 'The longest name:', lpcMaxSubKeyLen
? 'The longest class:', lpcMaxClassLen
? 'Associated values:', lpcValues
? 'The longest value name:', lpcMaxValueNameLen
? 'The longest data component:', lpcMaxValueLen
? 'Size of the security descriptor', lpcbSecurityDescriptor
* end of main
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform