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.

151 lines
4.5 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: cn.cpp
  4. //
  5. // Description:
  6. //
  7. //
  8. //@@BEGIN_MSINTERNAL
  9. // Development Team:
  10. // Mike McLaughlin
  11. //
  12. // History: Date Author Comment
  13. //
  14. // To Do: Date Author Comment
  15. //
  16. //@@END_MSINTERNAL
  17. //
  18. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  19. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  20. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  21. // PURPOSE.
  22. //
  23. // Copyright (c) 1996-1999 Microsoft Corporation. All Rights Reserved.
  24. //
  25. //---------------------------------------------------------------------------
  26. #include "common.h"
  27. //---------------------------------------------------------------------------
  28. //---------------------------------------------------------------------------
  29. //---------------------------------------------------------------------------
  30. NTSTATUS
  31. CConnectNode::Create(
  32. PCONNECT_NODE *ppConnectNode,
  33. PLOGICAL_FILTER_NODE pLogicalFilterNode,
  34. PCONNECT_NODE pConnectNodeNext,
  35. PGRAPH_PIN_INFO pGraphPinInfo,
  36. PPIN_NODE pPinNode1,
  37. PPIN_NODE pPinNode2,
  38. ULONG ulFlagsCurrent,
  39. PGRAPH_NODE pGraphNode
  40. )
  41. {
  42. NTSTATUS Status = STATUS_SUCCESS;
  43. PCONNECT_NODE pConnectNode;
  44. Assert(pPinNode1);
  45. Assert(pPinNode2);
  46. pConnectNode = new CConnectNode(pConnectNodeNext);
  47. if(pConnectNode == NULL) {
  48. Status = STATUS_INSUFFICIENT_RESOURCES;
  49. goto exit;
  50. }
  51. switch(pPinNode1->pPinInfo->Communication) {
  52. case KSPIN_COMMUNICATION_BOTH:
  53. switch(pPinNode2->pPinInfo->Communication) {
  54. case KSPIN_COMMUNICATION_SINK:
  55. pConnectNode->pPinNodeSource = pPinNode1;
  56. pConnectNode->pPinNodeSink = pPinNode2;
  57. break;
  58. case KSPIN_COMMUNICATION_BOTH:
  59. case KSPIN_COMMUNICATION_SOURCE:
  60. pConnectNode->pPinNodeSource = pPinNode2;
  61. pConnectNode->pPinNodeSink = pPinNode1;
  62. break;
  63. default:
  64. ASSERT(FALSE);
  65. Status = STATUS_INVALID_PARAMETER;
  66. goto exit;
  67. }
  68. break;
  69. case KSPIN_COMMUNICATION_SINK:
  70. pConnectNode->pPinNodeSink = pPinNode1;
  71. pConnectNode->pPinNodeSource = pPinNode2;
  72. ASSERT(
  73. pPinNode2->pPinInfo->Communication == KSPIN_COMMUNICATION_BOTH ||
  74. pPinNode2->pPinInfo->Communication == KSPIN_COMMUNICATION_SOURCE);
  75. break;
  76. case KSPIN_COMMUNICATION_SOURCE:
  77. pConnectNode->pPinNodeSink = pPinNode2;
  78. pConnectNode->pPinNodeSource = pPinNode1;
  79. ASSERT(
  80. pPinNode2->pPinInfo->Communication == KSPIN_COMMUNICATION_SINK ||
  81. pPinNode2->pPinInfo->Communication == KSPIN_COMMUNICATION_BOTH);
  82. break;
  83. default:
  84. ASSERT(FALSE);
  85. Status = STATUS_INVALID_PARAMETER;
  86. goto exit;
  87. }
  88. Status = CConnectInfo::Create(
  89. pConnectNode,
  90. pLogicalFilterNode,
  91. pConnectNodeNext->GetConnectInfo(),
  92. pGraphPinInfo,
  93. ulFlagsCurrent,
  94. pGraphNode);
  95. if(!NT_SUCCESS(Status)) {
  96. Trap();
  97. goto exit;
  98. }
  99. if(pLogicalFilterNode->GetFlags() & LFN_FLAGS_NO_BYPASS) {
  100. Status = pGraphNode->lstLogicalFilterNodeNoBypass.AddList(
  101. pLogicalFilterNode,
  102. pConnectNode);
  103. if(!NT_SUCCESS(Status)) {
  104. Trap();
  105. goto exit;
  106. }
  107. }
  108. DPF3(80, "CConnectNode::Create %08x PN %08x %08x",
  109. pConnectNode,
  110. pConnectNode->pPinNodeSink,
  111. pConnectNode->pPinNodeSource);
  112. exit:
  113. if(!NT_SUCCESS(Status)) {
  114. if (pConnectNode) {
  115. pConnectNode->Destroy();
  116. }
  117. pConnectNode = NULL;
  118. }
  119. *ppConnectNode = pConnectNode;
  120. return(Status);
  121. }
  122. CConnectNode::CConnectNode(
  123. PCONNECT_NODE pConnectNodeNext
  124. )
  125. {
  126. this->pConnectNodeNext = pConnectNodeNext;
  127. pConnectNodeNext->AddRef();
  128. AddRef();
  129. DPF1(80, "CConnectNode:%08x PN:%08x %08x", this);
  130. }
  131. CConnectNode::~CConnectNode(
  132. )
  133. {
  134. Assert(this);
  135. DPF1(80, "~CConnectNode: %08x", this);
  136. pConnectInfo->Destroy();
  137. pConnectNodeNext->Destroy();
  138. }
  139. //---------------------------------------------------------------------------