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.

159 lines
4.7 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) 1995-2001 Microsoft Corporation
  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. #include "stdafx.h" // Added by ClassView
  11. class CDataObject : public IDataObject, public CComObjectRoot
  12. {
  13. friend class CSnapin;
  14. // ATL Maps
  15. DECLARE_NOT_AGGREGATABLE(CDataObject)
  16. BEGIN_COM_MAP(CDataObject)
  17. COM_INTERFACE_ENTRY(IDataObject)
  18. END_COM_MAP()
  19. // Construction/Destruction
  20. CDataObject() { m_pSceSvcAttachmentData = NULL;
  21. m_ModeBits = 0;
  22. m_Mode = 0;
  23. m_nInternalArray = 0;
  24. m_pInternalArray = NULL;
  25. m_pGPTInfo = NULL;
  26. m_pRSOPInfo = NULL;
  27. };
  28. virtual ~CDataObject(){
  29. if( m_pInternalArray ){
  30. GlobalFree(m_pInternalArray );
  31. }
  32. };
  33. // Clipboard formats that are required by the console
  34. public:
  35. static UINT m_cfNodeType;
  36. static UINT m_cfNodeTypeString;
  37. static UINT m_cfDisplayName;
  38. static UINT m_cfSnapinClassID;
  39. static UINT m_cfInternal;
  40. static UINT m_cfSceSvcAttachment;
  41. static UINT m_cfSceSvcAttachmentData;
  42. static UINT m_cfModeType;
  43. static UINT m_cfGPTUnknown;
  44. static UINT m_cfRSOPUnknown;
  45. static UINT m_cfMultiSelect;
  46. static UINT m_cfNodeID;
  47. // Standard IDataObject methods
  48. public:
  49. // Implemented
  50. STDMETHOD(GetData)(LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  51. STDMETHOD(GetDataHere)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium);
  52. STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc);
  53. ULONG InternalAddRef()
  54. {
  55. ++CSnapin::lDataObjectRefCount;
  56. return CComObjectRoot::InternalAddRef();
  57. }
  58. ULONG InternalRelease()
  59. {
  60. --CSnapin::lDataObjectRefCount;
  61. return CComObjectRoot::InternalRelease();
  62. }
  63. // Not Implemented
  64. private:
  65. STDMETHOD(QueryGetData)(LPFORMATETC lpFormatetc)
  66. { return E_NOTIMPL; };
  67. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
  68. { return E_NOTIMPL; };
  69. STDMETHOD(SetData)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
  70. { return E_NOTIMPL; };
  71. STDMETHOD(DAdvise)(LPFORMATETC lpFormatetc, DWORD advf,
  72. LPADVISESINK pAdvSink, LPDWORD pdwConnection)
  73. { return E_NOTIMPL; };
  74. STDMETHOD(DUnadvise)(DWORD dwConnection)
  75. { return E_NOTIMPL; };
  76. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA* ppEnumAdvise)
  77. { return E_NOTIMPL; };
  78. // Implementation
  79. public:
  80. void SetModeBits(DWORD mode)
  81. {
  82. m_ModeBits = mode;
  83. }
  84. void SetMode(DWORD mode) { m_Mode = mode; }
  85. void SetType(DATA_OBJECT_TYPES type) // Step 3
  86. {
  87. ASSERT(m_internal.m_type == CCT_UNINITIALIZED); //Bogus Assert, yanggao.
  88. m_internal.m_type = type;
  89. }
  90. void SetFolderType(FOLDER_TYPES foldertype)
  91. {
  92. m_internal.m_foldertype = foldertype;
  93. }
  94. void SetCookie(MMC_COOKIE cookie)
  95. {
  96. m_internal.m_cookie = cookie;
  97. } // Step 3
  98. void SetClsid(const CLSID& clsid)
  99. {
  100. m_internal.m_clsid = clsid;
  101. }
  102. void SetSceSvcAttachmentData(LPSCESVCATTACHMENTDATA pData)
  103. {
  104. m_pSceSvcAttachmentData = pData;
  105. }
  106. void AddInternal( MMC_COOKIE cookie, DATA_OBJECT_TYPES type);
  107. void SetGPTInfo(LPGPEINFORMATION pGPTInfo)
  108. {
  109. m_pGPTInfo = pGPTInfo;
  110. }
  111. void SetRSOPInfo(LPRSOPINFORMATION pRSOPInfo)
  112. {
  113. m_pRSOPInfo = pRSOPInfo;
  114. }
  115. private:
  116. HRESULT CreateSvcAttachmentData(LPSTGMEDIUM lpMedium);
  117. HRESULT CreateSvcAttachment(LPSTGMEDIUM lpMedium);
  118. HRESULT CreateNodeId(LPSTGMEDIUM lpMedium);
  119. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  120. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  121. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  122. HRESULT CreateSnapinClassID(LPSTGMEDIUM lpMedium);
  123. HRESULT CreateInternal(LPSTGMEDIUM lpMedium); // Step 3
  124. HRESULT CreateModeType(LPSTGMEDIUM lpMedium);
  125. HRESULT CreateGPTUnknown(LPSTGMEDIUM lpMedium);
  126. HRESULT CreateRSOPUnknown(LPSTGMEDIUM lpMedium);
  127. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  128. INTERNAL m_internal; // Step 3
  129. INTERNAL *m_pInternalArray;
  130. int m_nInternalArray;
  131. LPSCESVCATTACHMENTDATA m_pSceSvcAttachmentData;
  132. DWORD m_ModeBits;
  133. DWORD m_Mode;
  134. LPGPEINFORMATION m_pGPTInfo;
  135. LPRSOPINFORMATION m_pRSOPInfo;
  136. };
  137. #endif