The RegRestoreKey function reads the registry information in a specified file and copies it over the specified key. This registry information may be in the form of a key and multiple levels of subkeys.
LONG RegRestoreKey(
HKEY hKey, |
// handle of key where restore begins |
LPCTSTR lpFile, |
// address of filename containing saved tree |
DWORD dwFlags |
// optional flags |
); |
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Any information contained in this key and its descendent keys is overwritten
by the information in the file pointed to by the lpFile parameter.
This parameter can be the REG_WHOLE_HIVE_VOLATILE flag set. Instead of restoring the given key, this flag causes a new, volatile (memory only) set of registry information to be created. (A hive is a large set of registry information, typically containing all of the pertinent information for part of the system. For example, HKEY_LOCAL_MACHINE\Hardware is a volatile hive.)
If REG_WHOLE_HIVE_VOLATILE is specified, the key identified by the hKey parameter must be either the HKEY_USERS or HKEY_LOCAL_MACHINE value.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
If any subkeys of the hKey parameter are open, RegRestoreKey fails. The function also fails if the calling process does not have the SE_RESTORE_NAME privilege. For more information about privileges, see Privileges.
This function replaces the keys and values below the specified key with the keys and values that are subsidiary to the top-level key in the file, no matter what the name of the top-level key in the file might be. For example, hKey might identify a key A with subkeys B and C, while the lpFile parameter specifies a file containing key X with subkeys Y and Z. After a call to RegRestoreKey, the registry would contain key A with subkeys Y and Z. The value entries of A would be replaced by the value entries of X.
The new information in the file specified by lpFile overwrites the contents of the key specified by the hKey parameter, except for the key name.
If hKey represents a key in a remote computer, the path described by lpFile is relative to the remote computer.
RegDeleteKey, RegLoadKey, RegReplaceKey, RegSaveKey
file: /Techref/os/win/api/win32/func/src/f73_10.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/13 23:45,
18.223.196.123:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/os/win/api/win32/func/src/f73_10.htm"> RegRestoreKey</A> |
Did you find what you needed? |