The Windows Registry 13

 

 

 

 

 

Registry Reference

 

The following elements are used with the registry.

 

  1. Registry Functions
  2. Registry Structures
  3. Registry Element Size Limits
  4. Registry Value Types

 

Registry Functions

 

The following are the registry functions.

 

Function

Description

GetSystemRegistryQuota()

Retrieves the current size of the registry and the maximum size that the registry is allowed to attain on the system.

RegCloseKey()

Closes a handle to the specified registry key.

RegConnectRegistry()

Establishes a connection to a predefined registry handle on another computer.

RegCopyTree()

Copies the specified registry key, along with its values and subkeys, to the specified destination key.

RegCreateKeyEx()

Creates the specified registry key.

RegCreateKeyTransacted()

Creates the specified registry key and associates it with a transaction.

RegDeleteKey()

Deletes a subkey and its values.

RegDeleteKeyEx()

Deletes a subkey and its values from the specified platform-specific view of the registry.

RegDeleteKeyTransacted()

Deletes a subkey and its values from the specified platform-specific view of the registry as a transacted operation.

RegDeleteKeyValue()

Removes the specified value from the specified registry key and subkey.

RegDeleteTree()

Deletes the subkeys and values of the specified key recursively.

RegDeleteValue()

Removes a named value from the specified registry key.

RegDisablePredefinedCache()

Disables handle caching for the predefined registry handle for HKEY_CURRENT_USER for the current process.

RegDisablePredefinedCacheEx()

Disables handle caching for all predefined registry handles for the current process.

RegDisableReflectionKey()

Disables registry reflection for the specified key.

RegEnableReflectionKey()

Enables registry reflection for the specified disabled key.

RegEnumKeyEx()

Enumerates the subkeys of the specified open registry key.

RegEnumValue()

Enumerates the values for the specified open registry key.

RegFlushKey()

Writes all attributes of the specified open registry key into the registry.

RegGetKeySecurity()

Retrieves a copy of the security descriptor protecting the specified open registry key.

RegGetValue()

Retrieves the type and data for the specified registry value.

RegLoadKey()

Creates a subkey under HKEY_USERS or HKEY_LOCAL_MACHINE and stores registration information from a specified file into that subkey.

RegLoadMUIString()

Loads the specified string from the specified key and subkey.

RegNotifyChangeKeyValue()

Notifies the caller about changes to the attributes or contents of a specified registry key.

RegOpenCurrentUser()

Retrieves a handle to the HKEY_CURRENT_USER key for the user the current thread is impersonating.

RegOpenKeyEx()

Opens the specified registry key.

RegOpenKeyTransacted()

Opens the specified registry key and associates it with a transaction.

RegOpenUserClassesRoot()

Retrieves a handle to the HKEY_CLASSES_ROOT key for the specified user.

RegOverridePredefKey()

Maps a predefined registry key to a specified registry key.

RegQueryInfoKey()

Retrieves information about the specified registry key.

RegQueryMultipleValues()

Retrieves the type and data for a list of value names associated with an open registry key.

RegQueryReflectionKey()

Determines whether reflection has been disabled or enabled for the specified key.

RegQueryValueEx()

Retrieves the type and data for a specified value name associated with an open registry key.

RegReplaceKey()

Replaces the file backing a registry key and all its subkeys with another file.

RegRestoreKey()

Reads the registry information in a specified file and copies it over the specified key.

RegSaveKey()

Saves the specified key and all of its subkeys and values to a new file.

RegSaveKeyEx()

Saves the specified key and all of its subkeys and values to a new file. You can specify the format for the saved key or hive.

RegSetKeyValue()

Sets the data for the specified value in the specified registry key and subkey.

RegSetKeySecurity()

Sets the security of an open registry key.

RegSetValueEx()

Sets the data and type of a specified value under a registry key.

RegUnLoadKey()

Unloads the specified registry key and its subkeys from the registry.

 

The following shell functions can be used with the registry:

 

  1. AssocCreate()
  2. AssocQueryKey()
  3. AssocQueryString()
  4. AssocQueryStringByKey()
  5. SHCopyKey()
  6. SHDeleteEmptyKey()
  7. SHDeleteKey()
  8. SHDeleteValue()
  9. SHEnumKeyEx()
  10. SHEnumValue()
  11. SHGetValue()
  12. SHQueryInfoKey()
  13. SHQueryValueEx()
  14. SHRegCloseUSKey()
  15. SHRegCreateUSKey()
  16. SHRegDeleteEmptyUSKey()
  17. SHRegDeleteUSValue()
  18. SHRegDuplicateHKey()
  19. SHRegEnumUSKey()
  20. SHRegEnumUSValue()
  21. SHRegGetBoolUSValue()
  22. SHRegGetIntW()
  23. SHRegGetPath()
  24. SHRegGetUSValue()
  25. SHRegOpenUSKey()
  26. SHRegQueryInfoUSKey()
  27. SHRegQueryUSValue()
  28. SHRegSetPath()
  29. SHRegSetUSValue()
  30. SHRegWriteUSValue()
  31. SHSetValue()

 

The following are the initialization-file functions. They retrieve information from and copy information to a system- or application-defined initialization file. These functions are provided only for compatibility with 16-bit versions of Windows. New applications should use the registry.

 

Function

Description

GetPrivateProfileInt()

Retrieves an integer associated with a key in the specified section of an initialization file.

GetPrivateProfileSection()

Retrieves all the keys and values for the specified section of an initialization file.

GetPrivateProfileSectionNames()

Retrieves the names of all sections in an initialization file.

GetPrivateProfileString()

Retrieves a string from the specified section in an initialization file.

GetPrivateProfileStruct()

Retrieves the data associated with a key in the specified section of an initialization file.

GetProfileInt()

Retrieves an integer from a key in the specified section of the Win.ini file.

GetProfileSection()

Retrieves all the keys and values for the specified section of the Win.ini file.

GetProfileString()

Retrieves the string associated with a key in the specified section of the Win.ini file.

WritePrivateProfileSection()

Replaces the keys and values for the specified section in an initialization file.

WritePrivateProfileString()

Copies a string into the specified section of an initialization file.

WritePrivateProfileStruct()

Copies data into a key in the specified section of an initialization file.

WriteProfileSection()

Replaces the contents of the specified section in the Win.ini file with specified keys and values.

WriteProfileString()

Copies a string into the specified section of the Win.ini file.

 

Obsolete Functions

 

The following functions are provided only for compatibility with 16-bit versions of Windows:

 

  1. RegCreateKey()
  2. RegEnumKey()
  3. RegOpenKey()
  4. RegQueryValue()
  5. RegSetValue()

 

Registry Structures

 

The following structure is used with the registry: VALENT. This structure contains information about a registry value. The RegQueryMultipleValues() function uses this structure. The syntax is:

 

typedef struct value_ent {

  LPTSTR    ve_valuename;

  DWORD     ve_valuelen;

  DWORD_PTR ve_valueptr;

  DWORD     ve_type;

}VALENT, *PVALENT;

 

The members are:

 

Member name

Description

ve_valuename

The name of the value to be retrieved. Be sure to set this member before calling RegQueryMultipleValues().

ve_valuelen

The size of the data pointed to by ve_valueptr, in bytes.

ve_valueptr

A pointer to the data for the value entry. This is a pointer to the value's data returned in the lpValueBuf buffer filled in by RegQueryMultipleValues().

ve_type

The type of data pointed to by ve_valueptr.

 

 

 

 

< Windows Registry 12 | Windows Registry Index | Win32 Programming | Windows Processes & Threads Programming >