W95REG(3) libwin Reference W95REG(3) NAME w95reg - libwin registry access functions SYNOPSIS include <libwin.h> long w95_reg_openkey (long hKey, char *subkeyname, long *hResult); long w95_reg_flushkey (long hKey); long w95_reg_closekey (long hKey); long w95_reg_createkey (long hKey, char *subkeyname, long *hResult); long w95_reg_deletekey (long hKey, char *subkeyname); long w95_reg_deletevalue (long hKey, char *valuename); long w95_reg_queryvalue (long hKey, char *subkeyname, char *buffer, long *bufferlen); long w95_reg_queryvalueex (long hKey, char *valuename, long *reserved, long *type, char *buffer, long *bufferlen); long w95_reg_enumkey (long hKey, long subkeyindex, char *keyname, long keynamelen); long w95_reg_enumvalue (long hKey, long subkeyindex, char *value, long *valuelen, long *reserved, long *type, char *buffer, long *bufferlen); long w95_reg_setvalue (long hKey, char *subkeyname, long type, char *buffer, long bufferlen); long w95_reg_setvalueex (long hKey, char *value, long reserved, long type, char *buffer, long bufferlen); DESCRIPTION The Windows registry contains two types of entry: keys and values. Keys are like branches in a tree, i.e. they struc- ture the data stored in the registry. Values are like leaves, and contain the actual data. Each key can have many named values. Each key has a default value, which is unnamed (i.e. its name is a null string). w95_reg_openkey() opens a sub-key of the specifed key. hKey can be a predefined key such as: HKEY_CLASSES_ROOT HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE libwin 0.1.5 22 September 2002 1 W95REG(3) libwin Reference W95REG(3) HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG HKEY_DYN_DATA or a key previously opened using w95_reg_openkey(). Clearly, one must open one of the predefined keys first, and then open sub-keys of it. The opened key's handle is stored in hResult. w95_reg_closekey() closes the specified key. w95_reg_flushkey() writes the specified key, and maybe some of its subkeys, to disk. This happens automatically using write-caching, but this function forces the writing to happen. This function doesn't usually need to be used. w95_reg_createkey() creates a sub-key of hKey with the specified name. w95_reg_deletekey() deletes the sub-key of hKey with the specified name. w95_reg_queryvalue() obtains the unnamed value for the specified subkey of the key hKey. This can be looked as a default value for that key. w95_reg_queryvalueex() obtains the named value for the specified key hKey. This is more useful than w95_reg_queryvalue() as most Windows '95 keys have named values. type can be one of: REG_SZ ASCII REG_EXPAND_SZ ASCII with expand environment variables REG_BINARY Binary data REG_DWORD Double words REG_DWORD_LITTLE_ENDIAN Double words, little-endian arrangement REG_DWORD_BIG_ENDIAN Double words, big-endian arrangement w95_reg_setvalueex() works in a similar way to w95_reg_queryvalueex(). w95_reg_deletevalue() can be used to remove a named value from the specified key. w95_reg_setvalue() is an older function that only allows nameless string values to be stored. The type parameter libwin 0.1.5 22 September 2002 2 W95REG(3) libwin Reference W95REG(3) must be REG_SZ. w95_reg_setvalueex() should be used instead. w95_reg_enumkey() enumerates subkeys of the specified key. On the first call, subkeyindex should be set to 0. After that, subkeyindex should be incremented and the function called again repeatedly, until the error ERROR_NO_MORE_ITEMS is returned. This indicates all the keys have been enumerated. The key name is stored in the specified buffer. w95_reg_enumvalue() functions in a similar way to w95_reg_enumkey(), but the value data is returned as well as the value's name. In all these functions, any parameter named reserved should be set to 0 or NULL, as appropriate. Windows-style registry function names and types can also be used. The Windows registry function names are: RegOpenKey RegFlushKey RegCloseKey RegCreateKey & so on For a detailed reference of Windows's Registry functions, see the Windows SDK. RETURN VALUES These functions return ERROR_SUCCESS, 0, on success and non-zero otherwise. If there's more data than will fit in the specified buffer, then ERROR_MORE_DATA is returned. For enumerations, the error will be ERROR_NO_MORE_ITEMS when all the keys / values have been enumerated. SEE ALSO libwin(7) BUGS These functions do not work on Windows NT, 2000 or XP. libwin 0.1.5 22 September 2002 3
Page created on Sun Sep 29 21:12:26 2002 by m2h.pl, a man page to HTML convertor.
m2h.pl Version 1.3.2, Copyright 1997-2002 by Richard Dawe <webmaster@phekda.org>