IMSAdminBase::GetData

The IMSAdminBase::GetData method retrieves an entry from the metabase.

HRESULT GetData(
  METADATA_HANDLE hMDHandle,    //metabase handle
  LPCWSTR pszMDPath,            //path to the key, relative to 
                                // hMDHandle
  PMETADATA_RECORD pmdrMDData,  //pointer to a structure that 
                                // receives the data
  DWORD *pdwMDRequiredDataLen   //pointer to a DWORD that receives 
                                // the required data length in the case 
                                // of an overflow
);
 

Parameters

hMDHandle
Specifies a handle to the metabase. This can be either METADATA_MASTER_ROOT_HANDLE or a handle returned by the IMSAdminBase::OpenKey method with read permission.
pszMDPath
Specifies the path of the key that contains the data. This path is relative to the path of hMDHandle. For example, if the handle references the /LM key, you could specify the Web services subkey using the path /W3SVC.
pmdrMDData
Points to a METADATA_RECORD structure that specifies the data to retrieve and receives the retrieved data.
pdwMDRequiredDataLen
Receives the data length of the required buffer size if the buffer size specified by pmdrMDData->dwMDDataLen is not large enough to hold the data returned (ERROR_INSUFFICIENT_BUFFER is returned).

Return Values

Returns an HRESULT that contains one of the following values:

ERROR_ACCESS_DENIED Access is denied. Either the open handle does not have read or write permission as needed, or the user does not have sufficient permissions to perform the operation.
ERROR_INSUFFICIENT_BUFFER The buffer passed to the method call is too small to receive the data.
ERROR_INVALID_PARAMETER The parameter is incorrect.
ERROR_PATH_NOT_FOUND The specified path is not found in the metabase.
ERROR_SUCCESS The method succeeded.
MD_ERROR_DATA_NOT_FOUND The specified data is not found in the metabase.

Remarks

The handle, METADATA_MASTER_ROOT_HANDLE, provides no guarantee against multiple thread access. If your application requires a constant data state, use a handle returned by IMSAdminBase::OpenKey.