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.

62 lines
1.5 KiB

  1. // Devices.h : Declaration of the CDevices
  2. #ifndef __DEVICES_H_
  3. #define __DEVICES_H_
  4. #include "resource.h" // main symbols
  5. class CDevice;
  6. /////////////////////////////////////////////////////////////////////////////
  7. // CDevices
  8. class ATL_NO_VTABLE CDevices :
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CDevices, &CLSID_Devices>,
  11. public IDispatchImpl<IDevices, &IID_IDevices, &LIBID_DEVCON2Lib>
  12. {
  13. public:
  14. CComPtr<IDevInfoSet> DevInfoSet;
  15. CComPtr<IDeviceConsole> DeviceConsole;
  16. CDevice **pDevices;
  17. ULONG ArraySize;
  18. ULONG Count;
  19. public:
  20. CDevices()
  21. {
  22. pDevices = NULL;
  23. ArraySize = 0;
  24. Count = 0;
  25. }
  26. ~CDevices();
  27. DECLARE_REGISTRY_RESOURCEID(IDR_DEVICES)
  28. DECLARE_PROTECT_FINAL_CONSTRUCT()
  29. BEGIN_COM_MAP(CDevices)
  30. COM_INTERFACE_ENTRY(IDevices)
  31. COM_INTERFACE_ENTRY(IDispatch)
  32. END_COM_MAP()
  33. // IDevices
  34. public:
  35. STDMETHOD(get_Machine)(/*[out, retval]*/ BSTR *pVal);
  36. STDMETHOD(CreateRootDevice)(/*[in]*/ VARIANT hwid,/*[out,retval]*/ LPDISPATCH *pDispatch);
  37. STDMETHOD(Remove)(/*[in]*/ VARIANT Index);
  38. STDMETHOD(Add)(/*[in]*/ VARIANT InstanceIds);
  39. STDMETHOD(get__NewEnum)(/*[out, retval]*/ IUnknown** ppUnk);
  40. STDMETHOD(Item)(/*[in]*/ long Index,/*[out, retval]*/ LPDISPATCH * ppVal);
  41. STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal);
  42. //
  43. // helpers
  44. //
  45. HRESULT InternalAdd(LPCWSTR InstanceId);
  46. BOOL IncreaseArraySize(DWORD add);
  47. void Reset();
  48. HRESULT Init(HDEVINFO hDevInfo,IDeviceConsole *pDevCon);
  49. HRESULT GetIndex(LPVARIANT Index,DWORD * pAt);
  50. HDEVINFO GetDevInfoSet();
  51. };
  52. #endif //__DEVICES_H_