Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ncpbind.c
  5. Abstract:
  6. Contains the RPC bind and un-bind routines for the NcpServer
  7. Service.
  8. Author:
  9. Dan Lafferty (danl) 01-Mar-1991
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. 01-Mar-1991 danl
  14. created
  15. 07-Jun-1991 JohnRo
  16. Allowed debug output of failures.
  17. 15-Nov-1993 Yi-Hsin
  18. Modify for NcpServer.
  19. --*/
  20. //
  21. // INCLUDES
  22. //
  23. #include <nt.h> // DbgPrint prototype
  24. #include <rpc.h> // DataTypes and runtime APIs
  25. #include <ncpsvc.h> // generated by the MIDL complier
  26. #include <ntrpcp.h> // Rpc utils
  27. #include <srvnames.h> // SERVER_INTERFACE_NAME
  28. handle_t
  29. NCPSVC_HANDLE_bind (
  30. NCPSVC_HANDLE ServerName
  31. )
  32. /*++
  33. Routine Description:
  34. This routine calls a common bind routine that is shared by all services.
  35. This routine is called from the ncpserver service client stubs when
  36. it is necessary to bind to a server.
  37. Arguments:
  38. ServerName - A pointer to a string containing the name of the server
  39. to bind with.
  40. Return Value:
  41. The binding handle is returned to the stub routine. If the
  42. binding is unsuccessful, a NULL will be returned.
  43. --*/
  44. {
  45. handle_t bindingHandle = NULL;
  46. RPC_STATUS status;
  47. status = RpcpBindRpc( ServerName,
  48. SERVER_INTERFACE_NAME,
  49. // TEXT("Security=Impersonation Static True"),
  50. TEXT("Security=Impersonation Dynamic False"),
  51. &bindingHandle );
  52. #if DBG
  53. if ( status != RPC_S_OK )
  54. KdPrint(("NCPSVC_HANDLE_bind: RpcpBindRpc failed status=%lC\n",status));
  55. #endif
  56. return( bindingHandle );
  57. }
  58. void
  59. NCPSVC_HANDLE_unbind (
  60. NCPSVC_HANDLE ServerName,
  61. handle_t BindingHandle
  62. )
  63. /*++
  64. Routine Description:
  65. This routine calls a common unbind routine that is shared by
  66. all services.
  67. This routine is called from the ncpserver service client stubs when
  68. it is necessary to unbind to a server.
  69. Arguments:
  70. ServerName - This is the name of the server from which to unbind.
  71. BindingHandle - This is the binding handle that is to be closed.
  72. Return Value:
  73. none.
  74. --*/
  75. {
  76. UNREFERENCED_PARAMETER( ServerName ); // This parameter is not used
  77. RpcpUnbindRpc ( BindingHandle );
  78. }