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.

216 lines
6.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996
  5. //
  6. // File: DataObj.hxx
  7. //
  8. // Contents: IDataObject (holds title of object)
  9. //
  10. // History: 26-Nov-1996 KyleP Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. //
  15. // Forward declarations
  16. //
  17. class CCatalog;
  18. class CScope;
  19. class CCachedProperty;
  20. class PCIObjectType
  21. {
  22. public:
  23. enum OType
  24. {
  25. RootNode,
  26. Catalog,
  27. Directory,
  28. Property,
  29. Intermediate_Scope,
  30. Intermediate_Properties,
  31. Intermediate_UnfilteredURL
  32. };
  33. virtual OType Type() const = 0;
  34. };
  35. //+-------------------------------------------------------------------------
  36. //
  37. // Class: CCIAdminCF
  38. //
  39. // Purpose: Class factory for MMC snap-in
  40. //
  41. // History: 26-Nov-1996 KyleP Created
  42. //
  43. //--------------------------------------------------------------------------
  44. class CCIAdminDO : public IDataObject
  45. {
  46. public:
  47. //
  48. // IUnknown
  49. //
  50. virtual SCODE STDMETHODCALLTYPE QueryInterface( REFIID riid,
  51. void ** ppvObject);
  52. virtual ULONG STDMETHODCALLTYPE AddRef();
  53. virtual ULONG STDMETHODCALLTYPE Release();
  54. //
  55. // IDataObject
  56. //
  57. SCODE STDMETHODCALLTYPE GetData( FORMATETC * lpFormatetcIn, STGMEDIUM * lpMedium );
  58. SCODE STDMETHODCALLTYPE GetDataHere( FORMATETC * lpFormatetc, STGMEDIUM * lpMedium );
  59. SCODE STDMETHODCALLTYPE EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC ** ppEnumFormatEtc );
  60. SCODE STDMETHODCALLTYPE QueryGetData( FORMATETC * lpFormatetc )
  61. { return E_NOTIMPL; }
  62. SCODE STDMETHODCALLTYPE GetCanonicalFormatEtc( FORMATETC * lpFormatetcIn, FORMATETC * lpFormatetcOut )
  63. { return E_NOTIMPL; }
  64. SCODE STDMETHODCALLTYPE SetData( FORMATETC * lpFormatetc,
  65. STGMEDIUM * lpMedium,
  66. BOOL bRelease )
  67. { return E_NOTIMPL; }
  68. SCODE STDMETHODCALLTYPE DAdvise( FORMATETC * lpFormatetc,
  69. DWORD advf,
  70. IAdviseSink * pAdvSink,
  71. DWORD * pdwConnection)
  72. { return E_NOTIMPL; }
  73. SCODE STDMETHODCALLTYPE DUnadvise( DWORD dwConnection )
  74. { return E_NOTIMPL; }
  75. SCODE STDMETHODCALLTYPE EnumDAdvise( IEnumSTATDATA ** ppEnumAdvise )
  76. { return E_NOTIMPL; }
  77. //
  78. // Local
  79. //
  80. int operator==( CCIAdminDO const & B ) { return ( (_cookie == B._cookie) && (_type == B._type) ); }
  81. MMC_COOKIE Cookie() { return _cookie; }
  82. DATA_OBJECT_TYPES Type() { return _type; }
  83. BOOL IsRoot() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::RootNode; }
  84. BOOL IsStandAloneRoot() { return ( 0 == _cookie ); }
  85. BOOL IsACatalog() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Catalog; }
  86. BOOL IsADirectory() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Directory; }
  87. BOOL IsAProperty() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Property; }
  88. BOOL IsADirectoryIntermediate() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Intermediate_Scope; }
  89. BOOL IsAPropertyIntermediate() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Intermediate_Properties; }
  90. BOOL IsURLIntermediate() { return 0 != _cookie && ((PCIObjectType *)_cookie)->Type() == PCIObjectType::Intermediate_UnfilteredURL; }
  91. CCatalog * GetCatalog();
  92. CScope * GetScope()
  93. {
  94. if ( IsADirectory() )
  95. return (CScope *)_cookie;
  96. else
  97. return 0;
  98. }
  99. CCachedProperty * GetProperty()
  100. {
  101. if ( IsAProperty() )
  102. return (CCachedProperty *)_cookie;
  103. else
  104. return 0;
  105. }
  106. static unsigned int GetMachineNameCF() { return _cfMachineName; }
  107. WCHAR const * GetMachineName() { return _pwcsMachine; }
  108. private:
  109. friend class CCISnapinData;
  110. friend class CCISnapin;
  111. CCIAdminDO( MMC_COOKIE cookie, DATA_OBJECT_TYPES type, WCHAR const * pwcsMachine );
  112. virtual ~CCIAdminDO();
  113. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  114. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  115. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  116. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  117. HRESULT CreateInternal(LPSTGMEDIUM lpMedium);
  118. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  119. static unsigned int _cfNodeType; // Clipboard format
  120. static unsigned int _cfNodeTypeString; // " "
  121. static unsigned int _cfDisplayName; // " "
  122. static unsigned int _cfClassId; // " "
  123. static unsigned int _cfInternal; // our internal format
  124. static unsigned int _cfMachineName; // machine name
  125. MMC_COOKIE _cookie; // Cookie
  126. DATA_OBJECT_TYPES _type; // Type (scope, result, ...)
  127. long _uRefs; // Refcount
  128. WCHAR const * _pwcsMachine; // Machine name
  129. };
  130. //+-------------------------------------------------------------------------
  131. //
  132. // Class: CIntermediate
  133. //
  134. // Purpose: Static node for either 'directories' or 'properties'
  135. //
  136. // History: 27-Nov-1996 KyleP Created
  137. //
  138. //--------------------------------------------------------------------------
  139. class CIntermediate : public PCIObjectType
  140. {
  141. public:
  142. CIntermediate( CCatalog & cat, PCIObjectType::OType dwType )
  143. : _dwType( dwType ),
  144. _cat( cat )
  145. {
  146. }
  147. //
  148. // Typing
  149. //
  150. PCIObjectType::OType Type() const
  151. {
  152. return _dwType;
  153. }
  154. //
  155. // Access
  156. //
  157. CCatalog & GetCatalog() { return _cat; }
  158. private:
  159. PCIObjectType::OType _dwType;
  160. CCatalog & _cat;
  161. };