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.

148 lines
5.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: R E G I S T R A R . H
  7. //
  8. // Contents: Top level device host object
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 12 Sep 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "uhres.h" // main symbols
  17. #include "upnphost.h"
  18. #include "hostp.h"
  19. #include "UString.h"
  20. #include "DeviceManager.h"
  21. #include "ProviderManager.h"
  22. // Typedefs
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CRegistrar
  25. class ATL_NO_VTABLE CRegistrar :
  26. public CComObjectRootEx<CComMultiThreadModel>,
  27. public CComCoClass<CRegistrar, &CLSID_UPnPRegistrar>,
  28. public IUPnPRegistrarLookup,
  29. public IUPnPRegistrarPrivate,
  30. public IUPnPRegistrar,
  31. public IUPnPReregistrar,
  32. public ISupportErrorInfo,
  33. public IUPnPRegistrarICSSupport
  34. {
  35. public:
  36. CRegistrar();
  37. ~CRegistrar();
  38. DECLARE_CLASSFACTORY_SINGLETON(CRegistrar)
  39. DECLARE_REGISTRY_RESOURCEID(IDR_REGISTRAR)
  40. DECLARE_NOT_AGGREGATABLE(CRegistrar)
  41. BEGIN_COM_MAP(CRegistrar)
  42. COM_INTERFACE_ENTRY(IUPnPRegistrarLookup)
  43. COM_INTERFACE_ENTRY(IUPnPRegistrarPrivate)
  44. COM_INTERFACE_ENTRY(IUPnPRegistrar)
  45. COM_INTERFACE_ENTRY(IUPnPReregistrar)
  46. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  47. COM_INTERFACE_ENTRY(IUPnPRegistrarICSSupport)
  48. END_COM_MAP()
  49. public:
  50. // ISupportErrorInfo methods
  51. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  52. // IUPnPRegistrarLookup methods
  53. STDMETHOD(GetEventingManager)(
  54. /*[in, string]*/ const wchar_t * szUDN,
  55. /*[in, string]*/ const wchar_t * szServiceId,
  56. /*[out]*/ IUPnPEventingManager ** ppEventingManager);
  57. STDMETHOD(GetAutomationProxy)(
  58. /*[in, string]*/ const wchar_t * szUDN,
  59. /*[in, string]*/ const wchar_t * szServiceId,
  60. /*[out]*/ IUPnPAutomationProxy ** ppAutomationProxy);
  61. // IUPnPRegistrarPrivate methods
  62. STDMETHOD(Initialize)();
  63. STDMETHOD(Shutdown)();
  64. STDMETHOD(GetSCPDText)(
  65. /*[in]*/ REFGUID guidPhysicalDeviceIdentifier,
  66. /*[in, string]*/ const wchar_t * szUDN,
  67. /*[in, string]*/ const wchar_t * szServiceId,
  68. /*[out, string]*/ wchar_t ** pszSCPDText,
  69. /*[out, string]*/ wchar_t ** pszServiceType);
  70. STDMETHOD(GetDescriptionText)(
  71. /*[in]*/ REFGUID guidPhysicalDeviceIdentifier,
  72. /*[out]*/ BSTR * pbstrDescriptionDocument);
  73. // IUPnPRegistrar methods
  74. STDMETHOD(RegisterDevice)(
  75. /*[in]*/ BSTR bstrXMLDesc,
  76. /*[in]*/ BSTR bstrProgIDDeviceControlClass,
  77. /*[in]*/ BSTR bstrInitString,
  78. /*[in]*/ BSTR bstrContainerId,
  79. /*[in]*/ BSTR bstrResourcePath,
  80. /*[in]*/ long nLifeTime,
  81. /*[out, retval]*/ BSTR * pbstrDeviceIdentifier);
  82. STDMETHOD(RegisterRunningDevice)(
  83. /*[in]*/ BSTR bstrXMLDesc,
  84. /*[in]*/ IUnknown * punkDeviceControl,
  85. /*[in]*/ BSTR bstrInitString,
  86. /*[in]*/ BSTR bstrResourcePath,
  87. /*[in]*/ long nLifeTime,
  88. /*[out, retval]*/ BSTR * pbstrDeviceIdentifier);
  89. STDMETHOD(RegisterDeviceProvider)(
  90. /*[in]*/ BSTR bstrProviderName,
  91. /*[in]*/ BSTR bstrProgIDProviderClass,
  92. /*[in]*/ BSTR bstrInitString,
  93. /*[in]*/ BSTR bstrContainerId);
  94. STDMETHOD(GetUniqueDeviceName)(
  95. /*[in]*/ BSTR bstrDeviceIdentifier,
  96. /*[in]*/ BSTR bstrTemplateUDN,
  97. /*[out, retval]*/ BSTR * pbstrUDN);
  98. STDMETHOD(UnregisterDevice)(
  99. /*[in]*/ BSTR bstrDeviceIdentifier,
  100. /*[in]*/ BOOL fPermanent);
  101. STDMETHOD(UnregisterDeviceProvider)(
  102. /*[in]*/ BSTR bstrProviderName);
  103. // IUPnPReregistrar methods
  104. STDMETHOD(ReregisterDevice)(
  105. /*[in]*/ BSTR bstrDeviceIdentifier,
  106. /*[in]*/ BSTR bstrXMLDesc,
  107. /*[in]*/ BSTR bstrProgIDDeviceControlClass,
  108. /*[in]*/ BSTR bstrInitString,
  109. /*[in]*/ BSTR bstrContainerId,
  110. /*[in]*/ BSTR bstrResourcePath,
  111. /*[in]*/ long nLifeTime);
  112. STDMETHOD(ReregisterRunningDevice)(
  113. /*[in]*/ BSTR bstrDeviceIdentifier,
  114. /*[in]*/ BSTR bstrXMLDesc,
  115. /*[in]*/ IUnknown * punkDeviceControl,
  116. /*[in]*/ BSTR bstrInitString,
  117. /*[in]*/ BSTR bstrResourcePath,
  118. /*[in]*/ long nLifeTime);
  119. // IUPnPRegistrarICSSupport methods
  120. STDMETHOD(SetICSInterfaces)(/*[in]*/ long nCount, /*[in, size_is(nCount)]*/ GUID * arPrivateInterfaceGuids);
  121. STDMETHOD(SetICSOff)();
  122. private:
  123. HRESULT HrSetAutoStart();
  124. HRESULT HrUnregisterDeviceByPDI(PhysicalDeviceIdentifier & pdi, BOOL fPermanent);
  125. CDeviceManager m_deviceManager;
  126. CProviderManager m_providerManager;
  127. IUPnPDescriptionManagerPtr m_pDescriptionManager;
  128. IUPnPDevicePersistenceManagerPtr m_pDevicePersistenceManager;
  129. IUPnPValidationManagerPtr m_pValidationManager;
  130. IUPnPContainerManagerPtr m_pContainerManager;
  131. IUPnPDynamicContentSourcePtr m_pDynamicContentSource;
  132. BOOL m_bSetAutoStart;
  133. };