RpcServerRegisterIfEx function (rpcdce.h)
The RpcServerRegisterIfEx function registers an interface with the RPC run-time library.
RPC_STATUS RpcServerRegisterIfEx( RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN *IfCallback );
MIDL-generated structure indicating the interface to register.
Pointer to a type UUID to associate with the MgrEpv parameter. Specifying a null parameter value (or a nil UUID) registers IfSpec with a nil-type UUID.
Manager routines' entry-point vector (EPV). To use the MIDL-generated default EPV, specify a null value. For more information, please see RPC_MGR_EPV.
Flags. For a list of flag values, see Interface Registration Flags.
Maximum number of concurrent remote procedure call requests the server can accept on an auto-listen interface. The MaxCalls parameters is only applicable on an auto-listen interface, and is ignored on interfaces that are not auto-listen. The RPC run-time library makes its best effort to ensure the server does not allow more concurrent call requests than the number of calls specified in MaxCalls. The actual number can be greater and can vary for each protocol sequence.
Calls on other interfaces are governed by the value of the process-wide MaxCalls parameter specified in the RpcServerListen function call.
If the number of concurrent calls is not a concern, you can achieve slightly better server-side performance by specifying the default value using RPC_C_LISTEN_MAX_CALLS_DEFAULT. Doing so relieves the RPC run-time environment from enforcing an unnecessary restriction.
Security-callback function, or NULL for no callback. Each registered interface can have a different callback function. See Remarks for more details.
Returns RPC_S_OK upon success.
The parameters and effects of RpcServerRegisterIfEx subsume those of RpcServerRegisterIf. The difference is the ability to register an auto-listen interface and to specify a security-callback function.
The server application code calls RpcServerRegisterIfEx to register an interface. To register an interface, the server provides the following information:
- Interface specification
The interface specification is a data structure that the MIDL compiler generates.
- Manager type UUID and manager EPV
The manager type UUID and the manager EPV determine which manager routine executes when a server receives a remote procedure call request from a client. For each implementation of an interface offered by a server, it must register a separate manager EPV.
Note that when specifying a non-nil, manager type UUID, the server must also call RpcObjectSetType to register objects of this non-nil type.
Specifying a security-callback function allows the server application to restrict access to its interfaces on a per-client basis. Remember that, by default, security is optional; the server run time will dispatch unsecured calls even if the server has called RpcServerRegisterAuthInfo. If the server wants to accept only authenticated clients, an interface callback function must call the RpcBindingInqAuthClient or RpcGetAuthorizationContextForClient function to retrieve the security level, or attempt to impersonate the client with RpcImpersonateClient. It can also specify the RPC_IF_ALLOW_SECURE_ONLY flag in the interface flags.
When a server application specifies a security-callback function for its interface(s), the RPC run time automatically rejects unauthenticated calls to that interface. In addition, the run-time records the interfaces that each client has used. When a client makes an RPC to an interface that it has not used during the current communication session, the RPC run-time library will call the interface's security-callback function. Specifying RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH flag will prevent the automatic rejection of unauthenticated clients.
For the signature for the callback function, see RPC_IF_CALLBACK_FN.
The callback function should return RPC_S_OK if the client is allowed to call methods in this interface. Any other return code will cause the client to receive the exception RPC_S_ACCESS_DENIED.
In some cases, the RPC run time may call the security-callback function more than once per client–per interface. Be sure your callback function can handle this possibility.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|Header||rpcdce.h (include Rpc.h)|