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.

163 lines
4.4 KiB

  1. #ifndef __SNAPEXT_H_
  2. #define __SNAPEXT_H_
  3. #include "resource.h"
  4. #include <atlsnap.h>
  5. #include "vssprop.h"
  6. class CVSSUIExtData1 : public CSnapInItemImpl<CVSSUIExtData1, TRUE>
  7. {
  8. public:
  9. static const GUID* m_NODETYPE;
  10. static const OLECHAR* m_SZNODETYPE;
  11. static const OLECHAR* m_SZDISPLAY_NAME;
  12. static const CLSID* m_SNAPIN_CLASSID;
  13. BEGIN_SNAPINCOMMAND_MAP(CVSSUIExtData1, FALSE)
  14. END_SNAPINCOMMAND_MAP()
  15. // SNAPINMENUID(IDR_VSSUI_MENU)
  16. CVSSUIExtData1()
  17. {
  18. memset(&m_scopeDataItem, 0, sizeof(SCOPEDATAITEM));
  19. memset(&m_resultDataItem, 0, sizeof(RESULTDATAITEM));
  20. }
  21. ~CVSSUIExtData1()
  22. {
  23. }
  24. IDataObject* m_pDataObject;
  25. virtual void InitDataClass(IDataObject* pDataObject, CSnapInItem* pDefault)
  26. {
  27. m_pDataObject = pDataObject;
  28. // The default code stores off the pointer to the Dataobject the class is wrapping
  29. // at the time.
  30. // Alternatively you could convert the dataobject to the internal format
  31. // it represents and store that information
  32. }
  33. CSnapInItem* GetExtNodeObject(IDataObject* pDataObject, CSnapInItem* pDefault)
  34. {
  35. // Modify to return a different CSnapInItem* pointer.
  36. return pDefault;
  37. }
  38. };
  39. class CVSSUIExtData2 : public CSnapInItemImpl<CVSSUIExtData2, TRUE>
  40. {
  41. public:
  42. static const GUID* m_NODETYPE;
  43. static const OLECHAR* m_SZNODETYPE;
  44. static const OLECHAR* m_SZDISPLAY_NAME;
  45. static const CLSID* m_SNAPIN_CLASSID;
  46. BEGIN_SNAPINCOMMAND_MAP(CVSSUIExtData2, FALSE)
  47. END_SNAPINCOMMAND_MAP()
  48. // SNAPINMENUID(IDR_VSSUI_MENU) // use the same context menu
  49. CVSSUIExtData2()
  50. {
  51. memset(&m_scopeDataItem, 0, sizeof(SCOPEDATAITEM));
  52. memset(&m_resultDataItem, 0, sizeof(RESULTDATAITEM));
  53. }
  54. ~CVSSUIExtData2()
  55. {
  56. }
  57. IDataObject* m_pDataObject;
  58. virtual void InitDataClass(IDataObject* pDataObject, CSnapInItem* pDefault)
  59. {
  60. m_pDataObject = pDataObject;
  61. // The default code stores off the pointer to the Dataobject the class is wrapping
  62. // at the time.
  63. // Alternatively you could convert the dataobject to the internal format
  64. // it represents and store that information
  65. }
  66. CSnapInItem* GetExtNodeObject(IDataObject* pDataObject, CSnapInItem* pDefault)
  67. {
  68. // Modify to return a different CSnapInItem* pointer.
  69. return pDefault;
  70. }
  71. };
  72. class CVSSUI :
  73. public CComObjectRootEx<CComSingleThreadModel>,
  74. public CSnapInObjectRoot<0, CVSSUI>,
  75. public IExtendContextMenuImpl<CVSSUI>,
  76. // public IExtendPropertySheetImpl<CVSSUI>,
  77. public CComCoClass<CVSSUI, &CLSID_VSSUI>
  78. {
  79. public:
  80. CVSSUI();
  81. ~CVSSUI();
  82. EXTENSION_SNAPIN_DATACLASS(CVSSUIExtData1)
  83. EXTENSION_SNAPIN_DATACLASS(CVSSUIExtData2)
  84. BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CVSSUI)
  85. EXTENSION_SNAPIN_NODEINFO_ENTRY(CVSSUIExtData1)
  86. EXTENSION_SNAPIN_NODEINFO_ENTRY(CVSSUIExtData2)
  87. END_EXTENSION_SNAPIN_NODEINFO_MAP()
  88. BEGIN_COM_MAP(CVSSUI)
  89. COM_INTERFACE_ENTRY(IExtendContextMenu)
  90. // COM_INTERFACE_ENTRY(IExtendPropertySheet)
  91. END_COM_MAP()
  92. DECLARE_REGISTRY_RESOURCEID(IDR_VSSUI)
  93. DECLARE_NOT_AGGREGATABLE(CVSSUI)
  94. static void WINAPI ObjectMain(bool bStarting)
  95. {
  96. if (bStarting)
  97. CSnapInItem::Init();
  98. }
  99. ///////////////////////////////
  100. // Interface IExtendContextMenu
  101. ///////////////////////////////
  102. //
  103. // overwrite AddMenuItems() such that we only add the menu item
  104. // when targeted machine belongs to postW2K server SKUs.
  105. //
  106. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddMenuItems(
  107. /* [in] */ LPDATAOBJECT piDataObject,
  108. /* [in] */ LPCONTEXTMENUCALLBACK piCallback,
  109. /* [out][in] */ long *pInsertionAllowed);
  110. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Command(
  111. /* [in] */ long lCommandID,
  112. /* [in] */ LPDATAOBJECT piDataObject);
  113. ///////////////////////////////
  114. // Interface IExtendPropertySheet
  115. ///////////////////////////////
  116. // virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CreatePropertyPages(
  117. // /* [in] */ LPPROPERTYSHEETCALLBACK lpProvider,
  118. // /* [in] */ LONG_PTR handle,
  119. // /* [in] */ LPDATAOBJECT lpIDataObject);
  120. // virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryPagesFor(
  121. // /* [in] */ LPDATAOBJECT lpDataObject) { return S_OK; }
  122. HRESULT InvokePropSheet(LPDATAOBJECT piDataObject);
  123. private:
  124. CVSSProp* m_pPage;
  125. };
  126. HRESULT ExtractData(
  127. IDataObject* piDataObject,
  128. CLIPFORMAT cfClipFormat,
  129. BYTE* pbData,
  130. DWORD cbData
  131. );
  132. #endif