Leaked source code of windows server 2003
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.

120 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. msgbind.c
  5. Abstract:
  6. Contains the RPC bind and un-bind routines for the Service Controller.
  7. Author:
  8. Dan Lafferty (danl) 29-May-1991
  9. Environment:
  10. User Mode -Win32
  11. Revision History:
  12. --*/
  13. //
  14. // INCLUDES
  15. //
  16. #include <nt.h> // DbgPrint prototype
  17. #include <rpc.h> // DataTypes and runtime APIs
  18. #include <msgsvc.h> // generated by the MIDL complier
  19. #include <rpcutil.h> // NetRpc utils
  20. #include <netlib.h> // UNUSED macro
  21. #include <msgnames.h> // MSGR_INTERFACE_NAME
  22. /****************************************************************************/
  23. handle_t
  24. MSGSVC_HANDLE_bind (
  25. MSGSVC_HANDLE ServerName
  26. )
  27. /*++
  28. Routine Description:
  29. This routine calls a common bind routine that is shared by all services.
  30. This routine is called from the messenger service client stubs when
  31. it is necessary to bind to a server.
  32. Arguments:
  33. ServerName - A pointer to a string containing the name of the server
  34. to bind with.
  35. Return Value:
  36. The binding handle is returned to the stub routine. If the
  37. binding is unsuccessful, a NULL will be returned.
  38. --*/
  39. {
  40. handle_t bindingHandle;
  41. RPC_STATUS status;
  42. status = NetpBindRpc (
  43. ServerName,
  44. MSGR_INTERFACE_NAME,
  45. L"Security=Impersonation Dynamic False",
  46. &bindingHandle);
  47. #ifdef DEBUG
  48. DbgPrint("MSGSVC_HANDLE_bind:NetpBindRpc status=%d\n",status);
  49. DbgPrint("MSGSVC_HANDLE_bind: handle=%d\n",bindingHandle);
  50. #endif
  51. return( bindingHandle);
  52. }
  53. /****************************************************************************/
  54. void
  55. MSGSVC_HANDLE_unbind (
  56. MSGSVC_HANDLE ServerName,
  57. handle_t BindingHandle
  58. )
  59. /*++
  60. Routine Description:
  61. This routine calls a common unbind routine that is shared by
  62. all services.
  63. This routine is called from the Messenger Service client stubs when
  64. it is necessary to unbind to a server.
  65. Arguments:
  66. ServerName - This is the name of the server from which to unbind.
  67. BindingHandle - This is the binding handle that is to be closed.
  68. Return Value:
  69. none.
  70. --*/
  71. {
  72. UNUSED(ServerName); // This parameter is not used
  73. #ifdef DEBUG
  74. DbgPrint("MSGSVC_HANDLE_unbind: handle=%d\n",BindingHandle);
  75. #endif
  76. NetpUnbindRpc ( BindingHandle);
  77. return;
  78. }