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.

64 lines
1.7 KiB

  1. #pragma once
  2. #include "nmbase.h"
  3. #include "nmres.h"
  4. extern LONG g_CountLanConnectionEnumerators;
  5. class ATL_NO_VTABLE CLanConnectionManagerEnumConnection :
  6. public CComObjectRootEx <CComMultiThreadModel>,
  7. public CComCoClass <CLanConnectionManagerEnumConnection,
  8. &CLSID_LanConnectionManagerEnumConnection>,
  9. public IEnumNetConnection
  10. {
  11. private:
  12. HDEVINFO m_hdi;
  13. DWORD m_dwIndex;
  14. public:
  15. CLanConnectionManagerEnumConnection()
  16. {
  17. m_hdi = NULL;
  18. m_dwIndex = 0;
  19. InterlockedIncrement(&g_CountLanConnectionEnumerators);
  20. }
  21. ~CLanConnectionManagerEnumConnection();
  22. DECLARE_REGISTRY_RESOURCEID(IDR_LAN_CONMAN_ENUM)
  23. BEGIN_COM_MAP(CLanConnectionManagerEnumConnection)
  24. COM_INTERFACE_ENTRY(IEnumNetConnection)
  25. END_COM_MAP()
  26. // IEnumNetConnection
  27. STDMETHOD(Next)(ULONG celt, INetConnection **rgelt, ULONG *pceltFetched);
  28. STDMETHOD(Skip)(ULONG celt);
  29. STDMETHOD(Reset)();
  30. STDMETHOD(Clone)(IEnumNetConnection **ppenum);
  31. private:
  32. //
  33. // Private functions
  34. //
  35. HRESULT HrNextOrSkip(ULONG celt, INetConnection **rgelt,
  36. ULONG *pceltFetched);
  37. HRESULT HrCreateLanConnectionInstance(SP_DEVINFO_DATA &deid,
  38. INetConnection **rgelt,
  39. ULONG ulEntry);
  40. public:
  41. static HRESULT CreateInstance(NETCONMGR_ENUM_FLAGS Flags,
  42. REFIID riid,
  43. LPVOID *ppv);
  44. };
  45. //
  46. // Helper functions
  47. //
  48. BOOL FIsValidNetCfgDevice(HKEY hkey);
  49. HRESULT HrIsLanCapableAdapterFromHkey(HKEY hkey);
  50. BOOL FIsFunctioning(SP_DEVINFO_DATA * pdeid);