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.

160 lines
5.0 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // DS Administration MMC snapin.
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1999
  7. //
  8. // File: DataObj.h
  9. //
  10. // Contents: Data Object Functions
  11. //
  12. // Classes: CDSDataObject
  13. //
  14. // History: 02-Oct-96 WayneSc Created
  15. // 06-Feb-97 EricB - added Property Page Data support
  16. //
  17. //--------------------------------------------------------------------------
  18. #ifndef __DATAOBJ_H__
  19. #define __DATAOBJ_H__
  20. #define CFSTR_DS_COMPDATA TEXT("DsCompData")
  21. class CDSComponentData;
  22. //+----------------------------------------------------------------------------
  23. //
  24. // Class: CDSDataObject
  25. //
  26. //-----------------------------------------------------------------------------
  27. class CDSDataObject : public IDataObject, public CComObjectRoot
  28. {
  29. // ATL Maps
  30. DECLARE_NOT_AGGREGATABLE(CDSDataObject)
  31. BEGIN_COM_MAP(CDSDataObject)
  32. COM_INTERFACE_ENTRY(IDataObject)
  33. END_COM_MAP()
  34. // Construction/Destruction
  35. CDSDataObject() : m_lNotifyHandle(0), m_hwndParentSheet(NULL)
  36. {
  37. m_pDsComponentData = NULL;
  38. m_pDSObjCached = NULL;
  39. m_nDSObjCachedBytes = 0;
  40. m_szUniqueID = _T("");
  41. }
  42. ~CDSDataObject()
  43. {
  44. if (m_internal.m_p_cookies != NULL)
  45. {
  46. ASSERT(m_internal.m_cookie_count > 1);
  47. free(m_internal.m_p_cookies);
  48. }
  49. if (m_pDSObjCached != NULL)
  50. {
  51. ::free(m_pDSObjCached);
  52. }
  53. }
  54. // Standard IDataObject methods
  55. public:
  56. // Implemented
  57. STDMETHOD(GetData)(FORMATETC * pformatetcIn, STGMEDIUM * pmedium);
  58. STDMETHOD(GetDataHere)(FORMATETC * pFormatEtcIn, STGMEDIUM * pMedium);
  59. STDMETHOD(EnumFormatEtc)(DWORD dwDirection,
  60. IEnumFORMATETC ** ppenumFormatEtc);
  61. STDMETHOD(SetData)(FORMATETC * pformatetc, STGMEDIUM * pmedium,
  62. BOOL fRelease);
  63. // Not Implemented
  64. private:
  65. STDMETHOD(QueryGetData)(FORMATETC*) { return E_NOTIMPL; };
  66. STDMETHOD(GetCanonicalFormatEtc)(FORMATETC*, FORMATETC*) { return E_NOTIMPL; };
  67. STDMETHOD(DAdvise)(FORMATETC*, DWORD, IAdviseSink*, DWORD*) { return E_NOTIMPL; };
  68. STDMETHOD(DUnadvise)(DWORD) { return E_NOTIMPL; };
  69. STDMETHOD(EnumDAdvise)(IEnumSTATDATA**) { return E_NOTIMPL; };
  70. public:
  71. // Clipboard formats that are required by the console
  72. static CLIPFORMAT m_cfNodeType;
  73. static CLIPFORMAT m_cfNodeTypeString;
  74. static CLIPFORMAT m_cfDisplayName;
  75. static CLIPFORMAT m_cfCoClass;
  76. static CLIPFORMAT m_cfInternal;
  77. static CLIPFORMAT m_cfMultiSelDataObjs;
  78. static CLIPFORMAT m_cfMultiObjTypes;
  79. static CLIPFORMAT m_cfpMultiSelDataObj;
  80. static CLIPFORMAT m_cfColumnID;
  81. static CLIPFORMAT m_cfPreload;
  82. // Property Page Clipboard formats
  83. static CLIPFORMAT m_cfDsObjectNames;
  84. static CLIPFORMAT m_cfDsDisplaySpecOptions;
  85. static CLIPFORMAT m_cfDsSchemaPath;
  86. static CLIPFORMAT m_cfPropSheetCfg;
  87. static CLIPFORMAT m_cfParentHwnd;
  88. static CLIPFORMAT m_cfMultiSelectProppage;
  89. // Private format for internal communication
  90. static CLIPFORMAT m_cfComponentData;
  91. ULONG InternalAddRef()
  92. {
  93. // ++CSnapin::lDataObjectRefCount;
  94. return CComObjectRoot::InternalAddRef();
  95. }
  96. ULONG InternalRelease()
  97. {
  98. // --CSnapin::lDataObjectRefCount;
  99. return CComObjectRoot::InternalRelease();
  100. }
  101. // Implementation
  102. public:
  103. void SetType(DATA_OBJECT_TYPES type, SnapinType snapintype)
  104. {
  105. ASSERT(m_internal.m_type == CCT_UNINITIALIZED);
  106. m_internal.m_type = type;
  107. m_internal.m_snapintype = snapintype;
  108. }
  109. void SetCookie(CUINode* pUINode) {
  110. m_internal.m_cookie = pUINode;
  111. m_internal.m_cookie_count = 1;
  112. CreateDsObjectNamesCached();
  113. }
  114. void AddCookie(CUINode* pUINode);
  115. void SetString(LPTSTR lpString) { m_internal.m_string = lpString; }
  116. void SetComponentData(CDSComponentData * pCompData)
  117. { m_pDsComponentData = pCompData; }
  118. private:
  119. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  120. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  121. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  122. HRESULT CreateInternal(LPSTGMEDIUM lpMedium);
  123. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  124. HRESULT CreateMultiSelectObject(LPSTGMEDIUM lpMedium);
  125. HRESULT CreateColumnID(LPSTGMEDIUM lpMedium);
  126. LPDSOBJECTNAMES GetDsObjectNames(DWORD& dwCachedBytes);
  127. HRESULT CreateDsObjectNamesCached();
  128. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  129. INTERNAL m_internal;
  130. CDSComponentData * m_pDsComponentData;
  131. LONG_PTR m_lNotifyHandle;
  132. HWND m_hwndParentSheet;
  133. LPDSOBJECTNAMES m_pDSObjCached;
  134. DWORD m_nDSObjCachedBytes;
  135. CString m_szUniqueID;
  136. };
  137. #endif