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.

188 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1991-1993 Microsoft Corporation
  3. Module Name:
  4. bind.c
  5. Abstract:
  6. Contains the client-side RPC bind and unbind routines for Workstation
  7. service.
  8. Author:
  9. Rita Wong (ritaw) 12-Feb-1993
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. --*/
  14. //
  15. // INCLUDES
  16. //
  17. #include <nwclient.h>
  18. #include <rpcutil.h> // RpcUtils for binding
  19. #include <nwmisc.h> // NWWKS_INTERFACE_NAME
  20. handle_t
  21. NWWKSTA_IMPERSONATE_HANDLE_bind(
  22. NWWKSTA_IMPERSONATE_HANDLE Reserved
  23. )
  24. /*++
  25. Routine Description:
  26. This routine is called from the Workstation service client when
  27. it is necessary create an RPC binding to the server end with
  28. impersonation level of impersonation.
  29. Arguments:
  30. Return Value:
  31. The binding handle is returned to the stub routine. If the bind is
  32. unsuccessful, a NULL will be returned.
  33. --*/
  34. {
  35. handle_t BindHandle = 0;
  36. RPC_STATUS RpcStatus;
  37. UNREFERENCED_PARAMETER(Reserved);
  38. RpcStatus = NetpBindRpc(
  39. NULL,
  40. NWWKS_INTERFACE_NAME,
  41. L"Security=Impersonation Dynamic False",
  42. &BindHandle
  43. );
  44. if (RpcStatus != RPC_S_OK) {
  45. KdPrint((
  46. "NWWORKSTATION: Client NWWKSTA_IMPERSONATE_HANDLE_bind failed: %lu\n",
  47. RpcStatus
  48. ));
  49. }
  50. return BindHandle;
  51. }
  52. handle_t
  53. NWWKSTA_IDENTIFY_HANDLE_bind(
  54. NWWKSTA_IDENTIFY_HANDLE Reserved
  55. )
  56. /*++
  57. Routine Description:
  58. This routine is called from the Workstation service client stubs when
  59. it is necessary create an RPC binding to the server end with
  60. identification level of impersonation.
  61. Arguments:
  62. Return Value:
  63. The binding handle is returned to the stub routine. If the bind is
  64. unsuccessful, a NULL will be returned.
  65. --*/
  66. {
  67. handle_t BindHandle = 0;
  68. RPC_STATUS RpcStatus;
  69. UNREFERENCED_PARAMETER(Reserved);
  70. RpcStatus = NetpBindRpc(
  71. NULL,
  72. NWWKS_INTERFACE_NAME,
  73. L"Security=Identification Dynamic False",
  74. &BindHandle
  75. );
  76. if (RpcStatus != RPC_S_OK) {
  77. KdPrint((
  78. "NWWORKSTATION: Client NWWKSTA_IDENTIFY_HANDLE_bind failed: %lu\n",
  79. RpcStatus
  80. ));
  81. }
  82. return BindHandle;
  83. }
  84. void
  85. NWWKSTA_IMPERSONATE_HANDLE_unbind(
  86. NWWKSTA_IMPERSONATE_HANDLE Reserved,
  87. handle_t BindHandle
  88. )
  89. /*++
  90. Routine Description:
  91. This routine unbinds the impersonation generic handle.
  92. Arguments:
  93. Reserved -
  94. BindingHandle - This is the binding handle that is to be closed.
  95. Return Value:
  96. None.
  97. --*/
  98. {
  99. UNREFERENCED_PARAMETER(Reserved);
  100. NetpUnbindRpc(BindHandle);
  101. }
  102. void
  103. NWWKSTA_IDENTIFY_HANDLE_unbind(
  104. NWWKSTA_IDENTIFY_HANDLE Reserved,
  105. handle_t BindHandle
  106. )
  107. /*++
  108. Routine Description:
  109. This routine unbinds the identification generic handle.
  110. Arguments:
  111. Reserved -
  112. BindingHandle - This is the binding handle that is to be closed.
  113. Return Value:
  114. None.
  115. --*/
  116. {
  117. UNREFERENCED_PARAMETER(Reserved);
  118. NetpUnbindRpc(BindHandle);
  119. }