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.

65 lines
1.9 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() throw()
  16. {
  17. m_hdi = NULL;
  18. m_dwIndex = 0;
  19. InterlockedIncrement(&g_CountLanConnectionEnumerators);
  20. }
  21. ~CLanConnectionManagerEnumConnection() throw();
  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)(IN ULONG celt, OUT INetConnection **rgelt, OUT ULONG *pceltFetched);
  28. STDMETHOD(Skip)(IN ULONG celt);
  29. STDMETHOD(Reset)();
  30. STDMETHOD(Clone)(OUT IEnumNetConnection **ppenum);
  31. private:
  32. //
  33. // Private functions
  34. //
  35. HRESULT HrNextOrSkip(IN ULONG celt,
  36. OUT INetConnection **rgelt,
  37. OUT ULONG *pceltFetched);
  38. HRESULT HrCreateLanConnectionInstance(IN SP_DEVINFO_DATA &deid,
  39. OUT INetConnection **rgelt,
  40. IN ULONG ulEntry);
  41. public:
  42. static HRESULT CreateInstance(IN NETCONMGR_ENUM_FLAGS Flags,
  43. OUT REFIID riid,
  44. OUT TAKEOWNERSHIP LPVOID *ppv);
  45. };
  46. //
  47. // Helper functions
  48. //
  49. BOOL FIsValidNetCfgDevice(IN HKEY hkey) throw();
  50. HRESULT HrIsLanCapableAdapterFromHkey(IN HKEY hkey) throw();
  51. BOOL FIsFunctioning(IN const SP_DEVINFO_DATA * pdeid) throw();