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.

114 lines
2.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: C O M P R E F S . H
  7. //
  8. // Contents: Implements the interface to a component's references. A
  9. // component can be referenced (installed by) other components,
  10. // the user, or other software. This module manages the
  11. // interface to that data.
  12. //
  13. // Notes:
  14. //
  15. // Author: shaunco 15 Jan 1999
  16. //
  17. //----------------------------------------------------------------------------
  18. #pragma once
  19. #include "complist.h"
  20. #include "ncstring.h"
  21. #include "netcfgx.h"
  22. struct COMPONENT_REFERENCE_DATA
  23. {
  24. CComponentList RefByComponents;
  25. vector<CWideString> RefBySoftware;
  26. BOOLEAN fRefByUser;
  27. };
  28. class CComponentReferences
  29. {
  30. private:
  31. COMPONENT_REFERENCE_DATA* m_pData;
  32. private:
  33. HRESULT
  34. HrEnsureAllocated ();
  35. public:
  36. ~CComponentReferences ();
  37. ULONG
  38. CountComponentsReferencedBy () const;
  39. ULONG
  40. CountSoftwareReferencedBy () const;
  41. ULONG
  42. CountTotalReferencedBy () const;
  43. BOOL
  44. FIsReferencedByComponent (
  45. IN const CComponent* pComponent) const;
  46. BOOL
  47. FIsReferencedByOboToken (
  48. IN const OBO_TOKEN* pOboToken) const;
  49. BOOL
  50. FIsReferencedByOthers () const;
  51. BOOL
  52. FIsReferencedByUser () const
  53. {
  54. return (m_pData && m_pData->fRefByUser);
  55. }
  56. VOID
  57. GetReferenceDescriptionsAsMultiSz (
  58. IN BYTE* pbBuf OPTIONAL,
  59. OUT ULONG* pcbBuf) const;
  60. CComponent*
  61. PComponentReferencedByAtIndex (
  62. IN UINT unIndex) const;
  63. const CWideString*
  64. PSoftwareReferencedByAtIndex (
  65. IN UINT unIndex) const;
  66. HRESULT
  67. HrAddReferenceByUser ();
  68. HRESULT
  69. HrAddReferenceByComponent (
  70. IN const CComponent* pComponent);
  71. HRESULT
  72. HrAddReferenceByOboToken (
  73. IN const OBO_TOKEN* pOboToken);
  74. HRESULT
  75. HrAddReferenceBySoftware (
  76. IN PCWSTR pszKey);
  77. HRESULT
  78. HrRemoveReferenceByOboToken (
  79. IN const OBO_TOKEN* pOboToken);
  80. VOID
  81. RemoveAllReferences();
  82. VOID
  83. RemoveReferenceByComponent (
  84. IN const CComponent* pComponent)
  85. {
  86. AssertH (pComponent);
  87. AssertH (m_pData);
  88. m_pData->RefByComponents.RemoveComponent(pComponent);
  89. }
  90. };