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.

185 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. w3bind.c
  5. Abstract:
  6. Routines which use RPC to bind and unbind the client to the W3 Daemon
  7. service.
  8. Author:
  9. Dan Hinsley (DanHi) 23-Mar-1993
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. MuraliK 15-Nov-1995 converted to get rid of net lib functions.
  14. MuraliK 21-Dec-1995 Support for TCP/IP binding.
  15. --*/
  16. #define UNICODE
  17. #include <nt.h>
  18. #include <ntrtl.h>
  19. #include <nturtl.h>
  20. #include <windef.h>
  21. #include <w3svci_c.h>
  22. #include "apiutil.h"
  23. handle_t
  24. W3_IMPERSONATE_HANDLE_bind(
  25. W3_IMPERSONATE_HANDLE ServerName
  26. )
  27. /*++
  28. Routine Description:
  29. This routine is called from the W3 Daemon client stubs when
  30. it is necessary create an RPC binding to the server end with
  31. impersonation level of security
  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 bind is
  37. unsuccessful, a NULL will be returned.
  38. --*/
  39. {
  40. handle_t BindHandle;
  41. RPC_STATUS RpcStatus;
  42. RpcStatus = RpcBindHandleForServer(&BindHandle,
  43. ServerName,
  44. W3_INTERFACE_NAME,
  45. PROT_SEQ_NP_OPTIONS_W
  46. );
  47. return BindHandle;
  48. }
  49. handle_t
  50. W3_IDENTIFY_HANDLE_bind(
  51. W3_IDENTIFY_HANDLE ServerName
  52. )
  53. /*++
  54. Routine Description:
  55. This routine is called from the W3 Daemon client stubs when
  56. it is necessary create an RPC binding to the server end with
  57. identification level of impersonation.
  58. Arguments:
  59. ServerName - A pointer to a string containing the name of the server
  60. to bind with.
  61. Return Value:
  62. The binding handle is returned to the stub routine. If the bind is
  63. unsuccessful, a NULL will be returned.
  64. --*/
  65. {
  66. handle_t BindHandle;
  67. RPC_STATUS RpcStatus;
  68. RpcStatus = RpcBindHandleForServer(&BindHandle,
  69. ServerName,
  70. W3_INTERFACE_NAME,
  71. PROT_SEQ_NP_OPTIONS_W
  72. );
  73. return BindHandle;
  74. }
  75. void
  76. W3_IMPERSONATE_HANDLE_unbind(
  77. W3_IMPERSONATE_HANDLE ServerName,
  78. handle_t BindHandle
  79. )
  80. /*++
  81. Routine Description:
  82. This routine calls a common unbind routine that is shared by all services.
  83. This routine is called from the W3 Daemon client stubs when it is
  84. necessary to unbind from the server end.
  85. Arguments:
  86. ServerName - This is the name of the server from which to unbind.
  87. BindingHandle - This is the binding handle that is to be closed.
  88. Return Value:
  89. None.
  90. --*/
  91. {
  92. UNREFERENCED_PARAMETER(ServerName);
  93. (VOID) RpcBindHandleFree(&BindHandle);
  94. return;
  95. }
  96. void
  97. W3_IDENTIFY_HANDLE_unbind(
  98. W3_IDENTIFY_HANDLE ServerName,
  99. handle_t BindHandle
  100. )
  101. /*++
  102. Routine Description:
  103. This routine calls a common unbind routine that is shared by all services.
  104. This routine is called from the W3 Daemon client stubs when it is
  105. necessary to unbind from a server.
  106. Arguments:
  107. ServerName - This is the name of the server from which to unbind.
  108. BindingHandle - This is the binding handle that is to be closed.
  109. Return Value:
  110. None.
  111. --*/
  112. {
  113. UNREFERENCED_PARAMETER(ServerName);
  114. (VOID) RpcBindHandleFree(BindHandle);
  115. return;
  116. }
  117. /****************************** End Of File ******************************/