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.

150 lines
5.2 KiB

  1. //==============================================================;
  2. //
  3. // This source code is only intended as a supplement to existing Microsoft documentation.
  4. //
  5. //
  6. //
  7. //
  8. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  9. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  10. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  11. // PURPOSE.
  12. //
  13. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  14. //
  15. //
  16. //
  17. //==============================================================;
  18. #ifndef _SAMPDATAOBJECT_H_
  19. #define _SAMPDATAOBJECT_H_
  20. #include <mmc.h>
  21. #include "DeleBase.h"
  22. #define ADD_TYPE(Data, Type, pPos) *((Type*)pPos) = (Type)(Data); \
  23. pPos += sizeof(Type)
  24. #define ADD_BOOL(bo, pPos) ADD_TYPE(bo, BOOL, pPos)
  25. #define ADD_USHORT(us, pPos) ADD_TYPE(us, USHORT, pPos)
  26. #define ADD_ULONG(ul, pPos) ADD_TYPE(ul, ULONG, pPos)
  27. #define ADD_STRING(str, strLength, pPos) \
  28. strLength = wcslen((LPWSTR)(str)) + 1; \
  29. ADD_USHORT(strLength, pPos); \
  30. wcsncpy((LPWSTR)pPos, (LPWSTR)(str), strLength); \
  31. pPos += (strLength * sizeof(WCHAR))
  32. #define ELT_SYSTEM 101
  33. #define ELT_SECURITY 102
  34. #define ELT_APPLICATION 103
  35. #define ELT_CUSTOM 104
  36. #define VIEWINFO_BACKUP 0x0001
  37. #define VIEWINFO_FILTERED 0x0002
  38. #define VIEWINFO_LOW_SPEED 0x0004
  39. #define VIEWINFO_USER_CREATED 0x0008
  40. #define VIEWINFO_ALLOW_DELETE 0x0100
  41. #define VIEWINFO_DISABLED 0x0200
  42. #define VIEWINFO_READ_ONLY 0x0400
  43. #define VIEWINFO_DONT_PERSIST 0x0800
  44. #define VIEWINFO_CUSTOM ( VIEWINFO_FILTERED | VIEWINFO_DONT_PERSIST | \
  45. VIEWINFO_ALLOW_DELETE | VIEWINFO_USER_CREATED)
  46. #define EV_ALL_ERRORS (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | \
  47. EVENTLOG_INFORMATION_TYPE | EVENTLOG_AUDIT_SUCCESS | \
  48. EVENTLOG_AUDIT_FAILURE)
  49. class CDataObject : public IDataObject
  50. {
  51. private:
  52. ULONG m_cref;
  53. MMC_COOKIE m_lCookie;
  54. DATA_OBJECT_TYPES m_context;
  55. public:
  56. CDataObject(MMC_COOKIE cookie, DATA_OBJECT_TYPES context);
  57. ~CDataObject();
  58. ///////////////////////////////
  59. // Interface IUnknown
  60. ///////////////////////////////
  61. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv);
  62. STDMETHODIMP_(ULONG) AddRef();
  63. STDMETHODIMP_(ULONG) Release();
  64. ///////////////////////////////
  65. // IDataObject methods
  66. ///////////////////////////////
  67. STDMETHODIMP GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium);
  68. STDMETHODIMP GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  69. // The rest are not implemented
  70. STDMETHODIMP EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc)
  71. { return E_NOTIMPL; };
  72. STDMETHODIMP QueryGetData (LPFORMATETC lpFormatetc)
  73. { return E_NOTIMPL; };
  74. STDMETHODIMP GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
  75. { return E_NOTIMPL; };
  76. STDMETHODIMP SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
  77. { return E_NOTIMPL; };
  78. STDMETHODIMP DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
  79. { return E_NOTIMPL; };
  80. STDMETHODIMP DUnadvise (DWORD dwConnection)
  81. { return E_NOTIMPL; };
  82. STDMETHODIMP EnumDAdvise (LPENUMSTATDATA* ppEnumAdvise)
  83. { return E_NOTIMPL; };
  84. ///////////////////////////////
  85. // Custom Methods
  86. ///////////////////////////////
  87. CDelegationBase *GetBaseNodeObject() {
  88. return (CDelegationBase *)m_lCookie;
  89. }
  90. DATA_OBJECT_TYPES GetContext() {
  91. return m_context;
  92. }
  93. // Private support methods
  94. private:
  95. // HRESULT RetrieveNodeTypeGuid( IStream* pStream );
  96. // HRESULT RetrieveSnapInClassID( IStream* pStream );
  97. // HRESULT RetrieveDisplayString( IStream* pStream );
  98. // HRESULT RetrieveGuidString( IStream* pStream );
  99. // HRESULT RetrieveThisPointer( IStream* pStream );
  100. // HRESULT RetrieveMachineName( IStream* pStream );
  101. HRESULT RetrieveEventViews( LPSTGMEDIUM pStgMedium );
  102. public:
  103. // clipboard formats
  104. static UINT s_cfSZNodeType;
  105. static UINT s_cfDisplayName;
  106. static UINT s_cfNodeType;
  107. static UINT s_cfSnapinClsid;
  108. static UINT s_cfInternal;
  109. // clipboard formats required by Event Viewer extension
  110. static UINT s_cfMachineName; //machine name that Event Viewer points to
  111. static UINT s_cfEventViews; // Data needed by Event Viewer
  112. //Add support for the CCF_SNAPIN_PRELOADS clipboard format
  113. static UINT s_cfPreload;
  114. };
  115. HRESULT ExtractFromDataObject(IDataObject *lpDataObject,UINT cf,ULONG cb,HGLOBAL *phGlobal);
  116. CDataObject* GetOurDataObject(IDataObject *lpDataObject);
  117. BOOL IsMMCMultiSelectDataObject(IDataObject *lpDataObject);
  118. #endif _SAMPDATAOBJECT_H_