Source code of Windows XP (NT5)
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.

309 lines
9.2 KiB

  1. //****************************************************************************
  2. // WOW fax support. Common file. Conditionally shared between wow16, wow32,
  3. // wowfax and wowfaxui
  4. //
  5. // 16bit structures are share between wow16 and wow32 only. Though they get
  6. // included while compiling 32bit printdrivers wowfax and wowfaxui, yet they
  7. // are incorrect and inaccessible from those dlls.
  8. //
  9. //
  10. // History:
  11. // 02-jan-95 nandurir created.
  12. // 01-feb-95 reedb Clean-up, support printer install and bug fixes.
  13. //
  14. //****************************************************************************
  15. //***************************************************************************
  16. // WM_DDRV_ defines - Common to wowexec,wow32,wowfax,wowfaxui. If you add
  17. // a message, be sure to add it to the debug strings also.
  18. //***************************************************************************
  19. #define WM_DDRV_FIRST (WM_USER+0x100+1) // begin DDRV range
  20. #define WM_DDRV_LOAD (WM_USER+0x100+1)
  21. #define WM_DDRV_ENABLE (WM_USER+0x100+2)
  22. #define WM_DDRV_STARTDOC (WM_USER+0x100+3)
  23. #define WM_DDRV_PRINTPAGE (WM_USER+0x100+4)
  24. #define WM_DDRV_ESCAPE (WM_USER+0x100+5)
  25. #define WM_DDRV_DISABLE (WM_USER+0x100+6)
  26. #define WM_DDRV_INITFAXINFO16 (WM_USER+0x100+7)
  27. #define WM_DDRV_ENDDOC (WM_USER+0x100+8)
  28. #define WM_DDRV_SUBCLASS (WM_USER+0x100+9)
  29. #define WM_DDRV_EXTDMODE (WM_USER+0x100+10)
  30. #define WM_DDRV_DEVCAPS (WM_USER+0x100+11)
  31. #define WM_DDRV_FREEFAXINFO16 (WM_USER+0x100+12)
  32. #define WM_DDRV_UNLOAD (WM_USER+0x100+20)
  33. #define WM_DDRV_LAST (WM_USER+0x100+20) // end DDRV range
  34. #define CCHDOCNAME 128
  35. #ifdef DEBUG
  36. #ifdef DEFINE_DDRV_DEBUG_STRINGS
  37. char *szWmDdrvDebugStrings[] =
  38. {
  39. "WM_DDRV_LOAD",
  40. "WM_DDRV_ENABLE",
  41. "WM_DDRV_STARTDOC",
  42. "WM_DDRV_PRINTPAGE",
  43. "WM_DDRV_ESCAPE",
  44. "WM_DDRV_DISABLE",
  45. "WM_DDRV_INITFAXINFO16",
  46. "WM_DDRV_ENDDOC",
  47. "WM_DDRV_SUBCLASS",
  48. "WM_DDRV_EXTDMODE",
  49. "WM_DDRV_DEVCAPS",
  50. "WM_DDRV_FREEFAXINFO16",
  51. "UNKNOWN MESSAGE",
  52. "UNKNOWN MESSAGE",
  53. "UNKNOWN MESSAGE",
  54. "UNKNOWN MESSAGE",
  55. "UNKNOWN MESSAGE",
  56. "UNKNOWN MESSAGE",
  57. "UNKNOWN MESSAGE",
  58. "WM_DDRV_UNLOAD"
  59. };
  60. #endif
  61. #endif // #define(DEBUG)
  62. // WOWFAX component file names. Unicode and ANSII
  63. #define WOWFAX_DLL_NAME L"WOWFAX.DLL"
  64. #define WOWFAXUI_DLL_NAME L"WOWFAXUI.DLL"
  65. #define WOWFAX_DLL_NAME_A "WOWFAX.DLL"
  66. #define WOWFAXUI_DLL_NAME_A "WOWFAXUI.DLL"
  67. //***************************************************************************
  68. // wow16 ie wowfax.c defines WOWFAX16 to include 16bit print.h etc
  69. //
  70. //***************************************************************************
  71. #if defined(_WOWFAX16_)
  72. #include "..\..\..\mvdm\wow16\inc\print.h"
  73. #include "..\..\..\mvdm\wow16\inc\gdidefs.inc"
  74. #define LPTSTR LPSTR
  75. #define TEXT(x) x
  76. #define SRCCOPY 0x00CC0020L
  77. //
  78. // the following UNALIGNED definition is required because this file
  79. // in included in wow16\test\shell\wowfax.h
  80. //
  81. #ifndef UNALIGNED
  82. #if defined(MIPS) || defined(_ALPHA_) // winnt
  83. #define UNALIGNED __unaligned // winnt
  84. #else // winnt
  85. #define UNALIGNED // winnt
  86. #endif // winnt
  87. #endif
  88. #endif // defined(wowfax16)
  89. //***************************************************************************
  90. // WOWFAXINFO16 common to wow16 and wow32
  91. // Struct cannot be accessed from 32bit wowfax/wowfaxui dlls
  92. //***************************************************************************
  93. #define WFINFO16_ENABLED 0x01
  94. /* XLATOFF */
  95. #pragma pack(2)
  96. /* XLATON */
  97. typedef struct _WOWFAXINFO16 { /* winfo16 */
  98. WORD hmem;
  99. WORD flState;
  100. WORD hInst;
  101. WORD (FAR PASCAL *lpEnable)(LPVOID,short,LPSTR,LPSTR,LPVOID);
  102. VOID (FAR PASCAL *lpDisable)(LPVOID);
  103. int (FAR PASCAL *lpControl)(LPVOID, short, LPVOID, LPVOID);
  104. BOOL (FAR PASCAL *lpBitblt)(LPVOID,WORD,WORD,LPVOID,
  105. WORD,WORD,WORD,WORD,long,LPVOID,LPVOID);
  106. WORD (FAR PASCAL *lpExtDMode)(HWND, HANDLE, LPVOID, LPSTR, LPSTR,
  107. LPVOID, LPSTR , WORD);
  108. DWORD (FAR PASCAL *lpDevCaps)(LPSTR, LPSTR, WORD, LPSTR, LPVOID);
  109. WORD hmemdevice;
  110. DWORD cData;
  111. WORD hwndui;
  112. DWORD retvalue;
  113. WORD wCmd;
  114. // The following pointers provide offsets into the mapped file
  115. // section used for inter process communication. They point to
  116. // objects which have a variable length.
  117. LPVOID lpDevice;
  118. LPVOID lpDriverName;
  119. LPVOID lpPortName;
  120. LPVOID lpIn;
  121. LPVOID lpOut;
  122. // Since we have a max length (CCHDEVICENAME) we'll pass
  123. // the printer/device name in this fixed length buffer.
  124. char szDeviceName[CCHDEVICENAME+1];
  125. char szDocName[CCHDOCNAME+1];
  126. } WOWFAXINFO16;
  127. typedef WOWFAXINFO16 UNALIGNED FAR *LPWOWFAXINFO16;
  128. //***************************************************************************
  129. // GDIINFO16 common to wow16 and wow32
  130. // - this structure copied from wow16\inc\gdidefs.inc
  131. // - PTTYPE has been replaced with POINT
  132. //
  133. // Struct cannot be accessed from 32bit wowfax/wowfaxui dlls. the
  134. // definition itself will be incorrect.
  135. //
  136. //***************************************************************************
  137. #ifndef _DEF_WOW32_
  138. #define POINT16 POINT
  139. #endif
  140. typedef struct _GDIINFO16{ /* gdii16 */
  141. short int dpVersion;
  142. short int dpTechnology;
  143. short int dpHorzSize;
  144. short int dpVertSize;
  145. short int dpHorzRes;
  146. short int dpVertRes;
  147. short int dpBitsPixel;
  148. short int dpPlanes;
  149. short int dpNumBrushes;
  150. short int dpNumPens;
  151. short int futureuse;
  152. short int dpNumFonts;
  153. short int dpNumColors;
  154. short int dpDEVICEsize;
  155. unsigned short int dpCurves;
  156. unsigned short int dpLines;
  157. unsigned short int dpPolygonals;
  158. unsigned short int dpText;
  159. unsigned short int dpClip;
  160. unsigned short int dpRaster;
  161. short int dpAspectX;
  162. short int dpAspectY;
  163. short int dpAspectXY;
  164. short int dpStyleLen;
  165. POINT16 dpMLoWin;
  166. POINT16 dpMLoVpt;
  167. POINT16 dpMHiWin;
  168. POINT16 dpMHiVpt;
  169. POINT16 dpELoWin;
  170. POINT16 dpELoVpt;
  171. POINT16 dpEHiWin;
  172. POINT16 dpEHiVpt;
  173. POINT16 dpTwpWin;
  174. POINT16 dpTwpVpt;
  175. short int dpLogPixelsX;
  176. short int dpLogPixelsY;
  177. short int dpDCManage;
  178. unsigned short int dpCaps1;
  179. short int futureuse4;
  180. short int futureuse5;
  181. short int futureuse6;
  182. short int futureuse7;
  183. WORD dpNumPalReg;
  184. WORD dpPalReserved;
  185. WORD dpColorRes;
  186. } GDIINFO16;
  187. typedef GDIINFO16 UNALIGNED FAR *LPGDIINFO16;
  188. /* XLATOFF */
  189. #pragma pack()
  190. /* XLATON */
  191. #ifndef _WOWFAX16_
  192. //***************************************************************************
  193. // WOWFAXINFO - common to wow32,wowfax,wowfaxui. This defines the header of
  194. // shared memory section.
  195. //
  196. //***************************************************************************
  197. typedef struct _WOWFAXINFO { /* faxi */
  198. HWND hwnd;
  199. DWORD tid;
  200. WNDPROC proc16;
  201. LPBYTE lpinfo16;
  202. UINT msg;
  203. WPARAM hdc;
  204. WORD wCmd;
  205. DWORD cData;
  206. HWND hwndui;
  207. DWORD retvalue;
  208. DWORD status;
  209. // The following pointers provide offsets into the mapped file
  210. // section used for inter process communication. They point to
  211. // objects which have a variable length.
  212. LPVOID lpDevice;
  213. LPVOID lpDriverName;
  214. LPVOID lpPortName;
  215. LPVOID lpIn;
  216. LPVOID lpOut;
  217. // Since we have a max length (CCHDEVICENAME) we'll pass
  218. // the printer/device name in this fixed length buffer.
  219. WCHAR szDeviceName[CCHDEVICENAME+1];
  220. // EasyFax Ver2.0 support for JAPAN.
  221. // Also needed for Procomm+ 3 cover sheets. Bug #305665
  222. WCHAR szDocName[CCHDOCNAME+1];
  223. UINT bmPixPerByte;
  224. UINT bmWidthBytes;
  225. UINT bmHeight;
  226. LPBYTE lpbits;
  227. } WOWFAXINFO, FAR *LPWOWFAXINFO;
  228. #endif // _WOWFAX16_
  229. #define WOWFAX_CLASS TEXT("WOWFaxClass")
  230. VOID GetFaxDataMapName(DWORD idMap, LPTSTR lpT);
  231. //***************************************************************************
  232. // Common functions for wow32, wowfax and wowfaxui.
  233. //***************************************************************************
  234. #ifdef WOWFAX_INC_COMMON_CODE
  235. #define WOWFAX_MAPPREFIX TEXT("wfm")
  236. #define WOWFAX_HEXDIGITS TEXT("0123456789abcdef")
  237. //***************************************************************************
  238. // GetFaxDataMapName - given idMap, generates the sharedmem Map Name.
  239. // A process can access the relevant data by opening the file
  240. // identified by idMap
  241. //***************************************************************************
  242. VOID GetFaxDataMapName(DWORD idMap, LPTSTR lpT)
  243. {
  244. int i;
  245. int cb = lstrlen(WOWFAX_MAPPREFIX);
  246. LPBYTE lpid = (LPBYTE)&idMap;
  247. LPTSTR lphexT = WOWFAX_HEXDIGITS;
  248. lstrcpy(lpT, WOWFAX_MAPPREFIX);
  249. for (i = 0; i < sizeof(idMap) ; i++) {
  250. lpT[(i * 2) + cb] = lphexT[lpid[i] & 0xf];
  251. lpT[(i * 2) + cb + 1] = lphexT[(lpid[i] & 0xf0) >> 4];
  252. }
  253. lpT[(i * 2) + cb] = 0;
  254. }
  255. #endif // WOWFAX_INC_COMMON_CODE