Compartilhar via


IMSAdminBase::EnumKeys

The IMSAdminBase::EnumKeys method enumerates the subkeys of the specified key. A subkey can be enumerated once per call. Subkeys are numbered from 0 to (NumKeys - 1), with NumKeys equal to the number of subkeys below the key.

If dwMDEnumKeyIndex is greater than or equal to the number of subkeys, HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS) is returned.

HRESULT EnumKeys(
      METADATA_HANDLE hMDHandle,
      LPCWSTR pszMDPath,
      LPWSTR pszMDName,
      DWORD dwMDEnumKeyIndex
);

Parameters

  • hMDHandle
    Specifies a handle to a metabase key. This can be either METADATA_MASTER_ROOT_HANDLE, or a handle with read permissions returned by the IMSAdminBase::OpenKey method.

  • pszMDPath
    Points to a string that contains the path of the key 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. In this case the subkeys of /LM/W3SVC would be enumerated.

  • pszMDName
    Points to a string buffer that receives the names of the metabase subkeys enumerated. This buffer must be at least METADATA_MAX_NAME_LEN characters long.

  • dwMDEnumKeyIndex
    Specifies the index of the subkey to be retrieved. Set this to 0 before the first call and increment it by 1 on each successive call until HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS) is returned.

Return Values

Returns an HRESULT that contains one of the following values:

Value

Description

E_ACCESSDENIED

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.

E_INVALIDARG

The parameter is incorrect.

HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)

There are no more subkeys to enumerate.

HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)

The specified path was not found in the metabase.

S_OK

The method succeeded.

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.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in iadmw.h; include iiscnfg.h.