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.

532 lines
12 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. umpd.cxx
  5. Abstract:
  6. User-mode printer driver support
  7. Environment:
  8. Windows NT 5.0
  9. Revision History:
  10. 07/8/97 -lingyunw-
  11. Created it.
  12. --*/
  13. #ifndef __UMPD__
  14. #define __UMPD__
  15. #define INDEX_UMPDDrvEnableDriver INDEX_LAST+1
  16. #define INDEX_LoadUMPrinterDrv INDEX_LAST+2 // used for WOW64, spooler calls
  17. #define INDEX_UnloadUMPrinterDrv INDEX_LAST+3
  18. #define INDEX_UMDriverFN INDEX_LAST+4
  19. #define INDEX_DocumentEvent INDEX_LAST+5
  20. #define INDEX_StartDocPrinterW INDEX_LAST+6
  21. #define INDEX_StartPagePrinter INDEX_LAST+7
  22. #define INDEX_EndPagePrinter INDEX_LAST+8
  23. #define INDEX_EndDocPrinter INDEX_LAST+9
  24. #define INDEX_AbortPrinter INDEX_LAST+10
  25. #define INDEX_ResetPrinterW INDEX_LAST+11
  26. #define INDEX_QueryColorProfile INDEX_LAST+12
  27. #define INDEX_UMPDAllocUserMem INDEX_LAST+13 // used for WOW64, large bitmaps
  28. #define INDEX_UMPDCopyMemory INDEX_LAST+14
  29. #define INDEX_UMPDFreeMemory INDEX_LAST+15
  30. #define INDEX_UMPDEngFreeUserMem INDEX_LAST+16
  31. typedef struct _HPRINTERLIST
  32. {
  33. struct _HPRINTERLIST *pNext;
  34. DWORD clientPid;
  35. DWORD hPrinter32;
  36. HANDLE hPrinter64;
  37. }HPRINTERLIST, *PHPRINTERLIST;
  38. typedef struct _UMPD {
  39. DWORD dwSignature; // data structure signature
  40. struct _UMPD * pNext; // linked list pointer
  41. PDRIVER_INFO_2W pDriverInfo2; // pointer to driver info
  42. HINSTANCE hInst; // instance handle to user-mode printer driver module
  43. DWORD dwFlags; // misc. flags
  44. BOOL bArtificialIncrement; // indicates if the ref cnt has been bumped up to
  45. // defer unloading
  46. DWORD dwDriverVersion; // version number of the loaded driver
  47. INT iRefCount; // reference count
  48. struct ProxyPort * pp; // UMPD proxy server
  49. KERNEL_PVOID umpdCookie; // cookie returned back from proxy
  50. PHPRINTERLIST pHandleList; // list of hPrinter's opened on the proxy server
  51. PFN apfn[INDEX_LAST]; // driver function table
  52. } UMPD, *PUMPD;
  53. typedef struct _UMDHPDEV {
  54. PUMPD pUMPD;
  55. DHPDEV dhpdev;
  56. // HDC hdc; // the printer DC that's associated with the pdev
  57. // PBYTE pvEMF; // the pointer to the emf if we are playing the emf on the hdc
  58. // PBYTE pvCurrentRecord; // the pointer to the current emf record if we are playing emf
  59. } UMDHPDEV, *PUMDHPDEV;
  60. typedef KERNEL_PVOID KERNEL_PUMDHPDEV;
  61. typedef struct
  62. {
  63. UMTHDR umthdr;
  64. HUMPD humpd;
  65. } UMPDTHDR;
  66. typedef struct
  67. {
  68. UMPDTHDR umpdthdr;
  69. KERNEL_PVOID cookie;
  70. } DRVDRIVERFNINPUT, *PDRVDRIVERFNINPUT;
  71. typedef struct
  72. {
  73. UMPDTHDR umpdthdr;
  74. PWSTR pwszDriver;
  75. } DRVENABLEDRIVERINPUT, *PDRVENABLEDRIVERINPUT;
  76. typedef struct
  77. {
  78. UMPDTHDR umpdthdr;
  79. KERNEL_PVOID umpdCookie;
  80. PDEVMODEW pdm;
  81. PWSTR pLogAddress;
  82. ULONG cPatterns;
  83. HSURF *phsurfPatterns;
  84. ULONG cjCaps;
  85. ULONG *pdevcaps;
  86. ULONG cjDevInfo;
  87. DEVINFO *pDevInfo;
  88. HDEV hdev;
  89. PWSTR pDeviceName;
  90. HANDLE hPrinter;
  91. BOOL bWOW64;
  92. DWORD clientPid;
  93. #if defined(_WIN64)
  94. ULONG cxHTPat;
  95. ULONG cyHTPat;
  96. LPBYTE pHTPatA, pHTPatB, pHTPatC;
  97. BOOL bHTPatA, bHTPatB, bHTPatC;
  98. #endif
  99. } DRVENABLEPDEVINPUT, *PDRVENABLEPDEVINPUT;
  100. typedef struct
  101. {
  102. UMPDTHDR umpdthdr;
  103. DHPDEV dhpdev;
  104. HDEV hdev;
  105. } DRVCOMPLETEPDEVINPUT, *PDRVCOMPLETEPDEVINPUT;
  106. typedef struct
  107. {
  108. UMPDTHDR umpdthdr;
  109. DHPDEV dhpdevOld;
  110. DHPDEV dhpdevNew;
  111. } DRVRESETPDEVINPUT, *PDRVRESETPDEVINPUT;
  112. typedef struct
  113. {
  114. UMPDTHDR umpdthdr;
  115. DHPDEV dhpdev;
  116. } DHPDEVINPUT, *PDHPDEVINPUT;
  117. //
  118. // Note: can't pass kernel pointers over to client side.
  119. //
  120. typedef struct _DRVESCAPEINPUT
  121. {
  122. UMPDTHDR umpdthdr;
  123. SURFOBJ *pso;
  124. ULONG iEsc;
  125. ULONG cjIn;
  126. PVOID pvIn;
  127. ULONG cjOut;
  128. PVOID pvOut;
  129. } DRVESCAPEINPUT, *PDRVESCAPEINPUT;
  130. typedef struct _DRVDRAWESCAPEINPUT
  131. {
  132. UMPDTHDR umpdthdr;
  133. SURFOBJ *pso;
  134. ULONG iEsc;
  135. CLIPOBJ *pco;
  136. RECTL *prcl;
  137. ULONG cjIn;
  138. PVOID pvIn;
  139. } DRVDRAWESCAPEINPUT, *PDRVDRAWESCAPEINPUT;
  140. typedef struct
  141. {
  142. UMPDTHDR umpdthdr;
  143. SURFOBJ *pso;
  144. CLIPOBJ *pco;
  145. BRUSHOBJ *pbo;
  146. POINTL *pptlBrushOrg;
  147. POINTL ptlBrushOrg;
  148. MIX mix;
  149. } DRVPAINTINPUT, *PDRVPAINTINPUT;
  150. typedef struct
  151. {
  152. UMPDTHDR umpdthdr;
  153. SURFOBJ *pso;
  154. CLIPOBJ *pco;
  155. BRUSHOBJ *pbo;
  156. LONG x1;
  157. LONG y1;
  158. LONG x2;
  159. LONG y2;
  160. RECTL *prclBounds;
  161. MIX mix;
  162. } DRVLINETOINPUT, *PDRVLINETOINPUT;
  163. typedef struct
  164. {
  165. UMPDTHDR umpdthdr;
  166. SURFOBJ *psoTrg;
  167. SURFOBJ *psoSrc;
  168. SURFOBJ *psoMask;
  169. CLIPOBJ *pco;
  170. XLATEOBJ *pxlo;
  171. RECTL *prclTrg;
  172. POINTL *pptlSrc;
  173. POINTL *pptlMask;
  174. BRUSHOBJ *pbo;
  175. POINTL *pptlBrush;
  176. ROP4 rop4;
  177. } DRVBITBLTINPUT, *PDRVBITBLTINPUT;
  178. typedef struct
  179. {
  180. UMPDTHDR umpdthdr;
  181. SURFOBJ *psoTrg;
  182. SURFOBJ *psoSrc;
  183. CLIPOBJ *pco;
  184. XLATEOBJ *pxlo;
  185. RECTL *prclTrg;
  186. POINTL *pptlSrc;
  187. } DRVCOPYBITSINPUT, *PDRVCOPYBITSINPUT;
  188. typedef struct
  189. {
  190. UMPDTHDR umpdthdr;
  191. SURFOBJ *psoTrg;
  192. SURFOBJ *psoSrc;
  193. SURFOBJ *psoMask;
  194. CLIPOBJ *pco;
  195. XLATEOBJ *pxlo;
  196. COLORADJUSTMENT *pca;
  197. POINTL *pptlHTOrg;
  198. RECTL *prclTrg;
  199. RECTL *prclSrc;
  200. POINTL *pptlMask;
  201. ULONG iMode;
  202. BRUSHOBJ *pbo;
  203. ROP4 rop4;
  204. } DRVSTRETCHBLTINPUT, *PDRVSTRETCHBLTINPUT;
  205. typedef struct
  206. {
  207. UMPDTHDR umpdthdr;
  208. SURFOBJ *psoTrg;
  209. SURFOBJ *psoSrc;
  210. SURFOBJ *psoMask;
  211. CLIPOBJ *pco;
  212. XLATEOBJ *pxlo;
  213. COLORADJUSTMENT *pca;
  214. POINTL *pptlBrushOrg;
  215. POINTFIX *pptfx;
  216. RECTL *prcl;
  217. POINTL *pptl;
  218. ULONG iMode;
  219. } DRVPLGBLTINPUT, *PDRVPLGBLTINPUT;
  220. typedef struct
  221. {
  222. UMPDTHDR umpdthdr;
  223. SURFOBJ *psoTrg;
  224. SURFOBJ *psoSrc;
  225. CLIPOBJ *pco;
  226. XLATEOBJ *pxlo;
  227. RECTL *prclDest;
  228. RECTL *prclSrc;
  229. BLENDOBJ *pBlendObj;
  230. } ALPHAINPUT, *PALPHAINPUT;
  231. typedef struct
  232. {
  233. UMPDTHDR umpdthdr;
  234. SURFOBJ *psoTrg;
  235. SURFOBJ *psoSrc;
  236. CLIPOBJ *pco;
  237. XLATEOBJ *pxlo;
  238. RECTL *prclDst;
  239. RECTL *prclSrc;
  240. ULONG TransColor;
  241. UINT ulReserved;
  242. } TRANSPARENTINPUT, *PTRANSPARENTINPUT;
  243. typedef struct
  244. {
  245. UMPDTHDR umpdthdr;
  246. SURFOBJ *psoTrg;
  247. CLIPOBJ *pco;
  248. XLATEOBJ *pxlo;
  249. TRIVERTEX *pVertex;
  250. ULONG nVertex;
  251. PVOID pMesh;
  252. ULONG nMesh;
  253. RECTL *prclExtents;
  254. POINTL *pptlDitherOrg;
  255. ULONG ulMode;
  256. } GRADIENTINPUT, *PGRADIENTINPUT;
  257. typedef struct
  258. {
  259. UMPDTHDR umpdthdr;
  260. SURFOBJ *pso;
  261. PWSTR pwszDocName;
  262. DWORD dwJobId;
  263. } DRVSTARTDOCINPUT, *PDRVSTARTDOCINPUT;
  264. typedef struct
  265. {
  266. UMPDTHDR umpdthdr;
  267. SURFOBJ *pso;
  268. FLONG fl;
  269. } DRVENDDOCINPUT, *PDRVENDDOCINPUT;
  270. typedef struct
  271. {
  272. UMPDTHDR umpdthdr;
  273. SURFOBJ *pso;
  274. } SURFOBJINPUT, *PSURFOBJINPUT;
  275. typedef struct
  276. {
  277. UMPDTHDR umpdthdr;
  278. SURFOBJ *pso;
  279. POINTL *pptl;
  280. } DRVBANDINGINPUT, *PDRVBANDINGINPUT;
  281. typedef struct
  282. {
  283. UMPDTHDR umpdthdr;
  284. SURFOBJ *pso;
  285. PERBANDINFO *pbi;
  286. } DRVPERBANDINPUT, *PDRVPERBANDINPUT;
  287. typedef struct
  288. {
  289. UMPDTHDR umpdthdr;
  290. SURFOBJ *psoTrg;
  291. SURFOBJ *psoPat;
  292. SURFOBJ *psoMsk;
  293. BRUSHOBJ *pbo;
  294. XLATEOBJ *pxlo;
  295. ULONG iHatch;
  296. } DRVREALIZEBRUSHINPUT, *PDRVREALIZEBRUSHINPUT;
  297. typedef struct
  298. {
  299. UMPDTHDR umpdthdr;
  300. SURFOBJ *pso;
  301. PATHOBJ *ppo;
  302. CLIPOBJ *pco;
  303. XFORMOBJ *pxo;
  304. BRUSHOBJ *pbo;
  305. POINTL *pptlBrushOrg;
  306. LINEATTRS *plineattrs;
  307. BRUSHOBJ *pboFill;
  308. MIX mix;
  309. FLONG flOptions;
  310. } STORKEANDFILLINPUT, *PSTROKEANDFILLINPUT;
  311. typedef struct
  312. {
  313. UMPDTHDR umpdthdr;
  314. SURFOBJ *pso;
  315. STROBJ *pstro;
  316. FONTOBJ *pfo;
  317. CLIPOBJ *pco;
  318. RECTL *prclExtra;
  319. RECTL *prclOpaque;
  320. BRUSHOBJ *pboFore;
  321. BRUSHOBJ *pboOpaque;
  322. POINTL *pptlOrg;
  323. MIX mix;
  324. } TEXTOUTINPUT, *PTEXTOUTINPUT;
  325. typedef struct
  326. {
  327. UMPDTHDR umpdthdr;
  328. DHPDEV dhpdev;
  329. ULONG_PTR iFile;
  330. ULONG iFace;
  331. ULONG iMode;
  332. ULONG *pid;
  333. ULONG cjMaxData;
  334. PVOID pv;
  335. } QUERYFONTINPUT, *PQUERYFONTINPUT;
  336. typedef struct
  337. {
  338. UMPDTHDR umpdthdr;
  339. DHPDEV dhpdev;
  340. FONTOBJ *pfo;
  341. ULONG iMode;
  342. HGLYPH hg;
  343. GLYPHDATA *pgd;
  344. PVOID pv;
  345. ULONG cjSize;
  346. } QUERYFONTDATAINPUT, *PQUERYFONTDATAINPUT;
  347. typedef struct
  348. {
  349. UMPDTHDR umpdthdr;
  350. DHPDEV dhpdev;
  351. FONTOBJ *pfo;
  352. ULONG iMode;
  353. HGLYPH *phg;
  354. PVOID pvWidths;
  355. ULONG cGlyphs;
  356. } QUERYADVWIDTHSINPUT, *PQUERYADVWIDTHSINPUT;
  357. typedef struct
  358. {
  359. UMPDTHDR umpdthdr;
  360. DHPDEV dhpdev;
  361. FONTOBJ *pfo;
  362. } GETGLYPHMODEINPUT, *PGETGLYPHMODEINPUT;
  363. typedef struct
  364. {
  365. UMPDTHDR umpdthdr;
  366. SURFOBJ *pso;
  367. DHPDEV dhpdev;
  368. FONTOBJ *pfo;
  369. ULONG iMode;
  370. ULONG cjIn;
  371. PVOID pvIn;
  372. ULONG cjOut;
  373. PVOID pvOut;
  374. } FONTMANAGEMENTINPUT, *PFONTMANAGEMENTINPUT;
  375. typedef struct
  376. {
  377. UMPDTHDR umpdthdr;
  378. DHPDEV dhpdev;
  379. ULONG iMode;
  380. ULONG rgb;
  381. ULONG *pul;
  382. } DRVDITHERCOLORINPUT, *PDRVDITHERCOLORINPUT;
  383. typedef struct
  384. {
  385. UMPDTHDR umpdthdr;
  386. DHPDEV dhpdev;
  387. PVOID pv;
  388. ULONG id;
  389. } DRVFREEINPUT, *PDRVFREEINPUT;
  390. typedef struct
  391. {
  392. UMPDTHDR umpdthdr;
  393. DHPDEV dhpdev;
  394. DHSURF dhsurf;
  395. } DRVDELETEDEVBITMAP, *PDRVDELETEDEVBITMAP;
  396. typedef struct
  397. {
  398. UMPDTHDR umpdthdr;
  399. DHPDEV dhpdev;
  400. HANDLE hcmXform;
  401. } DRVICMDELETECOLOR, *PDRVICMDELETECOLOR;
  402. typedef struct
  403. {
  404. UMPDTHDR umpdthdr;
  405. DHPDEV dhpdev;
  406. LPLOGCOLORSPACEW pLogColorSpace;
  407. PVOID pvSourceProfile;
  408. ULONG cjSourceProfile;
  409. PVOID pvDestProfile;
  410. ULONG cjDestProfile;
  411. PVOID pvTargetProfile;
  412. ULONG cjTargetProfile;
  413. DWORD dwReserved;
  414. } DRVICMCREATECOLORINPUT, *PDRVICMCREATECOLORINPUT;
  415. typedef struct
  416. {
  417. UMPDTHDR umpdthdr;
  418. DHPDEV dhpdev;
  419. HANDLE hColorTransform;
  420. SURFOBJ *pso;
  421. PBYTE paResults;
  422. } DRVICMCHECKBITMAPINPUT, *PDRVICMCHECKBITMAPINPUT;
  423. typedef struct
  424. {
  425. UMPDTHDR umpdthdr;
  426. SURFOBJ *pso;
  427. XLATEOBJ *pxlo;
  428. XFORMOBJ *pxo;
  429. ULONG iType;
  430. ULONG cjIn;
  431. PVOID pvIn;
  432. ULONG cjOut;
  433. PVOID pvOut;
  434. } DRVQUERYDEVICEINPUT, *PDRVQUERYDEVICEINPUT;
  435. typedef struct
  436. {
  437. UMPDTHDR umpdthdr;
  438. ULONG cjSize;
  439. } UMPDALLOCUSERMEMINPUT, *PUMPDALLOCUSERMEMINPUT;
  440. typedef struct
  441. {
  442. UMPDTHDR umpdthdr;
  443. KERNEL_PVOID pvSrc;
  444. KERNEL_PVOID pvDest;
  445. ULONG cjSize;
  446. } UMPDCOPYMEMINPUT, *PUMPDCOPYMEMINPUT;
  447. typedef struct
  448. {
  449. UMPDTHDR umpdthdr;
  450. KERNEL_PVOID pvTrg;
  451. KERNEL_PVOID pvSrc;
  452. KERNEL_PVOID pvMsk;
  453. } UMPDFREEMEMINPUT, *PUMPDFREEMEMINPUT;
  454. #endif // __UMPD__