The Open entry point function opens a resource.
RESID WINAPI Open(
LPCWSTR ResourceName,
HKEY ResourceKey,
RESOURCE_HANDLE ResourceHandle
);
If the operation was successful, Open returns a resource identifier (RESID).
If the operation was unsuccessful, Open returns NULL.
The Open entry point opens a resource with the name identified by the ResourceName parameter and returns its resource identifier. The resource identifier can be used in future calls to other Resource API entry points to identify the resource.
Make your implementation of Open complete as quickly as possible, preferably in under 300 milliseconds. However, if you require a longer processing time, this situation is handled properly by the Cluster Service.
Never close the handle represented by the ResourceHandle parameter or use it for any purpose other than passing it to the Resource Monitor through either the LogEvent or SetResourceStatus callback functions.
Open should allocate all of the structures necessary to bring the new resource online and retrieve its private properties. To retrieve the private properties of a resource, call ClusterResourceControl twice, passing CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES in the dwControlCode parameter for the first call and CLUSCTL_RESOURCE_GET_RO_PRIVATE_PROPERTIES for the second call. Resource DLLs should also retrieve their private properties in their Online function, a function that can be called repeatedly for a resource.
To make sure that the resource is in the offline state when Open returns, read the resource's PersistentState property. This is important if a resource cannot be online on more than one node simultaneously, such as when two nodes cannot simultaneously use the same IP address. If there is no chance that the resource could be online prior to the start of the Cluster Service, then taking the resource offline in your implementation of Open is not necessary.
Whenever possible, do not handle node-specific properties. If you must maintain node-specific properties, record them in the cluster database under a local machine key based on the node identifier. You can retrieve the node identifier by calling GetClusterNodeId.
For example, your resource DLL for managing a disk resource may need to maintain different drive names for each node if the nodes maintain different numbers of disks. That is, the physical drive may assume one name on one node and a different name on another node. Handle this situation by having cluster database keys for each of the node's computer names, and parse for additional parameters under the node-specific cluster database keys which are based on the node identifier.
Call the Win32 function SetLastError just before returning.
In Cluster Server's File Share resource DLL, Open allocates a resource structure to contain the ShareName and Path properties. Open queries the cluster database using the functions in the Cluster API to find these properties and then saves them in the resource structure, saving the address of the resource structure in a global resource table. Open returns the index as the resource identifier.
Version: Use Windows NT Server Enterprise Edition 4.0.
Windows CE: Unsupported.
Header: Declared in resapi.h.