RpcNsBindingLookupBeginA function (rpcnsi.h)

The RpcNsBindingLookupBegin function creates a lookup context for an interface and an object.

Note  This function is not supported on Windows Vista and later operating systems.


RPC_STATUS RpcNsBindingLookupBeginA(
  unsigned long EntryNameSyntax,
  RPC_CSTR      EntryName,
  UUID          *ObjUuid,
  unsigned long BindingMaxCount,
  RPC_NS_HANDLE *LookupContext



Syntax of the EntryName parameter.

To use the syntax specified in the registry value entry HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc\NameService\DefaultSyntax, provide a value of RPC_C_NS_SYNTAX_DEFAULT.


Pointer to an entry name at which the search for compatible bindings begins.

To use the entry name specified in the registry value entry HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc\NameService\DefaultEntry, provide a null pointer or an empty string. In this case, the EntryNameSyntax parameter is ignored and the run-time library uses the default syntax.


Stub-generated structure indicating the interface to look up. If the interface specification has not been exported or is of no concern to the caller, specify a null value for this parameter. In this case, the bindings returned are only guaranteed to be of a compatible and supported protocol sequence and to contain the specified object UUID. The desired interface might not be supported by the contacted server.


Pointer to an optional object UUID.

For a nonzero UUID, compatible binding handles are returned from an entry only if the server has exported the specified object UUID.

For a null pointer value or a nil UUID for this parameter, the returned binding handles contain one of the object UUIDs exported by the compatible server. If the server did not export any object UUIDs, the returned compatible binding handles contain a nil object UUID.


Maximum number of bindings to return in the BindingVec parameter from the RpcNsBindingLookupNext function.

Specify a value of zero to use the default count of RPC_C_BINDING_MAX_COUNT_DEFAULT.


Returns a pointer to a name-service handle for use with the RpcNsBindingLookupNext and RpcNsBindingLookupDone functions.

Return value

Value Meaning
The call succeeded.
The name syntax is invalid.
The name syntax is unsupported.
The name is incomplete.
The name-service entry was not found.
The name service is unavailable.
Invalid object.
Note  For a list of valid error codes, see RPC Return Values.


The RpcNsBindingLookupBegin function creates a lookup context for locating client-compatible binding handles to servers that offer the specified interface and object.

Before calling RpcNsBindingLookupNext, the client application must first call RpcNsBindingLookupBegin to create a lookup context. The parameters to this function control the operation of the RpcNsBindingLookupNext function.

Effective with Windows 2000, the RPC environment uses the Active Directory as its name-service database and the order in which the run-time environment performs the search is as follows:

  • Search in the local cache.
  • If entry not found in local cache, search that machine's Active Directory.
  • If entry not found on local machine, send broadcast requests to all other Active Directory services in the domain.

    Note that if the entry exists in the Active Directory, but there is no information associated with the entry, the run-time environment will not issue this broadcast request.

When finished locating binding handles, the client application calls the RpcNsBindingLookupDone function to delete the lookup context.


The rpcnsi.h header defines RpcNsBindingLookupBegin as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header rpcnsi.h (include Rpc.h)
Library Rpcns4.lib
DLL Rpcns4.dll

See also