ResUtilGetResourceDependency function (resapi.h)
Enumerates the dependencies of a specified resource and returns a handle to a dependency of a specified type. The PRESUTIL_GET_RESOURCE_DEPENDENCY type defines a pointer to this function.
Syntax
HRESOURCE ResUtilGetResourceDependency(
[in] HANDLE hSelf,
[in] LPCWSTR lpszResourceType
);
Parameters
[in] hSelf
Handle to the dependent resource. This resource depends on one or more resources.
[in] lpszResourceType
Null-terminated Unicode string specifying the resource type of the dependency to return.
Return value
If the operation succeeds, the function returns a handle to one of the resources on which the resource specified by hSelf depends. The caller is responsible for closing the handle by calling CloseClusterResource.
If the operation fails, the function returns NULL. For more information, call the GetLastError function.
Remarks
The ResUtilGetResourceDependency, ResUtilGetResourceDependencyByName, and ResUtilGetResourceNameDependency functions are very similar in that they all provide access to dependencies of a particular resource type. The following table summarizes the differences between the functions.
Function | How the dependent resource is specified | Requires cluster handle |
---|---|---|
ResUtilGetResourceDependency | Resource handle | No |
ResUtilGetResourceDependencyByName | Resource handle | Yes |
ResUtilGetResourceNameDependency | Resource name | No |
Do not call ResUtilGetResourceDependency from any resource DLL entry point function. ResUtilGetResourceDependency can safely be called from a worker thread. For more information, see Function Calls to Avoid in Resource DLLs.
Examples
As the following example illustrates, if you know that resource A depends on a Physical Disk resource, you can use ResUtilGetResourceDependency to obtain a handle to the dependency.
// String initialization and error checking omitted.
HCLUSTER hCluster = OpenCluster( lpszClusterName );
//
// Resource A depends on a Physical Disk resource.
// Get a handle to that resource.
//
HRESOURCE hResA = OpenClusterResource( hCluster, lpszResName );
HRESOURCE hResD = ResUtilGetResourceDependency(
hResA,
L"Physical Disk" );
// Close handles and free memory.
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2008 Enterprise, Windows Server 2008 Datacenter |
Target Platform | Windows |
Header | resapi.h |
Library | ResUtils.lib |
DLL | ResUtils.dll |
See also
ResUtilFindDependentDiskResourceDriveLetter
ResUtilGetResourceDependencyByClass
ResUtilGetResourceDependencyByName