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.

127 lines
3.3 KiB

  1. //*************************************************************
  2. //
  3. // File name: TSrvTerm.c
  4. //
  5. // Description: Contains routines to support TShareSRV
  6. // conference disconnect/termination
  7. //
  8. // Microsoft Confidential
  9. // Copyright (c) Microsoft Corporation 1991-1997
  10. // All rights reserved
  11. //
  12. //*************************************************************
  13. #include <TSrv.h>
  14. #include <TSrvInfo.h>
  15. #include <_TSrvInfo.h>
  16. #include <TSrvCom.h>
  17. #include <TSrvWork.h>
  18. #include <TSrvTerm.h>
  19. #include <_TSrvTerm.h>
  20. //*************************************************************
  21. //
  22. // TSrvDoDisconnect()
  23. //
  24. // Purpose: Performs the conf disconnect process
  25. //
  26. // Parameters: IN [pTSrvInfo] -- TSrv instance object
  27. // IN [ulReason] -- Reason for disconnection
  28. //
  29. // Return: STATUS_SUCCESS if successful
  30. // STATUS_* if not
  31. //
  32. // History: 07-17-97 BrianTa Created
  33. //
  34. //*************************************************************
  35. NTSTATUS
  36. TSrvDoDisconnect(IN PTSRVINFO pTSrvInfo,
  37. IN ULONG ulReason)
  38. {
  39. DWORD dwStatus;
  40. NTSTATUS ntStatus;
  41. TRACE((DEBUG_TSHRSRV_FLOW,
  42. "TShrSRV: TSrvDoDisconnect entry\n"));
  43. // Initiate the disconnect process
  44. ntStatus = TSrvConfDisconnectReq(pTSrvInfo, ulReason);
  45. TRACE((DEBUG_TSHRSRV_FLOW,
  46. "TShrSRV: TSrvDoDisconnect exit - 0x%x\n", ntStatus));
  47. return (ntStatus);
  48. }
  49. //*************************************************************
  50. //
  51. // TSrvDisconnect()
  52. //
  53. // Purpose: Initiates the conf disconnect process
  54. //
  55. // Parameters: IN [pTSrvInfo] -- TSrv instance object
  56. // IN [ulReason] -- Reason for disconnection
  57. //
  58. // Return: STATUS_SUCCESS if successful
  59. // STATUS_* if not
  60. //
  61. // History: 07-17-97 BrianTa Created
  62. //
  63. //*************************************************************
  64. NTSTATUS
  65. TSrvDisconnect(IN PTSRVINFO pTSrvInfo,
  66. IN ULONG ulReason)
  67. {
  68. NTSTATUS ntStatus;
  69. TRACE((DEBUG_TSHRSRV_FLOW,
  70. "TShrSRV: TSrvDisconnect entry\n"));
  71. ntStatus = STATUS_SUCCESS;
  72. TS_ASSERT(pTSrvInfo);
  73. if (pTSrvInfo)
  74. {
  75. EnterCriticalSection(&pTSrvInfo->cs);
  76. if (!pTSrvInfo->fDisconnect)
  77. {
  78. // Set the fDisconnect bit under cs control so that we can
  79. // coordinate disconnects for conferences being connected
  80. // but not yet fully connected
  81. pTSrvInfo->fDisconnect = TRUE;
  82. pTSrvInfo->ulReason = ulReason;
  83. LeaveCriticalSection(&pTSrvInfo->cs);
  84. // If the conference is fully connected, then initiate the
  85. // disconnect process
  86. if (pTSrvInfo->fuConfState == TSRV_CONF_PENDING)
  87. SetEvent(pTSrvInfo->hWorkEvent);
  88. }
  89. else
  90. {
  91. LeaveCriticalSection(&pTSrvInfo->cs);
  92. }
  93. // All done with this object
  94. TSrvDereferenceInfo(pTSrvInfo);
  95. }
  96. TRACE((DEBUG_TSHRSRV_FLOW,
  97. "TShrSRV: TSrvDisconnect exit - 0x%x\n", ntStatus));
  98. return (ntStatus);
  99. }