HOWTO: Set Up a Client for Authenticated RPC Under Windows 95

ID: Q184432

The information in this article applies to:

SUMMARY

Under Windows 95, a client application calls RpcBindingSetAuthInfo to set up a binding handle for an authenticated remote procedure call (RPC). If this is called with a NULL server principal name and the binding handle is not fully bound, RpcBindingSetAuthInfo fails with error 1819, RPC_S_BINDING_INCOMPLETE. In this case, you must use RpcEpResolveBinding to fully resolve the binding handle before calling RpcBindingSetAuthInfo. This article demonstrates how to do this.

MORE INFORMATION

Use the following sample code to use RpcEpResolveBinding to fully resolve the binding handle before calling RpcBindingSetAuthInfo:

Sample Code

   status = RpcEpResolveBinding(Binding, RpcServiceSample_v1_0_c_ifspec);
   if (status != RPC_S_OK)
   {
      printf("RpcEpResolveBinding failed - %d\n", status);
      return(1);
   }
   status = RpcBindingSetAuthInfo(Binding,
                                  0,
                                  SecurityLevel,
                                  RPC_C_AUTHN_WINNT,
                                  0,
                                  0
                                  );
   if (status != RPC_S_OK)
   {
      printf("RpcBindingSetAuthInfo failed - %d\n", status);
      return(1);
   }

Under Windows 95, if RpcBindingSetAuthInfo is called with a NULL server principal name, the binding handle must be fully bound. If the server registers the endpoint with the endpoint mapper in a dynamic endpoint (which is not known by the client), you must use RpcEpResolveBinding to bind the handle. You must do this because the Windows 95 run-time library implicitly calls RpcMgmtInqServerPrincName to obtain the principal name from the server, and you cannot make calls to management interfaces to unbound handles. All RPC server processes have the same management interface. Registering the handle with the endpoint mapper is not sufficient to uniquely identify a server.

REFERENCES

Platform SDK documentation: RPC; Windows 95

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q142064
   TITLE     : RPC Authentication Option Under Windows NT

Additional query words: RpcBindingSetAuthInfo
Keywords          : kbnetwork kbAPI kbRPC kbSDKPlatform kbWinOS95 kbGrpNet 
Issue type        : kbhowto

Last Reviewed: July 31, 1998