ResUtilSetResourceServiceStartParameters function (resapi.h)

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

Syntax

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

Parameters

[in] pszServiceName

Pointer to a null-terminated Unicode string specifying the name of the service.

[in] schSCMHandle

Handle to the Service Control Manager (SCM) or NULL. If NULL, the function will attempt 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] pfnLogEvent

Pointer to the LogEvent entry point function of the resource DLL managing the service.

[in] hResourceHandle

Resource handle required by the LogEvent entry point function. Use the handle 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

ResUtilSetResourceServiceStartParameters 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 allows the cluster and the resource DLL to control the service.

If your resource DLL manages a service, use ResUtilSetResourceServiceStartParameters and ResUtilSetResourceServiceEnvironment before bringing the service online.

Requirements

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

See also

LogEvent

Online

Open

ResUtilSetResourceServiceEnvironment