ResUtilGetEnvironmentWithNetName function (resapi.h)

Adjusts environment data for a resource so that the resource uses a cluster network name to identify its location. The resource must be dependent on a Network Name resource. The PRESUTIL_GET_ENVIRONMENT_WITH_NET_NAME type defines a pointer to this function.

Syntax

LPVOID ResUtilGetEnvironmentWithNetName(
  [in] HRESOURCE hResource
);

Parameters

[in] hResource

Handle to a resource that depends on a Network Name resource.

Return value

If the operations succeeds, the function returns a pointer to the environment block.

If the operation fails, the function returns NULL. For more information, call GetLastError.

Remarks

The ResUtilGetEnvironmentWithNetName function appends environment variables to the current environment block. Pass the returned environment block to CreateProcess when starting the resource to achieve the following effects:

  • Clients and the cluster can locate the resource by using the name of the Network Name resource.
  • If the resource calls GetComputerName, GetComputerNameEx, or gethostbyname, the network name will be returned regardless of which node is currently hosting the resource.
If the resource identified by hResource is not dependent on a Network Name resource, ResUtilGetEnvironmentWithNetName returns NULL.

Use ResUtilFreeEnvironment to destroy the environment block.

Do not call ResUtilGetEnvironmentWithNetName from any resource DLL entry point function. ResUtilGetEnvironmentWithNetName 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

ResUtilSetResourceServiceEnvironment