RpcNsBindingUnexport

The RpcNsBindingUnexport function removes the binding handles for an interface and objects from an entry in the name-service database.

This function is supported by Windows NT and Windows 95.

#include <rpc.h>
RPC_STATUS RPC_ENTRY RpcNsBindingUnexport( 
  unsigned long  EntryNameSyntax,   
  unsigned char *  EntryName,   
  RPC_IF_HANDLE  IfSpec,        
  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 from which to remove binding handles and object UUIDs.
IfSpec
Specifies an interface. A null argument value indicates not to unexport any binding handles (only object UUIDs are to be unexported).
ObjectUuidVec
Points to a vector of object UUIDs that the server no longer wants to offer. The application constructs this vector. A null argument value indicates there are no object UUIDs to unexport (only binding handles are to be unexported).

Return Values

Value Meaning
RPC_S_OK Success
RPC_S_INVALID_VERS_OPTION Invalid version option
RPC_S_NOTHING_TO_UNEXPORT Nothing to unexport
RPC_S_INVALID_NAME_SYNTAX Invalid name syntax
RPC_S_UNSUPPORTED_NAME_SYNTAX Unsupported name syntax
RPC_S_INCOMPLETE_NAME Incomplete name
RPC_S_ENTRY_NOT_FOUND Name-service entry not found
RPC_S_NAME_SERVICE_UNAVAILABLE Name service unavailable
RPC_S_INTERFACE_NOT_FOUND Interface not found
RPC_S_NOT_ALL_OBJS_UNEXPORTED Not all objects unexported

Remarks

The RpcNsBindingUnexport routine allows a server application to remove the following from a name-service database entry:

The RpcNsBindingUnexport routine unexports only the binding handles that match the interface UUID and the major and minor interface version numbers found in the IfSpec argument.

A server application can unexport the specified interface and objects in a single call to RpcNsBindingUnexport, or it can unexport them separately.

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 unexported entries will be removed both from the local cache, and from the Active Directory. Unauthorized unexports will only be removed from the local cache. See Access Control in the Security section of the Platform SDK documentation for more information on authorization and Access Control Lists.

If RpcNsBindingUnexport does not find any binding handles for the specified interface, the routine returns an RPC_S_INTERFACE_NOT_FOUND status code and does not unexport the object UUIDs, if any were specified.

If one or more binding handles for the specified interface are found and unexported without error, RpcNsBindingUnexport unexports the specified object UUIDs, if any.

If any of the specified object UUIDs were not found, RpcNsBindingUnexport returns the RPC_S_NOT_ALL_OBJS_UNEXPORTED status code.

In addition to calling RpcNsBindingUnexport, a server should also call the RpcEpUnregister routine to unregister the endpoints the server previously registered with the local endpoint-map database.

Use RpcNsBindingUnexport judiciously. To keep an automatically activated server available, you must leave its binding handles in the name-service database between the times when server processes are activated. However, with dynamic bindings, if you do not unexport binding handles, the Active Directory can become so large as to be unmanageable

Therefore, before you call this routine, keep in mind how long you expect the server to be unavailable, and the type of binding in use. If you are using static bindings, reserve this routine for when you expect a server to be unavailable for an extended time — for example, when it is being permanently removed from service.

Note  Name-service databases are designed to be relatively stable. In replicated name-service databases, frequent use of the RpcNsBindingExport and RpcNsBindingUnexport routines causes the name-service database to repeatedly remove and replace the same entry and can cause performance problems.

QuickInfo

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

See Also

RpcEpUnregister, RpcNsBindingExport