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.

107 lines
2.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: F I L T D E V S . H
  7. //
  8. // Contents: Implements the basic datatype for a collection of filter
  9. // devices.
  10. //
  11. // Notes:
  12. //
  13. // Author: shaunco 15 Jan 1999
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. #include "filtdev.h"
  18. #include "ncsetup.h"
  19. #include "netcfg.h"
  20. // Filter devices is a collection of pointers to CFilterDevice.
  21. //
  22. class CFilterDevices : public vector<CFilterDevice*>
  23. {
  24. friend class CRegistryBindingsContext;
  25. private:
  26. CNetConfigCore* m_pCore;
  27. CComponentList m_Filters;
  28. HDEVINFO m_hdi;
  29. // This multi-sz is read from the registry (Control\Network\FilterClasses)
  30. // and defines the order in which filters stack up. Each filter INF
  31. // specifies Ndi\FilterClass which matches a string in this list. In
  32. // the event that the string does not match any in the list, it is added
  33. // to the top of the list. (Top was chosen arbitrarily.)
  34. //
  35. PWSTR m_pmszFilterClasses;
  36. public:
  37. // When filters are installed or removed (or we see that a filter is
  38. // no longer active or newly active over an adapter as in the case of
  39. // disabling the binding between the filter and an adapter) we add the
  40. // upper bindings of the adapter to this binding set.
  41. // These bindings will be unbound before we start the filter devices.
  42. // This breaks the filter chain and allows NDIS to properly reconstruct
  43. // it when the new devices are started.
  44. // Then these bindings will be added to the set of added bindpaths in
  45. // CModifyContext::ApplyChanges and hence will be sent BIND
  46. // notifications. This has to happen so that the protocol(s)
  47. // bound to the adapter get dynamically rebound after they have been
  48. // implicitly unbound due to the filter device removal.
  49. //
  50. CBindingSet m_BindPathsToRebind;
  51. private:
  52. HRESULT
  53. HrInsertFilterDevice (
  54. IN CFilterDevice* pDevice);
  55. HRESULT
  56. HrLoadFilterDevice (
  57. IN SP_DEVINFO_DATA* pdeid,
  58. IN HKEY hkeyInstance,
  59. IN PCWSTR pszFilterInfId,
  60. OUT BOOL* pfRemove);
  61. DWORD
  62. MapFilterClassToOrdinal (
  63. IN PCWSTR pszFilterClass);
  64. CFilterDevice*
  65. PFindFilterDeviceByAdapterAndFilter (
  66. IN const CComponent* pAdapter,
  67. IN const CComponent* pFilter) const;
  68. CFilterDevice*
  69. PFindFilterDeviceByInstanceGuid (
  70. IN PCWSTR pszInstanceGuid) const;
  71. public:
  72. CFilterDevices (
  73. IN CNetConfigCore* pCore);
  74. ~CFilterDevices ();
  75. HRESULT
  76. HrPrepare ();
  77. VOID
  78. Free ();
  79. VOID
  80. LoadAndRemoveFilterDevicesIfNeeded ();
  81. VOID
  82. InstallFilterDevicesIfNeeded ();
  83. VOID
  84. SortForWritingBindings ();
  85. VOID
  86. StartFilterDevices ();
  87. };