Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SHCopyKey

SHCopyKey function

Recursively copies the subkeys and values of the source subkey to the destination key. SHCopyKey does not copy the security attributes of the keys.

Syntax


LSTATUS SHCopyKey(
  _In_       HKEY    hkeySrc,
  _In_opt_   LPCTSTR pszSrcSubKey,
  _In_       HKEY    hkeyDest,
  _Reserved_ DWORD   fReserved
);

Parameters

hkeySrc [in]

Type: HKEY

A handle to the source key (for example, HKEY_CURRENT_USER).

pszSrcSubKey [in, optional]

Type: LPCTSTR

The subkey whose subkeys and values are to be copied.

hkeyDest [in]

Type: HKEY

The destination key.

fReserved

Type: DWORD

Reserved. Must be 0.

Return value

Type: LSTATUS

Returns ERROR_SUCCESS if successful, or one of the nonzero error codes defined in Winerror.h otherwise. Use FormatMessage with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.

Remarks

Important  This function does not duplicate the security attributes of the keys and values that it copies. Rather, all security attributes in the destination key are the default attributes.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 5.0 or later)

Unicode and ANSI names

SHCopyKeyW (Unicode) and SHCopyKeyA (ANSI)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft