RpcNsBindingExport

The RpcNsBindingExport function establishes a name-service database entry with multiple binding handles and multiple objects for a server.

This function is supported by Windows NT and Windows 95.

#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcNsBindingExport( 
  unsigned long  EntryNameSyntax,   
  unsigned char *  EntryName,       
  RPC_IF_HANDLE  IfSpec,            
  RPC_BINDING_VECTOR *  BindingVec,   
  UUID_VECTOR *  ObjectUuidVec      
);
 

Parameters

EntryNameSyntax
Specifies an unsigned long value that indicates the syntax of the next argument, EntryName.

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

EntryName
Points to the entry name to which binding handles and object UUIDs are exported. You may not provide a null or empty string.

To use the entry name specified in the registry value 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 EntryName.

IfSpec
Specifies a stub-generated data structure specifying the interface to export. A null argument value indicates there are no binding handles to export (only object UUIDs are to be exported) and the BindingVec argument is ignored.
BindingVec
Points to server bindings to export. A null argument value indicates there are no binding handles to export (only object UUIDs are to be exported).
ObjectUuidVec
Points to a vector of object UUIDs offered by the server. The server application constructs this vector. A null argument value indicates there are no object UUIDs to export (only binding handles are to be exported).

Return Values

Value Meaning
RPC_S_OK Success
RPC_S_NOTHING_TO_EXPORT Nothing to export
RPC_S_INVALID_BINDING Invalid binding handle
RPC_S_WRONG_KIND_OF_BINDING Wrong kind of binding for operation
RPC_S_INVALID_NAME_SYNTAX Invalid name syntax
RPC_S_UNSUPPORTED_NAME_SYNTAX Unsupported name syntax
RPC_S_INCOMPLETE_NAME Incomplete name
RPC_S_NO_NS_PRIVILEGE No privilege for name-service operation
RPC_S_NAME_SERVICE_UNAVAILABLE Name service unavailable

Remarks

The RpcNsBindingExport routine allows a server application to publicly offer an interface in the name-service database for use by any client application.

Effective with version 5.0 of Windows NT, the RPC run-time environment uses the Active Directory as its name service database. This means that an authorized exported entries will be persistent in the name service, and will be visible even after re-booting. Unauthorized exports will not be persistent. See Access Control in the Security section of the Platform SDK documentation for more information on authorization and Access Control Lists.

To export an interface, the server application calls the RpcNsBindingExport routine with an interface and the server binding handles a client can use to access the server.

A server application also calls the RpcNsBindingExport routine to publicly offer the object UUID(s) of resource(s) it offers, if any, in the name-service database.

A server can export interfaces and objects in a single call to RpcNsBindingExport, or it can export them separately.

If the name-service database entry specified by the EntryName argument does not exist, the RpcNsBindingExport routine tries to create it. In this case, the server application must have the privilege to create the entry.

In addition to calling RpcNsBindingExport, a server that called the RpcServerUseAllProtseqs or RpcServerUseProtseq routine must also register with the local endpoint-map database by calling either the RpcEpRegister or RpcEpRegisterNoReplace routine.

A server is not required to export its interface(s) to the name-service database. When a server does not export, only clients that privately know of that server's binding information can access its interface(s). For example, a client that has the information needed to construct a string binding can call the RpcBindingFromStringBinding to create a binding handle for making remote procedure calls to a server.

Before calling the RpcNsBindingExport routine, a server must do the following:

The vector returned from the RpcServerInqBindings routine becomes the Binding argument for RpcNsBindingExport. To prevent a binding from being exported, set the selected vector element to a null value.

To remove binding handles and object UUIDs from the name-service database, a server application calls the RpcNsBindingUnexport routine.

QuickInfo

  Windows NT: Yes
  Windows CE: Unsupported.
  Header: Declared in rpcnsi.h.
  Import Library: Link with rpcns4.lib.

See Also

RpcBindingFromStringBinding, RpcEpRegister, RpcEpRegisterNoReplace, RpcNsBindingUnexport, RpcServerInqBindings, RpcServerUseAllProtseqs, RpcServerUseAllProtseqsIf, RpcServerUseProtseq, RpcServerUseProtseqEp, RpcServerUseProtseqIf