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.

84 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000.
  5. //
  6. // File: C O N T A I N E R M A N A G E R . H
  7. //
  8. // Contents: Manages process isolation support for device host.
  9. //
  10. // Notes:
  11. //
  12. // Author: mbend 11 Sep 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "uhres.h" // main symbols
  17. #include "hostp.h"
  18. #include "UString.h"
  19. #include "Table.h"
  20. #include "RegDef.h"
  21. // Typedefs
  22. struct ContainerInfo
  23. {
  24. IUPnPContainerPtr m_pContainer;
  25. long m_nRefs;
  26. };
  27. inline void TypeTransfer(ContainerInfo & dst, ContainerInfo & src)
  28. {
  29. dst.m_pContainer.Swap(src.m_pContainer);
  30. dst.m_nRefs = src.m_nRefs;
  31. }
  32. inline void TypeClear(ContainerInfo & type)
  33. {
  34. type.m_pContainer.Release();
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CContainerManager
  38. class ATL_NO_VTABLE CContainerManager :
  39. public CComObjectRootEx<CComMultiThreadModel>,
  40. public CComCoClass<CContainerManager, &CLSID_UPnPContainerManager>,
  41. public IUPnPContainerManager
  42. {
  43. public:
  44. CContainerManager();
  45. ~CContainerManager();
  46. DECLARE_CLASSFACTORY_SINGLETON(CContainerManager)
  47. DECLARE_REGISTRY_RESOURCEID(IDR_CONTAINER_MANAGER)
  48. DECLARE_NOT_AGGREGATABLE(CContainerManager)
  49. BEGIN_COM_MAP(CContainerManager)
  50. COM_INTERFACE_ENTRY(IUPnPContainerManager)
  51. END_COM_MAP()
  52. public:
  53. // IUPnPContainerManager methods
  54. STDMETHOD(ReferenceContainer)(
  55. /*[in, string]*/ const wchar_t * szContainer);
  56. STDMETHOD(UnreferenceContainer)(
  57. /*[in, string]*/ const wchar_t * szContainer);
  58. STDMETHOD(CreateInstance)(
  59. /*[in, string]*/ const wchar_t * szContainer,
  60. /*[in]*/ REFCLSID clsid,
  61. /*[in]*/ REFIID riid,
  62. /*[out, iid_is(riid)]*/ void ** ppv);
  63. STDMETHOD(CreateInstanceWithProgId)(
  64. /*[in, string]*/ const wchar_t * szContainer,
  65. /*[in, string]*/ const wchar_t * szProgId,
  66. /*[in]*/ REFIID riid,
  67. /*[out, iid_is(riid)]*/ void ** ppv);
  68. STDMETHOD(Shutdown)();
  69. private:
  70. typedef CTable<CUString, ContainerInfo> ContainerTable;
  71. ContainerTable m_containerTable;
  72. };