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.

212 lines
6.4 KiB

  1. #ifndef __ROUTINGMETHODCONFIG_H_
  2. #define __ROUTINGMETHODCONFIG_H_
  3. #include "resource.h"
  4. //#include <atlsnap.h>
  5. #include "..\..\inc\atlsnap.h"
  6. #include "cVerNum.h"
  7. #include <atlapp.h>
  8. #include <atlctrls.h>
  9. #include <faxmmc.h>
  10. #include <faxutil.h>
  11. #include <fxsapip.h>
  12. class CRoutingMethodConfigExtData : public CSnapInItemImpl<CRoutingMethodConfigExtData, TRUE>
  13. {
  14. public:
  15. static const GUID* m_NODETYPE;
  16. static const OLECHAR* m_SZNODETYPE;
  17. static const OLECHAR* m_SZDISPLAY_NAME;
  18. static const CLSID* m_SNAPIN_CLASSID;
  19. CLIPFORMAT m_CCF_METHOD_GUID;
  20. CLIPFORMAT m_CCF_SERVER_NAME;
  21. CLIPFORMAT m_CCF_DEVICE_ID;
  22. CRoutingMethodConfigExtData()
  23. {
  24. memset(&m_scopeDataItem, 0, sizeof(SCOPEDATAITEM));
  25. memset(&m_resultDataItem, 0, sizeof(RESULTDATAITEM));
  26. m_CCF_METHOD_GUID = 0;
  27. m_CCF_SERVER_NAME = 0;
  28. m_CCF_DEVICE_ID = 0;
  29. }
  30. ~CRoutingMethodConfigExtData()
  31. {
  32. }
  33. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider,
  34. LONG_PTR handle,
  35. IUnknown* pUnk,
  36. DATA_OBJECT_TYPES type);
  37. STDMETHOD(QueryPagesFor)(DATA_OBJECT_TYPES type);
  38. IDataObject* m_pDataObject;
  39. virtual void InitDataClass(IDataObject* pDataObject, CSnapInItem* pDefault)
  40. {
  41. DEBUG_FUNCTION_NAME(TEXT("CRoutingMethodConfigExtData::InitDataClass"));
  42. m_pDataObject = pDataObject;
  43. // The default code stores off the pointer to the Dataobject the class is wrapping
  44. // at the time.
  45. // Alternatively you could convert the dataobject to the internal format
  46. // it represents and store that information
  47. //
  48. // Register clipboard formats if they are not registered yet
  49. if (!m_CCF_METHOD_GUID)
  50. {
  51. m_CCF_METHOD_GUID = (CLIPFORMAT) RegisterClipboardFormat(CF_MSFAXSRV_ROUTING_METHOD_GUID);
  52. if (!m_CCF_METHOD_GUID)
  53. {
  54. DebugPrintEx(
  55. DEBUG_ERR,
  56. TEXT("Failed to registet clipformat : %s (ec: %ld)"),
  57. CF_MSFAXSRV_ROUTING_METHOD_GUID,
  58. GetLastError());
  59. }
  60. }
  61. if (!m_CCF_SERVER_NAME)
  62. {
  63. m_CCF_SERVER_NAME = (CLIPFORMAT) RegisterClipboardFormat(CF_MSFAXSRV_SERVER_NAME);
  64. if (!m_CCF_SERVER_NAME)
  65. {
  66. DebugPrintEx(
  67. DEBUG_ERR,
  68. TEXT("Failed to registet clipformat : %s (ec: %ld)"),
  69. CF_MSFAXSRV_SERVER_NAME,
  70. GetLastError());
  71. }
  72. }
  73. if (!m_CCF_DEVICE_ID)
  74. {
  75. m_CCF_DEVICE_ID = (CLIPFORMAT) RegisterClipboardFormat(CF_MSFAXSRV_DEVICE_ID);
  76. if (!m_CCF_DEVICE_ID)
  77. {
  78. DebugPrintEx(
  79. DEBUG_ERR,
  80. TEXT("Failed to registet clipformat : %s (ec: %ld)"),
  81. CF_MSFAXSRV_DEVICE_ID,
  82. GetLastError());
  83. }
  84. }
  85. }
  86. CSnapInItem* GetExtNodeObject(IDataObject* pDataObject, CSnapInItem* pDefault)
  87. {
  88. // Modify to return a different CSnapInItem* pointer.
  89. return pDefault;
  90. }
  91. };
  92. class CRoutingMethodConfig : public CComObjectRootEx<CComSingleThreadModel>,
  93. public CSnapInObjectRoot<0, CRoutingMethodConfig>,
  94. public IExtendPropertySheetImpl<CRoutingMethodConfig>,
  95. public CComCoClass<CRoutingMethodConfig, &CLSID_RoutingMethodConfig>
  96. {
  97. public:
  98. CRoutingMethodConfig()
  99. {
  100. m_pComponentData = this;
  101. }
  102. EXTENSION_SNAPIN_DATACLASS(CRoutingMethodConfigExtData)
  103. BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CRoutingMethodConfig)
  104. EXTENSION_SNAPIN_NODEINFO_ENTRY(CRoutingMethodConfigExtData)
  105. END_EXTENSION_SNAPIN_NODEINFO_MAP()
  106. BEGIN_COM_MAP(CRoutingMethodConfig)
  107. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  108. END_COM_MAP()
  109. DECLARE_REGISTRY_RESOURCEID(IDR_ROUTINGMETHODCONFIG)
  110. DECLARE_NOT_AGGREGATABLE(CRoutingMethodConfig)
  111. static void WINAPI ObjectMain(bool bStarting)
  112. {
  113. if (bStarting)
  114. CSnapInItem::Init();
  115. }
  116. };
  117. class ATL_NO_VTABLE CRoutingMethodConfigAbout : public ISnapinAbout,
  118. public CComObjectRoot,
  119. public CComCoClass< CRoutingMethodConfigAbout, &CLSID_RoutingMethodConfigAbout>
  120. {
  121. public:
  122. DECLARE_REGISTRY(CRoutingMethodConfigAbout, _T("RoutingMethodConfigAbout.1"), _T("RoutingMethodConfigAbout.1"), IDS_ROUTINGMETHODCONFIG_DESC, THREADFLAGS_BOTH);
  123. BEGIN_COM_MAP(CRoutingMethodConfigAbout)
  124. COM_INTERFACE_ENTRY(ISnapinAbout)
  125. END_COM_MAP()
  126. STDMETHOD(GetSnapinDescription)(LPOLESTR *lpDescription)
  127. {
  128. USES_CONVERSION;
  129. TCHAR szBuf[256];
  130. if (::LoadString(_Module.GetResourceInstance(), IDS_ROUTINGMETHODCONFIG_DESC, szBuf, 256) == 0)
  131. return E_FAIL;
  132. *lpDescription = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(OLECHAR));
  133. if (*lpDescription == NULL)
  134. return E_OUTOFMEMORY;
  135. ocscpy(*lpDescription, T2OLE(szBuf));
  136. return S_OK;
  137. }
  138. STDMETHOD(GetProvider)(LPOLESTR *lpName)
  139. {
  140. USES_CONVERSION;
  141. TCHAR szBuf[256];
  142. if (::LoadString(_Module.GetResourceInstance(), IDS_ROUTINGMETHODCONFIG_PROVIDER, szBuf, 256) == 0)
  143. return E_FAIL;
  144. *lpName = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(OLECHAR));
  145. if (*lpName == NULL)
  146. return E_OUTOFMEMORY;
  147. ocscpy(*lpName, T2OLE(szBuf));
  148. return S_OK;
  149. }
  150. STDMETHOD(GetSnapinVersion)(LPOLESTR *lpVersion)
  151. {
  152. USES_CONVERSION;
  153. TCHAR szBuf[256];
  154. swprintf(szBuf, TEXT(" %d.%d.%d"), rmj, rmm, rup);
  155. *lpVersion = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(OLECHAR));
  156. if (*lpVersion == NULL)
  157. return E_OUTOFMEMORY;
  158. ocscpy(*lpVersion, T2OLE(szBuf));
  159. return S_OK;
  160. }
  161. STDMETHOD(GetSnapinImage)(HICON *hAppIcon)
  162. {
  163. *hAppIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_SNAPIN));
  164. return S_OK;
  165. }
  166. STDMETHOD(GetStaticFolderImage)(HBITMAP *hSmallImage,
  167. HBITMAP *hSmallImageOpen,
  168. HBITMAP *hLargeImage,
  169. COLORREF *cMask)
  170. {
  171. *hSmallImageOpen = *hLargeImage = *hLargeImage = 0;
  172. return S_OK;
  173. }
  174. };
  175. #endif