CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code
Under certain circumstances, the cluster sends the CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code to a resource DLL immediately before calling the Offline or Terminate entry-point function, providing the DLL with the reason for the state change. Because the control code is internal, applications cannot use it in a control code function.
This control code has no parameters.
This control code does not return a value.
ClusAPI.h defines the 32 bits of CLUSCTL_RESOURCE_STATE_CHANGE_REASON (0x0150004e) as follows.
For more information, see Control Code Architecture.
Resource DLL Support
Optional. By default, resource DLLs do not receive the CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code under any circumstances. To receive the control code, a resource DLL must report the following characteristic: CLUS_CHAR_REQUIRES_STATE_CHANGE_REASON.
For information on how to report characteristics for your resource DLL see CLUSCTL_RESOURCE_GET_CHARACTERISTICS.
The CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code gives resource DLLs the option of implementing different shutdown procedures in response to different shutdown conditions. For example, a resource DLL may implement a graceful, clean shutdown under most circumstances, but if the Cluster service stops unexpectedly, the DLL may implement a fast and dirty brute-force shutdown to facilitate faster failover.
To support CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code in your resource DLL, perform the following steps:
Initialize a CLUSCTL_RESOURCE_STATE_CHANGE_REASON_STRUCT structure for each resource managed by the resource DLL. Typically this structure is included in the resource DLL's resource structure.
In your implementation of ResourceControl:
- Handle the CLUSCTL_RESOURCE_GET_CHARACTERISTICS control code and return a value that includes CLUS_CHAR_REQUIRES_STATE_CHANGE_REASON.
- Handle the CLUSCTL_RESOURCE_STATE_CHANGE_REASON control code and store the reason code passed in the lpInBuffer parameter in the eReason member of the resource structure.
When implementing Offline and Terminate, read the eReason member of the resource structure and, if this member is not eResourceStateChangeReasonUnknown (from the CLUSTER_RESOURCE_STATE_CHANGE_REASON enumeration), perform any necessary operations. Before returning from Offline or Terminate, reset the eReason member of the resource structure to eResourceStateChangeReasonUnknown.
|Minimum supported client
|Minimum supported server
||Windows Server 2008 Enterprise, Windows Server 2008 Datacenter