Enumerating Cluster Objects
One of the most common tasks of cluster-aware and cluster management applications is to enumerate objects in the cluster. Applications can enumerate specific types of objects such as resources, or choose to limit their enumeration to objects that affect a particular group or resource.
To find the cluster Network Name resource
-
Create a resource enumerator by calling ClusterOpenEnum and specifying CLUSTER_ENUM_RESOURCE for the dwType parameter.
-
Loop through all of the resources in the cluster by calling ClusterEnum repeatedly with the contents of the lpdwType parameter set to CLUSTER_ENUM_RESOURCE. For each resource:
-
Call OpenClusterResource, setting the lpszResourceName parameter to the contents of the lpszName parameter returned from ClusterEnum.
-
Call ClusterResourceControl with the dwControlCode parameter set to CLUSCTL_RESOURCE_GET_FLAGS.
-
If the CLUS_FLAG_CORE flag is set, indicating that the resource is a core cluster resource, call ClusterResourceControl with the dwControlCode parameter set to CLUSCTL_RESOURCE_GET_RESOURCE_TYPE.
-
The resource type will be set to "Network Name" for the cluster Network Name resource. There will only be one core resource in the cluster with the "Network Name" resource type.