3.1.4.10 CopyData (Opnum 15)

The CopyData method copies or moves data between nodes.

 HRESULT CopyData(
   [in] METADATA_HANDLE hMDSourceHandle,
   [unique, in, string] LPCWSTR pszMDSourcePath,
   [in] METADATA_HANDLE hMDDestHandle,
   [unique, in, string] LPCWSTR pszMDDestPath,
   [in] DWORD dwMDAttributes,
   [in] DWORD dwMDUserType,
   [in] DWORD dwMDDataType,
   [in] BOOL bMDCopyFlag
 );

hMDSourceHandle: An unsigned 32-bit integer value containing an open metabase handle specifying the source node from which the data is to be copied or moved.

pszMDSourcePath: A pointer to a Unicode string that contains the path of the node with which the source data is associated, relative to the path of the hMDSourceHandle parameter.

hMDDestHandle: An unsigned 32-bit integer value containing an open metabase handle specifying the destination node to which the data is to be copied or moved.

pszMDDestPath: A pointer to a Unicode string that contains the path of the node for data to be copied to or moved to, relative to the path of the hMDDestHandle parameter.

dwMDAttributes: Flags used to filter the data, as specified in the METADATA_RECORD structure.

dwMDUserType: An integer value specifying the data to copy based on the user type.

Value

Meaning

ALL_METADATA

0x00000000

Specifies all data, regardless of user type.

ASP_MD_UT_APP

0x00000065

Specifies data specific to ASP application configuration.

IIS_MD_UT_FILE

0x00000002

Specifies data specific to a file, such as access permissions or logon methods.

IIS_MD_UT_SERVER

0x00000001

Specifies data specific to the server, such as ports in use and IP addresses.

IIS_MD_UT_WAM

0x00000064

Specifies data specific to WAM.

dwMDDataType: An integer value specifying a data type. If this parameter is not set to ALL_METADATA, the data item will be copied only if its data type matches the specified type.

Value

Meaning

ALL_METADATA

0x00000000

Specifies all data, regardless of type.

BINARY_METADATA

0x00000003

Specifies binary data in any form.

DWORD_METADATA

0x00000001

Specifies all DWORD (unsigned 32-bit integer) data.

EXPANDSZ_METADATA

0x00000004

Specifies all data consisting of a string that includes the terminating null character, which contains unexpanded environment variables.

MULTISZ_METADATA

0x00000005

Specifies all data represented as an array of strings, where each string contains two occurrences of the terminating null character.

STRING_METADATA

0x00000002

Specifies all data consisting of an ASCII string that includes the terminating null character.

bMDCopyFlag: A Boolean value that specifies whether to copy or move the data. If this parameter is set to TRUE, the data is copied. If it is FALSE, the data is moved.

Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it failed. If the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a Win32 error code in the lower 16 bits. Zero or positive values indicate success, with the lower 16 bits in positive nonzero values containing warnings or flags defined in the method implementation. For more information about Win32 error codes and HRESULT values, see [MS-ERREF].

Return value/code

Description

0x00000000

S_OK

The call was successful.

0x80070003

ERROR_PATH_NOT_FOUND

The system cannot find the path specified.

0x80070005

E_ACCESSDENIED

General access denied error.

0x80070006

ERROR_INVALID_HANDLE

The handle is invalid.

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0x80070008

ERROR_NOT_ENOUGH_MEMORY

There is not enough memory to complete the operation.

The opnum field value for this method is 15.

When processing this call, the server:

  • MUST check the hMDSourceHandle parameter. This handle is valid if it is either the master root handle or a handle returned from a previous OpenKey call. If the handle is invalid, return ERROR_INVALID_HANDLE error.

  • MUST check the hMDDestHandle parameter. This handle is valid if it is either the master root handle or a handle returned from a previous OpenKey call. If the handle is invalid, return ERROR_INVALID_HANDLE error.

  • MUST check whether the destination handle was opened for write access. If not, return E_ACCESSDENIED.

  • MUST check whether the source relative path points to the existing node. If not, return ERROR_PATH_NOT_FOUND.

  • SHOULD check whether the destination relative path points to an existing node. If not, return an error.<11>

  • MUST, if the dwMDUserType and the dwMDDataType parameters are not equal to "ALL_METADATA", use these parameters as the data selection filter.

  • MUST, if the dwMDAttributes parameter is defined, use this parameter to get the data.

  • MUST copy the selected data from the source node to the destination node.

  • MUST, if the bMDCopyFlag parameter is set to false, remove the selected data from the source.