ResUtilSetResourceServiceEnvironment function (resapi.h)

Adjusts the environment data for a service so that the service uses a cluster network name to identify its location. This function must be called from a resource DLL. The PRESUTIL_SET_RESOURCE_SERVICE_ENVIRONMENT type defines a pointer to this function.

Syntax

DWORD ResUtilSetResourceServiceEnvironment(
  [in] LPCWSTR            pszServiceName,
  [in] HRESOURCE          hResource,
  [in] PLOG_EVENT_ROUTINE pfnLogEvent,
  [in] RESOURCE_HANDLE    hResourceHandle
);

Parameters

[in] pszServiceName

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

[in] hResource

Resource handle for the service obtained from OpenClusterResource.

[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

ResUtilSetResourceServiceEnvironment calls ResUtilGetEnvironmentWithNetName and stores the resulting environment block in a registry entry for the service. For more information about the effects of the environment block, see ResUtilGetEnvironmentWithNetName.

If your resource DLL manages a service, create a worker thread and use ResUtilSetResourceServiceStartParameters and ResUtilSetResourceServiceEnvironment when bringing the service online.

Do not call ResUtilSetResourceServiceEnvironment from any resource DLL entry point function. ResUtilSetResourceServiceEnvironment can safely be called from a worker thread. For more information, see Function Calls to Avoid in Resource DLLs.

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

ResUtilGetEnvironmentWithNetName