IGetClusterResourceInfo 接口 (cluadmex.h)
[此接口可用于“要求”部分中指定的操作系统。 Windows Server 2008 中删除了对此接口的支持。]
故障转移群集管理员扩展调用 IGetClusterResourceInfo 接口以检索有关资源的信息。
继承
IGetClusterResourceInfo 接口继承自 IUnknown 接口。 IGetClusterResourceInfo 也有以下类型的成员:
方法
IGetClusterResourceInfo 接口具有这些方法。
IGetClusterResourceInfo::GetResourceHandle 返回资源的句柄。 |
IGetClusterResourceInfo::GetResourceNetworkName 返回由资源所依赖的网络名称资源管理的网络的名称。 |
IGetClusterResourceInfo::GetResourceTypeName 返回资源的类型。 |
注解
如果扩展的对象不是资源,则对 IGetClusterResourceInfo 方法的查询将失败。 否则,当故障转移群集管理员调用以下方法的实现时,可以使用 IGetClusterResourceInfo 接口:
- IWEExtendPropertySheet::CreatePropertySheetPages
- IWEExtendContextMenu::AddContextMenuItems
- IWEExtendWizard::CreateWizardPages
- IWEExtendWizard97::CreateWizard97Pages
- IWEInvokeCommand::InvokeCommand
仅在资源扩展的上下文中使用 IGetClusterResourceInfo 接口。 不要从 IGetClusterResourceInfo 接口获取其他信息接口,例如 IGetClusterGroupInfo 。 虽然 QueryInterface 将返回有效的接口,但操作在 群集上下文中无效,结果是表示没有实际群集对象的接口。
示例
在以下代码中,C 样式注释所括的部分将按上一段落失败。
//
// Context is a resource extension.
//
HRESULT CExtObject::HrGetResourceInfo( IGetClusterResourceInfo *piResInfo )
{
HRESULT hr;
HRESOURCE hRes;
HGROUP hGroup;
HCLUSTER hCluster;
DWORD cchNameSize = MAX_NAME_SIZE; // 256
WCHAR szGroupName[cchNameSize];
IGetClusterGroupInfo *pGrpInfo;
hRes = piResInfo->GetResourceHandle();
//
// Get group handle
//
/*******************************************************************
// Incorrect:
//
// Obtain an IGetClusterGroupInfo interface from
// IGetClusterResourceInfo. By the rules of QueryInterface, this
// must return a valid interface. But it is not a valid cluster
// operation so the interface won't represent a real object.
//
hr = pResInfo->QueryInterface( IID_IGetClusterGroupInfo,
(LPVOID *) &pGrpInfo );
//
// Interface is valid, will pass this test.
//
if( FAILED( hr ) )
goto Error;
//
// FAILS!
// Interface does not represent a real cluster object.
//
hGrp = pGrpInfo->GetGroupHandle( 0 );
*******************************************************************/
// Correct:
//
// Use the valid resource handle to call GetClusterResourceState.
// This yields the name of the group to which it belongs, which
// can be used to obtain a group handle.
//
dwState = GetClusterResourceState( hRes,
NULL,
0,
szGroupName,
&cchGroupNameSize );
// Add error check.
hCluster = OpenCluster( g_szClusterName );
// Add error check.
hGrp = OpenClusterGroup( hCluster, szGroupName );
// After error check, use group handle...
}
要求
要求 | 值 |
---|---|
最低受支持的客户端 | 无受支持的版本 |
最低受支持的服务器 | Windows Server 2003 企业版、Windows Server 2003 Datacenter |
目标平台 | Windows |
标头 | cluadmex.h |
另请参阅
IWEExtendContextMenu::AddContextMenuItems
IWEExtendPropertySheet::CreatePropertySheetPages
IWEExtendWizard97::CreateWizard97Pages