3.1.4.17 GetDataPaths (Opnum 16)

The GetDataPaths method returns the paths of all nodes in the subtree relative to a specified starting node that contains the supplied identifier.

 HRESULT GetDataPaths(
   [in] METADATA_HANDLE hMDHandle,
   [unique, in, string] LPCWSTR pszMDPath,
   [in] DWORD dwMDIdentifier,
   [in] DWORD dwMDDataType,
   [in] DWORD dwMDBufferSize,
   [out, size_is(dwMDBufferSize)] WCHAR* pszBuffer,
   [out] DWORD* pdwMDRequiredBufferSize
 );

hMDHandle: An unsigned 32-bit integer value containing an open metabase handle specifying the key to be queried.

pszMDPath: A pointer to a Unicode string that contains the path of the node to be queried, relative to the hMDHandle parameter.

dwMDIdentifier: An integer value identifying the data to be queried.

dwMDDataType: An integer value specifying a data type. If this parameter is not set to ALL_METADATA, the data item will be returned 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.

dwMDBufferSize: An integer value specifying the size, in WCHARs, of the pszBuffer parameter.

pszBuffer: A pointer to a buffer that contains the retrieved data. If the method call is successful, the buffer will contain a contiguous sequence of null-terminated strings in "multi-string" format. Each string in the sequence is a metabase path at which data matching the dwMDIdentifier and dwMDDataType fields were found.

pdwMDRequiredBufferSize: A pointer to an integer value that contains the buffer length required, in WCHARs.

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.

0x80070006

ERROR_INVALID_HANDLE

The handle is invalid.

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0x8007007A

ERROR_INSUFFICIENT_BUFFER

The data area passed to a system call is too small.

The opnum field value for this method is 16.

When processing this call, the server MUST do the following:

  • Check the handle. 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.

  • Check that the relative path points to a valid node. Otherwise, return ERROR_PATH_NOT_FOUND.

  • On the destination node, find data based on the data ID and the data type. If the data type is set to anything but ALL_METADATA, check that the found data type is the same as the requested parameter, dwMDDataType. If the data type matches or the requested data type is ALL_METADATA, copy the path of the node relative to hMDHandle to the buffer pszBuffer.

  • For all nodes below the destination node, repeat the same procedure. Find the data by data ID and data type. If the data is available, check its inheritance flag. If the data is inherited, skip to the next node. If the data is not inherited, append the node path to the buffer. Each new path is appended to the buffer in "multi-string" format: Each string is separated by the null character, and an extra null character is added at the end of buffer after the last string.

  • If the size of the buffer as specified by the dwMDBufferSize parameter is insufficient to hold all the path data, set the pdwMDRequiredBufferSize parameter to the required buffer size and return ERROR_INSUFFICIENT_BUFFER.