ResUtilSetResourceServiceStartParametersEx function (resapi.h)

Adjusts the start parameters of a specified service so that it operates correctly as a cluster resource. It must be called from a resource DLL. The PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS_EX type defines a pointer to this function.

Syntax

DWORD ResUtilSetResourceServiceStartParametersEx(
  [in]      LPCWSTR            pszServiceName,
  [in]      SC_HANDLE          schSCMHandle,
  [in, out] LPSC_HANDLE        phService,
  [in]      DWORD              dwDesiredAccess,
  [in]      PLOG_EVENT_ROUTINE pfnLogEvent,
  [in]      RESOURCE_HANDLE    hResourceHandle
);

Parameters

[in] pszServiceName

A pointer to a null-terminated Unicode string that specifies the name of the service.

[in] schSCMHandle

A handle to the Service Control Manager (SCM) or NULL. If NULL, the function attempts to open a handle to the SCM.

[in, out] phService

On input, a NULL service handle. On output, handle to the specified service if the call was successful; otherwise NULL.

[in] dwDesiredAccess

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

[in] pfnLogEvent

A pointer to the LogEvent entry point function of the resource DLL that manages the service.

[in] hResourceHandle

A resource handle that is required by the LogEvent entry point function. Use the handle that is passed to the DLL in the Open entry point function.

Return value

If the operation succeeds, the function returns ERROR_SUCCESS.

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

Remarks

ResUtilSetResourceServiceStartParametersEx verifies that the service is not disabled, changes the service configuration to manual start, and prevents the service from restarting in response to failure. This enables the cluster and the resource DLL to control the service.

If your resource DLL manages a service, use ResUtilSetResourceServiceStartParametersEx and ResUtilSetResourceServiceEnvironment before you bring the service online.

Requirements

Requirement Value
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

ResUtilSetResourceServiceStartParameters

Service Utility Functions