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.

197 lines
5.9 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) Microsoft Corporation, 1995 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. #ifndef _DATAOBJ_H
  9. #define _DATAOBJ_H
  10. const GUID* FolderTypeToNodeGUID(DATA_OBJECT_TYPES type, CFolder* pFolder);
  11. class CDataObject :
  12. public IDataObject,
  13. public CComObjectRoot
  14. {
  15. // ATL Maps
  16. DECLARE_NOT_AGGREGATABLE(CDataObject)
  17. BEGIN_COM_MAP(CDataObject)
  18. COM_INTERFACE_ENTRY(IDataObject)
  19. END_COM_MAP()
  20. // Construction/Destruction
  21. CDataObject();
  22. virtual ~CDataObject()
  23. {
  24. if (m_pComponentData)
  25. {
  26. m_pComponentData->Release();
  27. m_pComponentData = NULL;
  28. }
  29. };
  30. // Clipboard formats that are required by the console
  31. public:
  32. static unsigned int m_cfNodeType; // Required by the console
  33. static unsigned int m_cfNodeID; // per-node column identifiers
  34. static unsigned int m_cfNodeTypeString; // Required by the console
  35. static unsigned int m_cfDisplayName; // Required by the console
  36. static unsigned int m_cfCoClass; // Required by the console
  37. static unsigned int m_cfIsMultiSel; // Required by the console
  38. static unsigned int m_cfObjInMultiSel; // Required by the console
  39. static unsigned int m_cfPreloads; // Required by the console
  40. static unsigned int m_cfInternal; //
  41. static unsigned int m_cfSelectedCA_InstallType; // published information
  42. static unsigned int m_cfSelectedCA_CommonName; // Published information
  43. static unsigned int m_cfSelectedCA_MachineName; // Published information
  44. static unsigned int m_cfSelectedCA_SanitizedName; // Published information
  45. static unsigned int m_cfSelectedCA_Roles; // Published information
  46. // Standard IDataObject methods
  47. public:
  48. // Implemented
  49. STDMETHOD(QueryGetData)(LPFORMATETC lpFormatetc);
  50. STDMETHOD(GetData)(LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  51. STDMETHOD(GetDataHere)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium);
  52. STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc);
  53. // Not Implemented
  54. private:
  55. STDMETHOD(GetCanonicalFormatEtc)(
  56. LPFORMATETC, // lpFormatetcIn
  57. LPFORMATETC /* lpFormatetcOut */ )
  58. {
  59. return E_NOTIMPL;
  60. }
  61. STDMETHOD(SetData)(
  62. LPFORMATETC, // lpFormatetc
  63. LPSTGMEDIUM, // lpMedium
  64. BOOL /* bRelease */ )
  65. {
  66. return E_NOTIMPL;
  67. }
  68. STDMETHOD(DAdvise)(
  69. LPFORMATETC, // lpFormatetc
  70. DWORD, // advf
  71. LPADVISESINK, // pAdvSink
  72. LPDWORD /* pdwConnection */ )
  73. {
  74. return E_NOTIMPL;
  75. }
  76. STDMETHOD(DUnadvise)(
  77. DWORD /* dwConnection */ )
  78. {
  79. return E_NOTIMPL;
  80. };
  81. STDMETHOD(EnumDAdvise)(
  82. LPENUMSTATDATA * /* ppEnumAdvise */ )
  83. {
  84. return E_NOTIMPL;
  85. };
  86. // Implementation
  87. // This is used only as a diagnostic in debug builds to track if
  88. // anyone is hanging on to any data objects that's have been handed out
  89. // Snapins should view context data objects as ephemeral.
  90. public:
  91. void SetComponentData(CComponentDataImpl* pCCD)
  92. {
  93. if (NULL != pCCD)
  94. {
  95. ASSERT(m_pComponentData == NULL);
  96. m_pComponentData = pCCD;
  97. m_pComponentData->AddRef();
  98. }
  99. }
  100. private:
  101. CComponentDataImpl* m_pComponentData;
  102. public:
  103. void SetViewID(
  104. DWORD /* dwView */ )
  105. {
  106. // m_dwViewID = dwView;
  107. }
  108. void SetType(DATA_OBJECT_TYPES type) { ASSERT(m_internal.m_type == CCT_UNINITIALIZED); m_internal.m_type = type; }
  109. void SetCookie(MMC_COOKIE cookie) { m_internal.m_cookie = cookie; }
  110. void SetString(LPTSTR lpString) { m_internal.m_string = lpString; }
  111. void SetClsid(const CLSID& clsid) { m_internal.m_clsid = clsid; }
  112. void SetMultiSelData(SMMCObjectTypes *psGuidObjTypes, UINT cbMultiSelData)
  113. {
  114. // make sure [1] still good enough
  115. ASSERT(cbMultiSelData == sizeof(m_sGuidObjTypes));
  116. if (cbMultiSelData == sizeof(m_sGuidObjTypes))
  117. {
  118. m_cbMultiSelData = cbMultiSelData;
  119. CopyMemory(&m_sGuidObjTypes, psGuidObjTypes, cbMultiSelData);
  120. }
  121. }
  122. void SetMultiSelDobj()
  123. {
  124. m_bMultiSelDobj = TRUE;
  125. }
  126. #ifdef _DEBUG
  127. UINT dbg_refCount;
  128. void AddRefMultiSelDobj()
  129. {
  130. ASSERT(m_bMultiSelDobj == TRUE);
  131. ++dbg_refCount;
  132. }
  133. void ReleaseMultiSelDobj()
  134. {
  135. ASSERT(m_bMultiSelDobj == TRUE);
  136. --dbg_refCount;
  137. }
  138. #endif
  139. private:
  140. HRESULT CreateObjInMultiSel(LPSTGMEDIUM lpMedium);
  141. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  142. HRESULT CreateNodeIDData(LPSTGMEDIUM lpMedium);
  143. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  144. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  145. HRESULT CreateInternal(LPSTGMEDIUM lpMedium);
  146. HRESULT CreateWorkstationName(LPSTGMEDIUM lpMedium);
  147. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  148. HRESULT CreatePreloadsData(LPSTGMEDIUM lpMedium);
  149. HRESULT CreateSelectedCA_InstallType(LPSTGMEDIUM lpMedium);
  150. HRESULT CreateSelectedCA_CommonName(LPSTGMEDIUM lpMedium);
  151. HRESULT CreateSelectedCA_MachineName(LPSTGMEDIUM lpMedium);
  152. HRESULT CreateSelectedCA_SanitizedName(LPSTGMEDIUM lpMedium);
  153. HRESULT CreateSelectedCA_Roles(LPSTGMEDIUM lpMedium);
  154. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  155. HRESULT CreateVariableLen(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  156. private:
  157. INTERNAL m_internal;
  158. SMMCObjectTypes m_sGuidObjTypes; // length[1] good enough for now
  159. UINT m_cbMultiSelData;
  160. BOOL m_bMultiSelDobj;
  161. DWORD m_dwViewID;
  162. };
  163. #endif