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.

278 lines
6.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxext.h
  5. Abstract:
  6. Fax exchange client extension header file.
  7. Author:
  8. Wesley Witt (wesw) 13-Aug-1996
  9. Revision History:
  10. 20/10/99 -danl-
  11. Add GetServerNameFromPrinterInfo.
  12. Change GetServerName to GetServerNameFromPrinterName.
  13. dd/mm/yy -author-
  14. description
  15. --*/
  16. #ifndef _FAXEXT_H_
  17. #define _FAXEXT_H_
  18. #include <windows.h>
  19. #include <winspool.h>
  20. #include <mapiwin.h>
  21. #include <mapispi.h>
  22. #include <mapiutil.h>
  23. #include <mapicode.h>
  24. #include <mapival.h>
  25. #include <mapiwz.h>
  26. #include <mapix.h>
  27. #include <mapiutil.h>
  28. #include <mapiform.h>
  29. #include <mapiguid.h>
  30. #include <richedit.h>
  31. #include <shlobj.h>
  32. #include <shellapi.h>
  33. #include <commdlg.h>
  34. #include <exchext.h>
  35. #include <tapi.h>
  36. #include <tchar.h>
  37. #include <stdio.h>
  38. #include <fxsapip.h>
  39. #include "resource.h"
  40. #include "faxmapip.h"
  41. #include "faxreg.h"
  42. #include "faxutil.h"
  43. #define FAXUTIL_DEBUG
  44. #define FAXUTIL_MEM
  45. #define FAXUTIL_STRING
  46. #define FAXUTIL_SUITE
  47. #define FAXUTIL_REG
  48. #include <faxutil.h>
  49. #define MAX_FILENAME_EXT 4
  50. #define SERVER_COVER_PAGE 1
  51. /*
  52. - GetServerNameFromPrinterInfo
  53. -
  54. * Purpose:
  55. * Get the Server name, given a PRINTER_INFO_2 structure
  56. *
  57. * Arguments:
  58. * [in] ppi2 - Address of PRINTER_INFO_2 structure
  59. * [out] lpptszServerName - Address of string pointer for returned name.
  60. *
  61. * Returns:
  62. * BOOL - TRUE: sucess , FALSE: failure.
  63. *
  64. * Remarks:
  65. * This inline function retrieves the server from a printer info structure
  66. * in the appropriate way for win9x and NT.
  67. */
  68. _inline BOOL
  69. GetServerNameFromPrinterInfo(PPRINTER_INFO_2 ppi2,LPTSTR *lpptszServerName)
  70. {
  71. if (!ppi2)
  72. {
  73. return FALSE;
  74. }
  75. #ifndef WIN95
  76. *lpptszServerName = NULL;
  77. if (ppi2->pServerName)
  78. {
  79. if (!(*lpptszServerName = StringDup(_tcsninc(ppi2->pServerName,2))))
  80. {
  81. return FALSE;
  82. }
  83. }
  84. return TRUE;
  85. #else //WIN95
  86. //
  87. // Formatted: \\Server\port
  88. //
  89. if (!(ppi2->pPortName))
  90. {
  91. return FALSE;
  92. }
  93. if (!(*lpptszServerName = StringDup(_tcsninc(ppi2->pPortName,2))))
  94. {
  95. return FALSE;
  96. }
  97. _tcstok(*lpptszServerName,TEXT("\\"));
  98. #endif //WIN95
  99. return TRUE;
  100. }
  101. LPVOID
  102. MapiMemAlloc(
  103. SIZE_T Size
  104. );
  105. LPVOID
  106. MapiMemReAlloc(
  107. LPVOID ptr,
  108. SIZE_T Size
  109. );
  110. VOID
  111. MapiMemFree(
  112. LPVOID ptr
  113. );
  114. INT_PTR CALLBACK
  115. ConfigDlgProc(
  116. HWND hDlg,
  117. UINT message,
  118. WPARAM wParam,
  119. LPARAM lParam
  120. );
  121. PVOID
  122. MyGetPrinter(
  123. LPTSTR PrinterName,
  124. DWORD level
  125. );
  126. BOOL
  127. GetServerNameFromPrinterName(
  128. LPTSTR PrinterName,
  129. LPTSTR *lptszServerName
  130. );
  131. void
  132. ErrorMsgBox(
  133. HINSTANCE hInstance,
  134. HWND hWnd,
  135. DWORD dwMsgId
  136. );
  137. class MyExchExt;
  138. class MyExchExtCommands;
  139. class MyExchExtUserEvents;
  140. extern "C"
  141. {
  142. LPEXCHEXT CALLBACK ExchEntryPoint(void);
  143. }
  144. class MyExchExt : public IExchExt
  145. {
  146. public:
  147. MyExchExt ();
  148. STDMETHODIMP QueryInterface
  149. (REFIID riid,
  150. LPVOID * ppvObj);
  151. inline STDMETHODIMP_(ULONG) AddRef
  152. () { ++m_cRef; return m_cRef; };
  153. inline STDMETHODIMP_(ULONG) Release
  154. () { ULONG ulCount = --m_cRef;
  155. if (!ulCount) { delete this; }
  156. return ulCount;};
  157. STDMETHODIMP Install (LPEXCHEXTCALLBACK pmecb,
  158. ULONG mecontext, ULONG ulFlags);
  159. BOOL IsValid() { return (m_pExchExtUserEvents && m_pExchExtCommands) ? TRUE : FALSE; }
  160. private:
  161. ULONG m_cRef;
  162. UINT m_context;
  163. MyExchExtUserEvents * m_pExchExtUserEvents;
  164. MyExchExtCommands * m_pExchExtCommands;
  165. };
  166. class MyExchExtCommands : public IExchExtCommands
  167. {
  168. public:
  169. MyExchExtCommands();
  170. ~MyExchExtCommands();
  171. STDMETHODIMP QueryInterface
  172. (REFIID riid,
  173. LPVOID * ppvObj);
  174. inline STDMETHODIMP_(ULONG) AddRef();
  175. inline STDMETHODIMP_(ULONG) Release();
  176. STDMETHODIMP InstallCommands(LPEXCHEXTCALLBACK pmecb,
  177. HWND hwnd, HMENU hmenu,
  178. UINT FAR * cmdidBase, LPTBENTRY lptbeArray,
  179. UINT ctbe, ULONG ulFlags);
  180. STDMETHODIMP DoCommand(LPEXCHEXTCALLBACK pmecb, UINT mni);
  181. STDMETHODIMP_(VOID) InitMenu(LPEXCHEXTCALLBACK pmecb);
  182. STDMETHODIMP Help(LPEXCHEXTCALLBACK pmecb, UINT mni);
  183. STDMETHODIMP QueryHelpText(UINT mni, ULONG ulFlags, LPTSTR sz, UINT cch);
  184. STDMETHODIMP QueryButtonInfo(ULONG tbid, UINT itbb, LPTBBUTTON ptbb,
  185. LPTSTR lpsz, UINT cch, ULONG ulFlags);
  186. STDMETHODIMP ResetToolbar(ULONG tbid, ULONG ulFlags);
  187. inline VOID SetContext
  188. (ULONG eecontext) { m_context = eecontext; };
  189. inline UINT GetCmdID() { return m_cmdid; };
  190. inline HWND GetToolbarHWND() { return m_hwndToolbar; }
  191. private:
  192. ULONG m_cRef; //
  193. ULONG m_context; //
  194. UINT m_cmdid; // cmdid for menu extension command
  195. UINT m_itbb; // toolbar index
  196. HWND m_hwndToolbar; // toolbar window handle
  197. UINT m_itbm; //
  198. HWND m_hWnd; //
  199. FAXXP_CONFIG m_FaxConfig;
  200. };
  201. class MyExchExtUserEvents : public IExchExtUserEvents
  202. {
  203. public:
  204. MyExchExtUserEvents() { m_cRef = 0; m_context = 0;
  205. m_pExchExt = NULL; };
  206. STDMETHODIMP QueryInterface
  207. (REFIID riid,
  208. LPVOID * ppvObj);
  209. inline STDMETHODIMP_(ULONG) AddRef
  210. () { ++m_cRef; return m_cRef; };
  211. inline STDMETHODIMP_(ULONG) Release
  212. () { ULONG ulCount = --m_cRef;
  213. if (!ulCount) { delete this; }
  214. return ulCount;};
  215. STDMETHODIMP_(VOID) OnSelectionChange(LPEXCHEXTCALLBACK pmecb);
  216. STDMETHODIMP_(VOID) OnObjectChange(LPEXCHEXTCALLBACK pmecb);
  217. inline VOID SetContext
  218. (ULONG eecontext) { m_context = eecontext; };
  219. inline VOID SetIExchExt
  220. (MyExchExt * pExchExt) { m_pExchExt = pExchExt; };
  221. private:
  222. ULONG m_cRef;
  223. ULONG m_context;
  224. MyExchExt * m_pExchExt;
  225. };
  226. #endif // _FAXEXT_H_