IMSAdminBase::GetAllData

The IMSAdminBase::GetAllData method retrieves all data associated with a key in the metabase. This includes all values that the key inherits.

HRESULT GetAllData(
  METADATA_HANDLE hMDHandle,      //metabase handle 
  LPCWSTR pszMDPath,              //path to the key, relative to 
                                  // hMDHandle
  DWORD dwMDAttributes,           //attributes of the data to retrieve
  DWORD dwMDUserType,             //user type of the data to retrieve
  DWORD dwMDDataType,             //data type of the data to retrieve
  DWORD *pdwMDNumDataEntries,     //receives the number of entries 
                                  // copied to pbMDBuffer
  DWORD *pdwMDDataSetNumber,      //receives the data set number
  DWORD dwMDBufferSize,           //the size, in bytes, of pbMDBuffer
  Unsigned char *pbMDBuffer,      //the buffer that receives the data
  DWORD *pdwMDRequiredBufferSize  //if the method fails, receives 
                                  // the required buffer size
);
 

Parameters

hMDHandle
Specifies a handle to the metabase. This can be either METADATA_MASTER_ROOT_HANDLE or a handle, with read permission, returned by the IMSAdminBase::OpenKey method.
pszMDPath
Specifies the path of the key with which the data to be retrieved is associated, 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.
dwMDAttributes
The flags, contained in the METADATA_RECORD structure, used to get the data.
dwMDUserType
Specifies the user type of the data. If not set to ALL_METADATA, only data of the specified user type will be returned.

The following user types are defined for IIS:
User type Description
ALL_METADATA Return all data, regardless of user type.
ASP_MD_UT_APP The entry contains information specific to ASP application configuration.
IIS_MD_UT_FILE Return only data specific to a file, such as access permissions or log on methods.
IIS_MD_UT_SERVER Return only data specific to the server, such as ports in use and IP addresses.
IIS_MD_UT_WAM The entry contains information specific to Web application management.

dwMDDataType
Specifies the type of data to retrieve. If dwMDDataType is not set to ALL_METADATA, only metadata of the specified type will be returned. This parameter can be one of the following values:
Data type Description
ALL_METADATA Retrieve all data, regardless of type.
BINARY_METADATA Binary data in any form.
DWORD_METADATA An unsigned 32-bit number.
EXPANDSZ_METADATA A null-terminated string that contains unexpanded environment variables, such as %PATH%.
MULTISZ_METADATA An array of null-terminated strings, terminated by two null characters.
STRING_METADATA A null-terminated ASCII string.

pdwMDNumDataEntries
Points to a DWORD that receives the number of entries copied to pbBuffer.
pdwMDDataSetNumber
Points to a number associated with this data set.
dwMDBufferSize
Specifies the size, in bytes, of pbMDBuffer.
pbMDBuffer
Points to a buffer that receives the data. If the method call is successful, the buffer will contain an array of METADATA_GETALL_RECORD structures.
pdwMDRequiredBufferSize
Points to a DWORD that contains the buffer length required, in bytes.

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 into the method call is too small to receive the data.
ERROR_INVALID_PARAMETER The parameter is incorrect.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_SUCCESS The method succeeded.

Remarks

On non-Intel platforms the DWORD data is aligned; this may not be true on remote clients.

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.