Partager via


Resource Structures

A resource structure is a user-defined structure for storing instance data. A resource structure resides in a Resource DLL. The following code illustrates a resource structure for use with 32-bit operating systems.

typedef struct _MYTYPE_RESOURCE
{
  RESID                  resid;
  MYTYPE_PROPS           propsActive;
  MYTYPE_PROPS           props;
  HCLUSTER               hCluster;
  HRESOURCE              hResource;
  SC_HANDLE              hService;
  DWORD                  dwServicePid;
  HKEY                   hkeyParameters;
  RESOURCE_HANDLE        hResourceHandle;
  LPWSTR                 pszResourceName;
  CLUS_WORKER            cwWorkerThread;
  CLUSTER_RESOURCE_STATE state;
} 
MYTYPE_RESOURCE, *PMYTYPE_RESOURCE;

resid

Stores the resource identifier (RESID) of the resource instance. The RESID is the address of the structure that is allocated for a resource instance.

propsActive

A parameter block that stores the most current in-memory values of the instance's private properties. If a resource is online, changes to its private properties are stored here until the resource can be taken offline and brought back online.

props

A parameter block that stores the most current cluster database values of the instance's private properties. These are the values under which the instance is currently operating.

hCluster

Stores a cluster handle.

hResource

Stores a resource handle.

hService

Handle to the service controlled by the resource.

dwServicePid

Stores the service process identifier of the service controlled by the resource.

hkeyParameters

Stores the name of the cluster database key under which the resource's private properties are stored.

hResourceHandle

Stores the Resource Monitor's handle to the instance, which is used to identify the instance in the LogEvent and SetResourceStatus callback functions.

pszResourceName

Stores the name of the resource.

cwWorkerThread

A CLUS_WORKER thread used to handle pending operations.

state

Stores the state of the resource. The value of this member is taken from the CLUSTER_RESOURCE_STATE enumeration. The possible values are as follows.

Value Meaning
ClusterResourceStateUnknown
The operation was not successful. For more information about the error, call the function GetLastError.
ClusterResourceInherited
The resource has been inherited.
ClusterResourceInitializing
The resource is performing initialization.
ClusterResourceOnline
The resource is operational and functioning normally.
ClusterResourceOffline
The resource is not operational.
ClusterResourceFailed
The resource has failed.
ClusterResourcePending
The resource is in the process of coming online or going offline.
ClusterResourceOnlinePending
The resource is in the process of coming online.
ClusterResourceOfflinePending
The resource is in the process of going offline.

For more information on instance management, see Implementing Instance Management.

Managing Instances

CLUSTER_RESOURCE_STATE