次の方法で共有


IMSAdminBase::AddKey

The IMSAdminBase::AddKey method creates a key and adds it to the metabase as a subkey of an existing key at the specified path.

HRESULT AddKey(
      METADATA_HANDLE hMDHandle,
      LPCWSTR pszMDPath
);

Parameters

  • hMDHandle
    Specifies a handle with write permissions as returned by the IMSAdminBase::OpenKey method. The value METADATA_MASTER_ROOT_HANDLE is not valid for this operation.

  • pszMDPath
    Points to a string that contains the new key's path, 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 /LM/W3SVC.

    This parameter cannot be null.

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.

HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)

A key of that name already exists in the metabase.

HRESULT_FROM_WIN32(ERROR_INVALID_NAME)

The specified name is invalid.

E_INVALIDARG

The parameter is incorrect.

HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY)

Not enough storage is available to process this command.

HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)

The specified path is not found in the metabase.

S_OK

The method succeeded.

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.