ResUtilEnumResourcesEx2 function (resapi.h)

Enumerates all of the resources in a specified cluster and initiates a user-defined operation for each resource. The PRESUTIL_ENUM_RESOURCES_EX2 type defines a pointer to this function.


DWORD ResUtilEnumResourcesEx2(
  [in]           HCLUSTER               hCluster,
  [in, optional] HRESOURCE              hSelf,
  [in]           LPCWSTR                lpszResTypeName,
  [in]           LPRESOURCE_CALLBACK_EX pResCallBack,
  [in]           PVOID                  pParameter,
  [in]           DWORD                  dwDesiredAccess


[in] hCluster

A handle to the cluster that contains the resources to enumerate.

[in, optional] hSelf

An optional handle to a cluster resource. The callback function is not invoked for a resource identified by hSelf.

[in] lpszResTypeName

An optional pointer to a name of a resource type that narrows the scope of resources to enumerate. If lpszResTypeName is specified, only resources of the specified type are enumerated.

[in] pResCallBack

A pointer to a user-defined function which will be called for each enumerated resource. This function must conform to the definition of the ResourceCallbackEx callback function (note that parameter names are not part of the definition; they have been added here for clarity):

  HCLUSTER hCluster,
  PVOID pParameter 


[in] The hCluster parameter passed to ResUtilEnumResourcesEx.


[in] The hSelf parameter passed to ResUtilEnumResourcesEx. Note that the callback function is never called when hSelf and hEnum refer to the same resource.


[in] A handle to the resource currently being enumerated. ResUtilEnumResourcesEx opens and closes this handle automatically.


[in] A generic buffer that allows you to pass any kind of data to the callback function.

[in] pParameter

A generic buffer that allows you to pass any kind of data to the callback function. ResUtilEnumResourcesEx does not use this parameter at all, it merely passes the pointer to the callback function. Whether or not you can pass NULL for the parameter depends on how the callback function is implemented.

[in] dwDesiredAccess

The requested access privileges. This may be any combination of GENERIC_READ (0x80000000), GENERIC_ALL (0x10000000), or MAXIMUM_ALLOWED (0x02000000). If this value is zero (0), an undefined error may be returned. Using GENERIC_ALL is the same as calling ResUtilEnumResourcesEx.

Return value

If the operation succeeds, the function returns ERROR_SUCCESS.

If the operation fails, the function immediately halts the enumeration and returns the value returned by the callback function.


Minimum supported client None supported
Minimum supported server Windows Server 2012
Target Platform Windows
Header resapi.h
Library ResUtils.lib
DLL ResUtils.dll

See also

Resource Utility Functions