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.

101 lines
2.5 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: gpi.cpp
  4. //
  5. // Description:
  6. //
  7. // Graph Pin 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. CGraphPinInfo::Create(
  32. PGRAPH_PIN_INFO *ppGraphPinInfo,
  33. PPIN_INFO pPinInfo,
  34. ULONG ulFlags,
  35. PGRAPH_NODE pGraphNode
  36. )
  37. {
  38. PGRAPH_PIN_INFO pGraphPinInfo = NULL;
  39. NTSTATUS Status = STATUS_SUCCESS;
  40. Assert(pPinInfo);
  41. Assert(pGraphNode);
  42. FOR_EACH_LIST_ITEM(&pGraphNode->lstGraphPinInfo, pGraphPinInfo) {
  43. if(pGraphPinInfo->pPinInfo == pPinInfo &&
  44. ((pGraphPinInfo->ulFlags ^ ulFlags) &
  45. GPI_FLAGS_RESERVE_PIN_INSTANCE) == 0) {
  46. pGraphPinInfo->AddRef();
  47. goto exit;
  48. }
  49. } END_EACH_LIST_ITEM
  50. pGraphPinInfo = new GRAPH_PIN_INFO(pPinInfo, ulFlags, pGraphNode);
  51. if(pGraphPinInfo == NULL) {
  52. Status = STATUS_INSUFFICIENT_RESOURCES;
  53. goto exit;
  54. }
  55. DPF2(80, "CGraphPinInfo::Create %08x GN %08x", pGraphPinInfo, pGraphNode);
  56. exit:
  57. *ppGraphPinInfo = pGraphPinInfo;
  58. return(Status);
  59. }
  60. CGraphPinInfo::CGraphPinInfo(
  61. PPIN_INFO pPinInfo,
  62. ULONG ulFlags,
  63. PGRAPH_NODE pGraphNode
  64. )
  65. {
  66. Assert(pPinInfo);
  67. Assert(pGraphNode);
  68. this->pPinInfo = pPinInfo;
  69. this->ulFlags = ulFlags;
  70. if(ulFlags & GPI_FLAGS_RESERVE_PIN_INSTANCE) {
  71. this->cPinInstances.PossibleCount = 1;
  72. this->cPinInstances.CurrentCount = 0;
  73. }
  74. else {
  75. this->cPinInstances = pPinInfo->cPinInstances;
  76. }
  77. AddRef();
  78. AddList(&pGraphNode->lstGraphPinInfo);
  79. DPF2(80, "CGraphPinInfo: %08x GN %08x", this, pGraphNode);
  80. }
  81. CGraphPinInfo::~CGraphPinInfo(
  82. )
  83. {
  84. DPF1(80, "~CGraphPinInfo: %08x", this);
  85. Assert(this);
  86. RemoveList();
  87. }
  88. //---------------------------------------------------------------------------