3.1.4.23 R_GetData (Opnum 10)

The R_GetData method returns a data entry from a particular node in the metabase.

 HRESULT R_GetData(
   [in] METADATA_HANDLE hMDHandle,
   [unique, in, string] LPCWSTR pszMDPath,
   [in, out] METADATA_RECORD* pmdrMDData,
   [out] DWORD* pdwMDRequiredDataLen,
   [out] IIS_CRYPTO_BLOB** ppDataBlob
 );

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 containing the data, relative to the path of the hMDHandle parameter.

pmdrMDData: A pointer to a METADATA_RECORD structure that describes the requested data.

pdwMDRequiredDataLen: A pointer to an integer value that contains the buffer length required, in bytes, to contain the decrypted data referenced by the ppDataBlob parameter.

ppDataBlob: An IIS_CRYPTO_BLOB structure containing the requested data value as encrypted opaque data.

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.

0x80070057

E_INVALIDARG

An invalid parameter value was specified.

0x8007007A

ERROR_INSUFFICIENT_BUFFER

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

0x800CC801

MD_ERROR_DATA_NOT_FOUND

The specified metadata was not found.

The opnum field value for this method is 10.

The client describes the data it is requesting by initializing the METADATA_RECORD passed in the pmdrMDData parameter.

The client indicates how much decrypted data it is ready to receive by passing the number of bytes in the dwMDDataLen field of the pmdrMDData parameter.

The pbMDData field of the pmdrMDData parameter is not used to transfer the actual data value. The client MUST set the pbMDData field of pmdrMDData to NULL. The IIS_CRYPTO_BLOB structure is used to transfer the actual data value returned by the server and can be encrypted when the server sends data marked as secure.

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

  • Check the path of the node indicated by hMDHandle and pszMDPath. If the path does not exist, return ERROR_PATH_NOT_FOUND.

  • If a data value matching the one described by the pmdrMDData parameter is not found at the node indicated by hMDHandle and pszMDPath, return MD_ERROR_DATA_NOT_FOUND.

  • If value passed by the client in the dwMDDataLen field of the pmdrMDData parameter is less than the size of the unencrypted data value, set the value of pdwMDRequiredDataLen to the size of the unencrypted data value and return ERROR_INSUFFICIENT_BUFFER.

The following set of steps MUST be performed by the server to encrypt or encode a data value and build an IIS_CRYPTO_BLOB structure to be sent by the server.

  1. Check whether the dwMDAttributes member of the METADATA_RECORD structure has the METADATA_SECURE secure flag set.

  2. If the METADATA_SECURE secure flag is set:

    • Encrypt the data value based on the procedure described in section 3.1.4.1.2. The encrypted data BLOB will be stored in the IIS_CRYPTO_BLOB message format with the BlobSignature field set to the ENCRYPTED_DATA_BLOB_SIGNATURE signature.

  3. If the METADATA_SECURE secure flag is not set:

    • Build the IIS_CRYPTO_BLOB message with the BlobSignature field set to CLEARTEXT_DATA_BLOB_SIGNATURE. Store the cleartext data in the BlobData field. Set the BlobDataLength field to match the length of the BlobData field.