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.

246 lines
6.3 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: si.cpp
  4. //
  5. // Description:
  6. //
  7. // Start Info Class
  8. //
  9. //@@BEGIN_MSINTERNAL
  10. // Development Team:
  11. // Mike McLaughlin
  12. //
  13. // History: Date Author Comment
  14. //
  15. // To Do: Date Author Comment
  16. //
  17. //@@END_MSINTERNAL
  18. //
  19. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  20. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  21. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  22. // PURPOSE.
  23. //
  24. // Copyright (c) 1996-1999 Microsoft Corporation. All Rights Reserved.
  25. //
  26. //---------------------------------------------------------------------------
  27. #include "common.h"
  28. //---------------------------------------------------------------------------
  29. //---------------------------------------------------------------------------
  30. NTSTATUS
  31. CStartInfo::Create(
  32. PSTART_NODE pStartNode,
  33. PCONNECT_INFO pConnectInfo,
  34. PGRAPH_PIN_INFO pGraphPinInfo,
  35. PGRAPH_NODE pGraphNode
  36. )
  37. {
  38. NTSTATUS Status = STATUS_SUCCESS;
  39. PSTART_INFO pStartInfo;
  40. Assert(pGraphNode);
  41. Assert(pStartNode);
  42. //
  43. // Check for duplicate StartInfo in this GraphNode. If duplicate
  44. // AddRef.
  45. //
  46. FOR_EACH_LIST_ITEM(&pGraphNode->lstStartInfo, pStartInfo) {
  47. if(pStartInfo->GetPinInfo() == pStartNode->pPinNode->pPinInfo &&
  48. pStartInfo->pConnectInfoHead == pConnectInfo) {
  49. ASSERT(pStartInfo->pConnectInfoHead->IsSameGraph(pConnectInfo));
  50. pStartInfo->AddRef();
  51. goto exit;
  52. }
  53. } END_EACH_LIST_ITEM
  54. pStartInfo = new START_INFO(
  55. pStartNode->pPinNode->pPinInfo,
  56. pConnectInfo,
  57. pGraphPinInfo,
  58. pGraphNode);
  59. if(pStartInfo == NULL) {
  60. Status = STATUS_INSUFFICIENT_RESOURCES;
  61. goto exit;
  62. }
  63. DPF2(80, "CStartInfo::Create %08x GN %08x", pStartInfo, pGraphNode);
  64. exit:
  65. pStartNode->pStartInfo = pStartInfo;
  66. return(Status);
  67. }
  68. CStartInfo::CStartInfo(
  69. PPIN_INFO pPinInfo,
  70. PCONNECT_INFO pConnectInfo,
  71. PGRAPH_PIN_INFO pGraphPinInfo,
  72. PGRAPH_NODE pGraphNode
  73. )
  74. {
  75. Assert(pGraphPinInfo);
  76. Assert(pGraphNode);
  77. this->pPinInfo = pPinInfo;
  78. this->ulTopologyConnectionTableIndex = MAXULONG;
  79. this->ulVolumeNodeNumberPre = MAXULONG;
  80. this->ulVolumeNodeNumberSuperMix = MAXULONG;
  81. this->ulVolumeNodeNumberPost = MAXULONG;
  82. this->pGraphPinInfo = pGraphPinInfo;
  83. pGraphPinInfo->AddRef();
  84. this->pConnectInfoHead = pConnectInfo;
  85. pConnectInfo->AddRef();
  86. AddList(&pGraphNode->lstStartInfo);
  87. AddRef();
  88. DPF2(80, "CStartInfo: %08x GN %08x", this, pGraphNode);
  89. }
  90. CStartInfo::~CStartInfo(
  91. )
  92. {
  93. DPF1(80, "~CStartInfo: %08x", this);
  94. Assert(this);
  95. RemoveList();
  96. pGraphPinInfo->Destroy();
  97. pConnectInfoHead->Destroy();
  98. }
  99. ENUMFUNC
  100. CStartInfo::CreatePinInfoConnection(
  101. PVOID pReference
  102. )
  103. {
  104. PGRAPH_NODE pGraphNode = PGRAPH_NODE(pReference);
  105. PTOPOLOGY_CONNECTION pTopologyConnection = NULL;
  106. PCONNECT_INFO pConnectInfo;
  107. NTSTATUS Status;
  108. Assert(this);
  109. Assert(pGraphNode);
  110. for(pConnectInfo = GetFirstConnectInfo();
  111. pConnectInfo != NULL;
  112. pConnectInfo = pConnectInfo->GetNextConnectInfo()) {
  113. Assert(pConnectInfo);
  114. Status = ::CreatePinInfoConnection(
  115. &pTopologyConnection,
  116. NULL,
  117. pGraphNode,
  118. pConnectInfo->pPinInfoSource,
  119. pConnectInfo->pPinInfoSink);
  120. if(!NT_SUCCESS(Status)) {
  121. Trap();
  122. goto exit;
  123. }
  124. }
  125. Status = STATUS_CONTINUE;
  126. exit:
  127. return(Status);
  128. }
  129. ENUMFUNC
  130. FindVolumeNode(
  131. IN PTOPOLOGY_CONNECTION pTopologyConnection,
  132. IN BOOL fToDirection,
  133. IN PSTART_INFO pStartInfo
  134. )
  135. {
  136. PTOPOLOGY_PIN pTopologyPin;
  137. Assert(pTopologyConnection);
  138. // Need this check when called from EnumerateGraphTopology
  139. if(IS_CONNECTION_TYPE(pTopologyConnection, GRAPH)) {
  140. return(STATUS_DEAD_END);
  141. }
  142. if(fToDirection) {
  143. pTopologyPin = pTopologyConnection->pTopologyPinTo;
  144. }
  145. else {
  146. pTopologyPin = pTopologyConnection->pTopologyPinFrom;
  147. }
  148. if(pTopologyPin == NULL) {
  149. return(STATUS_CONTINUE);
  150. }
  151. if(IsEqualGUID(pTopologyPin->pTopologyNode->pguidType, &KSNODETYPE_SUM)) {
  152. return(STATUS_DEAD_END);
  153. }
  154. if(IsEqualGUID(pTopologyPin->pTopologyNode->pguidType, &KSNODETYPE_MUX)) {
  155. return(STATUS_DEAD_END);
  156. }
  157. if(IsEqualGUID(
  158. pTopologyPin->pTopologyNode->pguidType,
  159. &KSNODETYPE_SUPERMIX)) {
  160. Assert(pStartInfo);
  161. pStartInfo->ulVolumeNodeNumberSuperMix =
  162. pTopologyPin->pTopologyNode->ulSysaudioNodeNumber;
  163. DPF1(100, "FindVolumeNode: found supermix node: %02x",
  164. pStartInfo->ulVolumeNodeNumberSuperMix);
  165. return(STATUS_CONTINUE);
  166. }
  167. if(IsEqualGUID(
  168. pTopologyPin->pTopologyNode->pguidType,
  169. &KSNODETYPE_VOLUME)) {
  170. Assert(pStartInfo);
  171. if(pStartInfo->ulVolumeNodeNumberSuperMix != MAXULONG) {
  172. // Found a volume node after a super mix
  173. pStartInfo->ulVolumeNodeNumberPost =
  174. pTopologyPin->pTopologyNode->ulSysaudioNodeNumber;
  175. DPF1(100, "FindVolumeNode: found post node: %02x",
  176. pStartInfo->ulVolumeNodeNumberPost);
  177. return(STATUS_SUCCESS);
  178. }
  179. if(pStartInfo->ulVolumeNodeNumberPre == MAXULONG) {
  180. // Found first volume node
  181. pStartInfo->ulVolumeNodeNumberPre =
  182. pTopologyPin->pTopologyNode->ulSysaudioNodeNumber;
  183. DPF1(100, "FindVolumeNode: found pre node: %02x",
  184. pStartInfo->ulVolumeNodeNumberPre);
  185. }
  186. }
  187. return(STATUS_CONTINUE);
  188. }
  189. ENUMFUNC
  190. CStartInfo::EnumStartInfo(
  191. )
  192. {
  193. Assert(this);
  194. DPF3(100, "EnumStartInfo: %08x %d %s",
  195. this,
  196. GetPinInfo()->PinId,
  197. GetPinInfo()->pFilterNode->DumpName());
  198. EnumerateGraphTopology(
  199. this,
  200. (TOP_PFN)FindVolumeNode,
  201. this);
  202. return(STATUS_CONTINUE);
  203. }
  204. //---------------------------------------------------------------------------