ResUtilGetResourceDependencyByClass function

Enumerates the dependencies of a specified resource in a specified cluster and returns a handle to a dependency that matches a specified resource class. The PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS type defines a pointer to this function.

Syntax


HRESOURCE WINAPI ResUtilGetResourceDependencyByClass(
  _In_ HCLUSTER                  hCluster,
  _In_ HANDLE                    hSelf,
  _In_ PCLUS_RESOURCE_CLASS_INFO prci,
  _In_ BOOL                      bRecurse
);

typedef HRESOURCE (WINAPI *PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS)(
    _In_ HCLUSTER                  hCluster,
    _In_ HANDLE                    hSelf,
    _In_ PCLUS_RESOURCE_CLASS_INFO prci,
    _In_ BOOL                      bRecurse
);

Parameters

hCluster [in]

Handle to the cluster to which the resource belongs.

hSelf [in]

Handle to the dependent resource. This resource depends on one or more resources.

prci [in]

Pointer to a CLUS_RESOURCE_CLASS_INFO structure describing the resource class of the dependency to return.

bRecurse [in]

Determines the scope of the search. If TRUE, the function checks the entire dependency tree under the dependent resource. If FALSE, the function checks only the resources on which the dependent resource directly depends.

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

Do not call ResUtilGetResourceDependencyByClass from any resource DLL entry point function. ResUtilGetResourceDependencyByClass 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 storage class resource, you can use ResUtilGetResourceDependencyByClass to obtain a handle to the storage class resource without knowing anything else about it.


// String initialization and error checking omitted.

HCLUSTER hCluster = OpenCluster( lpszClusterName );

//
// Resource A depends on a storage class resource.
// Get a handle to that resource.
//
HRESOURCE hResA = OpenClusterResource( hCluster, lpszResName );

PCLUS_RESOURCE_CLASS_INFO pClassInfo;

pClassInfo->rc = CLUS_RESCLASS_STORAGE;

//
// Returns a handle to the storage class resource on which resource A depends.
// Can now perform a variety of operations on the dependency.
//
HRESOURCE hResD = ResUtilGetResourceDependencyByClass(
                        hCluster,
                        hResA,
                        pClassInfo,
                        TRUE );

// Close handles and free memory.


Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2008 Enterprise, Windows Server 2008 Datacenter

Header

ResApi.h

Library

ResUtils.lib

DLL

ResUtils.dll

See also

CloseClusterResource
ResUtilFindDependentDiskResourceDriveLetter
ResUtilGetResourceDependency
ResUtilGetResourceDependencyByName
ResUtilGetResourceDependentIPAddressProps
ResUtilGetResourceNameDependency

 

 

Show: