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
);
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.
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.
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 |
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.
Windows NT: Yes
Windows CE: Unsupported.
Header: Declared in rpcnsi.h.
Import Library: Link with rpcns4.lib.
RpcBindingFromStringBinding, RpcEpRegister, RpcEpRegisterNoReplace, RpcNsBindingUnexport, RpcServerInqBindings, RpcServerUseAllProtseqs, RpcServerUseAllProtseqsIf, RpcServerUseProtseq, RpcServerUseProtseqEp, RpcServerUseProtseqIf