ResUtilTerminateServiceProcessFromResDll function (resapi.h)

Attempts to terminate the process of a service being managed as a cluster resource by a resource DLL. The PRESUTIL_TERMINATE_SERVICE_PROCESS_FROM_RES_DLL type defines a pointer to this function.


DWORD ResUtilTerminateServiceProcessFromResDll(
  [in]            DWORD              dwServicePid,
  [in]            BOOL               bOffline,
  [out, optional] PDWORD             pdwResourceState,
  [in]            PLOG_EVENT_ROUTINE pfnLogEvent,
  [in]            RESOURCE_HANDLE    hResourceHandle


[in] dwServicePid

The process ID of the service process to terminate.

[in] bOffline

Indicates whether the resource is being taken offline or is being terminated. Specify TRUE if calling from the Offline entry point or from a worker thread created to take the resource offline. Otherwise specify FALSE and the function will assume you are terminating the resource.

[out, optional] pdwResourceState

Optional pointer to a DWORD which returns the resulting state of the resource, which will be either ClusterResourceFailed or ClusterResourceOffline (for a complete list of resource states see GetClusterResourceState). Pass NULL if you don't need this information.

[in] pfnLogEvent

Pointer to the LogEvent function used by your resource DLL. This pointer is passed to your resource DLL in the Startup entry point.

[in] hResourceHandle

The Resource Monitor's handle to the resource. This handle is passed to your resource DLL in the Open entry point and must be saved as part of the resource's instance data.

Return value

If the operation succeeds, the function returns ERROR_SUCCESS.

If the operation fails, the function returns a system error code.

Note that ResUtilTerminateServiceProcessFromResDll uses pfnLogEvent and hResourceHandle to write to your resource DLL's event log, which may help troubleshoot failures.


You should only call ResUtilTerminateServiceProcessFromResDll when terminating a resource or when taking a resource offline.


Minimum supported client None supported
Minimum supported server Windows Server 2008 Datacenter, Windows Server 2008 Enterprise
Target Platform Windows
Header resapi.h
Library ResUtils.lib
DLL ResUtils.dll

See also

Service Utility Functions