RegCopyTreeA function (winreg.h)
Copies the specified registry key, along with its values and subkeys, to the specified destination key.
LSTATUS RegCopyTreeA( [in] HKEY hKeySrc, [in, optional] LPCSTR lpSubKey, [in] HKEY hKeyDest );
A handle to an open registry key. The key must have been opened with the KEY_READ access right. For more information, see Registry Key Security and Access Rights.
[in, optional] lpSubKey
The name of the key. This key must be a subkey of the key identified by the hKeySrc parameter. This parameter can also be NULL.
A handle to the destination key. The calling process must have KEY_CREATE_SUB_KEY access to the key.
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.
This function also copies the security descriptor for the key.
To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.
The winreg.h header defines RegCopyTree as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|
|Header||winreg.h (include Windows.h)|