ResUtilGetResourceNameDependency function

Enumerates the dependencies of a specified resource in the local cluster and returns a handle to a dependency of a specified resource type. The PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY type defines a pointer to this function.

Syntax


HRESOURCE WINAPI ResUtilGetResourceNameDependency(
  _In_ LPCWSTR lpszResourceName,
  _In_ LPCWSTR lpszResourceType
);

typedef DWORD (WINAPI *PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY)(
    _In_ LPCWSTR lpszResourceName,
    _In_ LPCWSTR lpszResourceType
);

Parameters

lpszResourceName [in]

Null-terminated Unicode string specifying the name of the dependent resource. This resource depends on one or more resources.

lpszResourceType [in]

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 lpszResourceName 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 function GetLastError.

Remarks

The ResUtilGetResourceNameDependency, ResUtilGetResourceDependency, and ResUtilGetResourceDependencyByName 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.

FunctionHow the dependent resource is specifiedRequires cluster handle
ResUtilGetResourceDependency Resource handleNo
ResUtilGetResourceDependencyByName Resource handleYes
ResUtilGetResourceNameDependencyResource nameNo

 

Do not call ResUtilGetResourceNameDependency from any resource DLL entry point function. ResUtilGetResourceNameDependency 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 ResUtilGetResourceNameDependency to obtain a handle to the dependency.


// String initialization and error checking omitted.

HRESOURCE hResD = ResUtilGetResourceNameDependency(
                        L"Resource_A_Name",
                        L"Physical Disk" );

// 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
ResUtilGetResourceDependencyByClass
ResUtilGetResourceDependencyByName
ResUtilGetResourceDependentIPAddressProps

 

 

Show: