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.

110 lines
4.6 KiB

  1. // Device.h : Declaration of the CDevice
  2. #ifndef __DEVICE_H_
  3. #define __DEVICE_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CDevice
  7. class ATL_NO_VTABLE CDevice :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public IDispatchImpl<IDevice, &IID_IDevice, &LIBID_DEVCON2Lib>,
  10. public IDeviceInternal,
  11. public ISetupClassInternal
  12. {
  13. public:
  14. CComPtr<IDevInfoSet> DevInfoSet;
  15. CComPtr<IDeviceConsole> DeviceConsole;
  16. SP_DEVINFO_DATA DevInfoData;
  17. public:
  18. CDevice()
  19. {
  20. ZeroMemory(&DevInfoData,sizeof(DevInfoData));
  21. }
  22. ~CDevice();
  23. HRESULT Init(IDevInfoSet *pDevInfoSet,LPCWSTR pInstance,IDeviceConsole *pDevCon);
  24. HRESULT Init(IDevInfoSet *pDevInfoSet, PSP_DEVINFO_DATA pData,IDeviceConsole *pDevCon);
  25. DECLARE_PROTECT_FINAL_CONSTRUCT()
  26. BEGIN_COM_MAP(CDevice)
  27. COM_INTERFACE_ENTRY(IDevice)
  28. COM_INTERFACE_ENTRY(IDeviceInternal)
  29. COM_INTERFACE_ENTRY(ISetupClassInternal) // because class can be determined from device
  30. COM_INTERFACE_ENTRY(IDispatch)
  31. END_COM_MAP()
  32. // IDevice
  33. public:
  34. STDMETHOD(get__Machine)(/*[out, retval]*/ BSTR *pVal);
  35. STDMETHOD(get__ClassGuid)(/*[out, retval]*/ GUID *pVal);
  36. STDMETHOD(get_Machine)(/*[out, retval]*/ BSTR *pVal);
  37. STDMETHOD(HasInterface)(/*[in]*/ BSTR Interface,/*[out,retval]*/ VARIANT_BOOL *pFlag);
  38. STDMETHOD(FindDriverPackages)(/*[in]*/VARIANT ScriptPath,/*[out,retval]*/ LPDISPATCH *pDrivers);
  39. STDMETHOD(CurrentDriverPackage)(/*[out,retval]*/ LPDISPATCH *pDriver);
  40. STDMETHOD(RegDelete)(/*[in]*/ BSTR key);
  41. STDMETHOD(RegWrite)(/*[in]*/ BSTR key,/*[in]*/ VARIANT val,/*[in,optional]*/ VARIANT strType);
  42. STDMETHOD(RegRead)(/*[in]*/ BSTR key,VARIANT * pValue);
  43. STDMETHOD(get_IsRemovable)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  44. STDMETHOD(get_IsDisableable)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  45. STDMETHOD(get_IsRootEnumerated)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  46. STDMETHOD(get_HasPrivateProblem)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  47. STDMETHOD(get_ProblemCode)(/*[out, retval]*/ long *pVal);
  48. STDMETHOD(get_HasProblem)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  49. STDMETHOD(get_IsDisabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  50. STDMETHOD(get_IsRunning)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  51. STDMETHOD(get_CharacteristicsOverride)(/*[out, retval]*/ VARIANT *pVal);
  52. STDMETHOD(put_CharacteristicsOverride)(/*[in]*/ VARIANT newVal);
  53. STDMETHOD(get_ForceExclusive)(/*[out, retval]*/ VARIANT *pVal);
  54. STDMETHOD(put_ForceExclusive)(/*[in]*/ VARIANT newVal);
  55. STDMETHOD(get_DeviceTypeOverride)(/*[out, retval]*/ VARIANT *pVal);
  56. STDMETHOD(put_DeviceTypeOverride)(/*[in]*/ VARIANT newVal);
  57. STDMETHOD(get_Security)(/*[out, retval]*/ VARIANT *pVal);
  58. STDMETHOD(put_Security)(/*[in]*/ VARIANT newVal);
  59. STDMETHOD(get_EnumeratorName)(/*[out, retval]*/ VARIANT *pVal);
  60. STDMETHOD(get_LowerFilters)(/*[out, retval]*/ VARIANT *pVal);
  61. STDMETHOD(put_LowerFilters)(/*[in]*/ VARIANT newVal);
  62. STDMETHOD(get_UpperFilters)(/*[out, retval]*/ VARIANT *pVal);
  63. STDMETHOD(put_UpperFilters)(/*[in]*/ VARIANT newVal);
  64. STDMETHOD(get_LocationInformation)(/*[out, retval]*/ VARIANT *pVal);
  65. STDMETHOD(put_LocationInformation)(/*[in]*/ VARIANT newVal);
  66. STDMETHOD(get_FriendlyName)(/*[out, retval]*/ VARIANT *pVal);
  67. STDMETHOD(put_FriendlyName)(/*[in]*/ VARIANT newVal);
  68. STDMETHOD(get_Manufacturer)(/*[out, retval]*/ VARIANT *pVal);
  69. STDMETHOD(get_Class)(/*[out, retval]*/ VARIANT *pVal);
  70. STDMETHOD(get_ServiceName)(/*[out, retval]*/ VARIANT *pVal);
  71. STDMETHOD(get_CompatibleIds)(/*[out, retval]*/ VARIANT *pVal);
  72. STDMETHOD(put_CompatibleIds)(/*[in]*/ VARIANT newVal);
  73. STDMETHOD(get_HardwareIds)(/*[out, retval]*/ VARIANT *pVal);
  74. STDMETHOD(put_HardwareIds)(/*[in]*/ VARIANT newVal);
  75. STDMETHOD(get_Description)(/*[out, retval]*/ BSTR *pVal);
  76. STDMETHOD(get_RebootRequired)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  77. STDMETHOD(put_RebootRequired)(/*[in]*/ VARIANT_BOOL newVal);
  78. STDMETHOD(Restart)();
  79. STDMETHOD(Stop)();
  80. STDMETHOD(Start)();
  81. STDMETHOD(Disable)();
  82. STDMETHOD(Enable)();
  83. STDMETHOD(Delete)();
  84. //
  85. // helpers
  86. //
  87. HRESULT TranslatePropVal(LPVARIANT var,DWORD * val);
  88. HRESULT CheckNoReboot();
  89. HDEVINFO GetDevInfoSet();
  90. HRESULT SubKeyInfo(LPCWSTR subkey, HKEY *hKey, LPWSTR *pSubKey,LPCWSTR *keyval,BOOL writeable);
  91. BOOL SameAs(CDevice *pOther);
  92. BOOL SameAs(LPWSTR str);
  93. STDMETHOD(get_InstanceId)(/*[out, retval]*/ BSTR *pVal);
  94. HRESULT GetRemoteMachine(HANDLE *hMachine);
  95. HRESULT PutDevicePropertyMultiSz(DWORD prop,VARIANT *pVal);
  96. HRESULT PutDevicePropertyDword(DWORD prop,VARIANT *pVal);
  97. HRESULT PutDevicePropertyString(DWORD prop,VARIANT *pVal);
  98. HRESULT GetDeviceProperty(DWORD prop,VARIANT *pVal);
  99. };
  100. #endif //__DEVICE_H_