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.

1478 lines
55 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. umpddrv.c
  5. Abstract:
  6. User-mode printer driver stubs for Drv callback functions
  7. Environment:
  8. Windows NT 5.0
  9. Revision History:
  10. 09/30/97 -lingyunw-
  11. Created it by moving GdiPrinterThunk out of umpd.c.
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. RTL_CRITICAL_SECTION semUMPD; // Critical section for user-mode printer driver
  16. #if !defined(_GDIPLUS_)
  17. #include "winddi.h"
  18. #include "proxyport.h"
  19. /*
  20. #if DBG
  21. #define DBG_TRACE(x) DbgPrint("UMPD: "#x"\n")
  22. #else
  23. #define DBG_TRACE(x)
  24. #endif
  25. */
  26. //
  27. // Adjust user mode printer driver DHPDEV field in a SURFOBJ
  28. //
  29. __inline PUMDHPDEV
  30. AdjustUMdhpdev(
  31. SURFOBJ *pso
  32. )
  33. {
  34. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pso->dhpdev;
  35. pso->dhpdev = pUMdhpdev->dhpdev;
  36. return pUMdhpdev;
  37. }
  38. BOOL
  39. GdiCopyFD_GLYPHSET(
  40. FD_GLYPHSET *dst,
  41. FD_GLYPHSET *src,
  42. ULONG cjSize
  43. )
  44. {
  45. ULONG index, offset, size;
  46. PBYTE phg, pbMax;
  47. size = offsetof(FD_GLYPHSET, awcrun) + src->cRuns * sizeof(WCRUN);
  48. RtlCopyMemory(dst, src, size);
  49. dst->cjThis = cjSize;
  50. pbMax = (PBYTE)dst + cjSize;
  51. phg = (PBYTE)dst + size;
  52. //
  53. // Patch up memory pointers in each WCRUN structure
  54. //
  55. for (index=0; index < src->cRuns; index++)
  56. {
  57. if (src->awcrun[index].phg != NULL)
  58. {
  59. size = src->awcrun[index].cGlyphs * sizeof(HGLYPH);
  60. if (phg + size <= pbMax)
  61. {
  62. RtlCopyMemory(phg, src->awcrun[index].phg, size);
  63. dst->awcrun[index].phg = (HGLYPH*) phg;
  64. phg += size;
  65. }
  66. else
  67. return FALSE;
  68. }
  69. }
  70. return TRUE;
  71. }
  72. BOOL bAddPrinterHandle(PUMPD pUMPD, DWORD clientPid, DWORD hPrinter32, HANDLE hPrinter64)
  73. {
  74. PHPRINTERLIST pPtrList;
  75. BOOL bRet = FALSE;
  76. if (pPtrList = LOCALALLOC(sizeof(HPRINTERLIST)))
  77. {
  78. pPtrList->clientPid = clientPid;
  79. pPtrList->hPrinter32 = hPrinter32;
  80. pPtrList->hPrinter64 = hPrinter64;
  81. ENTERCRITICALSECTION(&semUMPD);
  82. pPtrList->pNext = pUMPD->pHandleList;
  83. pUMPD->pHandleList = pPtrList;
  84. bRet = TRUE;
  85. LEAVECRITICALSECTION(&semUMPD);
  86. }
  87. return bRet;
  88. }
  89. PHPRINTERLIST FindPrinterHandle(PUMPD pUMPD, DWORD clientPid, DWORD hPrinter32)
  90. {
  91. PHPRINTERLIST pList;
  92. ENTERCRITICALSECTION(&semUMPD);
  93. pList = pUMPD->pHandleList;
  94. while(pList)
  95. {
  96. if (pList->clientPid == clientPid && pList->hPrinter32 == hPrinter32)
  97. {
  98. break;
  99. }
  100. pList = pList->pNext;
  101. }
  102. LEAVECRITICALSECTION(&semUMPD);
  103. return pList;
  104. }
  105. VOID DeletePrinterHandle(PUMPD pUMPD, PHPRINTERLIST pNode)
  106. {
  107. PHPRINTERLIST pList;
  108. ENTERCRITICALSECTION(&semUMPD);
  109. pList = pUMPD->pHandleList;
  110. if (pList == pNode)
  111. {
  112. pUMPD->pHandleList = pNode->pNext;
  113. }
  114. else
  115. {
  116. while(pList && pList->pNext != pNode)
  117. {
  118. pList = pList->pNext;
  119. }
  120. if (pList)
  121. {
  122. pList->pNext = pNode->pNext;
  123. }
  124. }
  125. LEAVECRITICALSECTION(&semUMPD);
  126. if (pList)
  127. {
  128. LOCALFREE(pNode);
  129. }
  130. }
  131. //
  132. // KERNEL_PVOID UMPDAllocUserMem
  133. //
  134. // WOW64 printing only
  135. //
  136. KERNEL_PVOID UMPDAllocUserMem(ULONG cjSize)
  137. {
  138. return ((KERNEL_PVOID) LOCALALLOC(cjSize));
  139. }
  140. //
  141. // KERNEL_PVOID UMPDCopyMemory
  142. //
  143. // WOW64 printing only
  144. //
  145. // pvSrc
  146. // source
  147. //
  148. // pvDest
  149. // dest
  150. //
  151. // cjBits
  152. // size to copy
  153. //
  154. KERNEL_PVOID UMPDCopyMemory(
  155. KERNEL_PVOID pvSrc,
  156. KERNEL_PVOID pvDest,
  157. ULONG cjBits
  158. )
  159. {
  160. if (pvDest != NULL)
  161. RtlCopyMemory(pvDest, pvSrc, cjBits);
  162. return pvDest;
  163. }
  164. //
  165. // BOOL UMPDFreeMemory
  166. //
  167. // WOW64 only
  168. //
  169. BOOL UMPDFreeMemory(
  170. KERNEL_PVOID pv1,
  171. KERNEL_PVOID pv2,
  172. KERNEL_PVOID pv3
  173. )
  174. {
  175. if (pv1)
  176. LOCALFREE(pv1);
  177. if (pv2)
  178. LOCALFREE(pv2);
  179. if (pv3)
  180. LOCALFREE(pv3);
  181. return TRUE;
  182. }
  183. /******************************Public*Routine******************************\
  184. * GdiPrinterThunk function
  185. *
  186. * GDI callback for user-mode printer drivers.
  187. *
  188. * Parameters pumth
  189. * Pointer to input buffer. Buffer has UMTHDR at
  190. * beginning.
  191. *
  192. * pvOut
  193. * Output buffer.
  194. *
  195. * cjOut
  196. * Size of output buffer.
  197. *
  198. * Return Value
  199. *
  200. * The function returns GPT_ERROR if an error occurs. Otherwise, the
  201. * return value is dependent on the command specified by pumth->ulType.
  202. *
  203. * History:
  204. * 7/17/97 -by- Lingyun Wang [lingyunw] Added giant body to
  205. * Make it do the real work
  206. * 30-Jun-1997 -by- Gilman Wong [gilmanw]
  207. * Wrote it.
  208. \**************************************************************************/
  209. extern PUMPD
  210. FindUserModePrinterDriver(
  211. PCWSTR pDriverDllName,
  212. DWORD dwDriverVersion,
  213. BOOL bUseVersion
  214. );
  215. WINGDIAPI
  216. ULONG
  217. WINAPI
  218. GdiPrinterThunk (
  219. UMTHDR * pvIn,
  220. PVOID pvOut,
  221. ULONG cjOut
  222. )
  223. {
  224. INT iRet = 1;
  225. UMPDTHDR * pumpdthdr = (UMPDTHDR *) pvIn;
  226. HUMPD hSaved;
  227. BOOL bWOW64 = FALSE, bSetPUMPD = FALSE;
  228. ULONG ulType = pvIn->ulType;
  229. //
  230. // Call NtGdiSetPUMPDOBJ to set the W32THREAD.pUMPDObj pointer
  231. // only if this is a DDI thunk
  232. //
  233. if (ulType <= INDEX_LAST+1)
  234. {
  235. if (!(bSetPUMPD = NtGdiSetPUMPDOBJ(pumpdthdr->humpd, TRUE, &hSaved, &bWOW64)))
  236. {
  237. WARNING ("NtGdiSetPUMPDOBJ failed\n");
  238. return GPT_ERROR;
  239. }
  240. }
  241. switch (ulType)
  242. {
  243. case INDEX_LoadUMPrinterDrv:
  244. {
  245. PLOADDRIVERINPUT pInput = (PLOADDRIVERINPUT) pvIn;
  246. PUMPD pUMPD = NULL;
  247. HANDLE hPrinter = NULL;
  248. *((PUMPD *)pvOut) = NULL;
  249. if(BLOADSPOOLER)
  250. {
  251. (*fpOpenPrinterW)(pInput->pPrinterName, &hPrinter, (LPPRINTER_DEFAULTSW)&pInput->defaults);
  252. if(hPrinter)
  253. {
  254. if(LoadUserModePrinterDriverEx((PDRIVER_INFO_5W)&pInput->driverInfo, NULL, &pUMPD, NULL, 0) &&
  255. bAddPrinterHandle(pUMPD, pInput->clientPid, pInput->hPrinter32, hPrinter))
  256. {
  257. *((PUMPD *) pvOut) = pUMPD;
  258. }
  259. else
  260. {
  261. if (pUMPD)
  262. UnloadUserModePrinterDriver(pUMPD, TRUE, 0);
  263. (*fpClosePrinter)(hPrinter);
  264. WARNING("GdiPrinterThunk: failed to load umpd or add printer handles\n");
  265. }
  266. }
  267. else
  268. {
  269. WARNING(("failed opening printer '%ls' on proxy\n", (PCH)pInput->pPrinterName));
  270. }
  271. }
  272. else
  273. {
  274. WARNING("GdiPrinterThunk: failed loading spooler\n");
  275. }
  276. }
  277. break;
  278. case INDEX_UnloadUMPrinterDrv:
  279. {
  280. PUNLOADDRIVERINPUT pInput = (PUNLOADDRIVERINPUT) pvIn;
  281. PUMPD pUMPD = (PUMPD) pInput->umpdCookie;
  282. PHPRINTERLIST pList;
  283. if (pInput->hPrinter32 &&
  284. (pList = FindPrinterHandle(pUMPD, pInput->clientPid, pInput->hPrinter32)))
  285. {
  286. (*fpClosePrinter)(pList->hPrinter64);
  287. DeletePrinterHandle(pUMPD, pList);
  288. }
  289. UnloadUserModePrinterDriver(pUMPD, pInput->bNotifySpooler, 0);
  290. }
  291. break;
  292. case INDEX_UMDriverFN:
  293. {
  294. PDRVDRIVERFNINPUT pInput = (PDRVDRIVERFNINPUT) pvIn;
  295. PUMPD pUMPD = (PUMPD) pInput->cookie;
  296. BOOL * pbDrvFn = (BOOL *) pvOut;
  297. int index;
  298. if(pUMPD)
  299. {
  300. for(index = 0; index < INDEX_LAST; index++)
  301. pbDrvFn[index] = (pUMPD->apfn[index] != NULL ? TRUE : FALSE);
  302. }
  303. else
  304. {
  305. RtlZeroMemory(pvOut, sizeof(BOOL) * INDEX_LAST);
  306. }
  307. }
  308. break;
  309. case INDEX_DocumentEvent:
  310. {
  311. PDOCUMENTEVENTINPUT pInput = (PDOCUMENTEVENTINPUT) pvIn;
  312. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  313. if (pList)
  314. {
  315. *((int*)pvOut) = (*fpDocumentEvent)(pList->hPrinter64,
  316. pInput->hdc,
  317. pInput->iEsc,
  318. pInput->cjIn,
  319. (PVOID)pInput->pvIn,
  320. pInput->cjOut,
  321. (PVOID)pInput->pvOut);
  322. if (pInput->iEsc == DOCUMENTEVENT_CREATEDCPRE || pInput->iEsc == DOCUMENTEVENT_RESETDCPRE)
  323. {
  324. if ((*((int*)pvOut) != DOCUMENTEVENT_FAILURE) &&
  325. *((DEVMODEW**)pInput->pvOut))
  326. {
  327. RtlCopyMemory(pInput->pdmCopy, *((DEVMODEW**)pInput->pvOut), sizeof(DEVMODEW));
  328. }
  329. }
  330. }
  331. else
  332. *((int*)pvOut) = DOCUMENTEVENT_FAILURE;
  333. }
  334. break;
  335. case INDEX_StartDocPrinterW:
  336. {
  337. PSTARTDOCPRINTERWINPUT pInput = (PSTARTDOCPRINTERWINPUT) pvIn;
  338. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  339. if (pList)
  340. {
  341. *((DWORD*)pvOut) = (*fpStartDocPrinterW)(pList->hPrinter64,
  342. pInput->level,
  343. (LPBYTE)&pInput->docInfo);
  344. pInput->lastError = GetLastError();
  345. }
  346. else
  347. *((DWORD*)pvOut) = 0;
  348. }
  349. break;
  350. case INDEX_StartPagePrinter:
  351. {
  352. PUMPDSIMPLEINPUT pInput = (PUMPDSIMPLEINPUT) pvIn;
  353. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  354. if (pList)
  355. *((BOOL*)pvOut) = (*fpStartPagePrinter)(pList->hPrinter64);
  356. else
  357. *((BOOL*)pvOut) = FALSE;
  358. }
  359. break;
  360. case INDEX_EndPagePrinter:
  361. {
  362. PUMPDSIMPLEINPUT pInput = (PUMPDSIMPLEINPUT) pvIn;
  363. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  364. if (pList)
  365. {
  366. *((BOOL*)pvOut) = (*fpEndPagePrinter)(pList->hPrinter64);
  367. }
  368. else
  369. {
  370. *((BOOL*)pvOut) = FALSE;
  371. }
  372. }
  373. break;
  374. case INDEX_EndDocPrinter:
  375. {
  376. PUMPDSIMPLEINPUT pInput = (PUMPDSIMPLEINPUT) pvIn;
  377. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  378. if (pList)
  379. *((BOOL*)pvOut) = (*fpEndDocPrinter)(pList->hPrinter64);
  380. else
  381. *((BOOL*)pvOut) = FALSE;
  382. }
  383. break;
  384. case INDEX_AbortPrinter:
  385. {
  386. PUMPDSIMPLEINPUT pInput = (PUMPDSIMPLEINPUT) pvIn;
  387. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  388. if (pList)
  389. *((BOOL*)pvOut) = (*fpAbortPrinter)(pList->hPrinter64);
  390. else
  391. *((BOOL*)pvOut) = FALSE;
  392. }
  393. break;
  394. case INDEX_ResetPrinterW:
  395. {
  396. PRESETPRINTERWINPUT pInput = (PRESETPRINTERWINPUT) pvIn;
  397. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  398. if (pList)
  399. {
  400. *((BOOL*)pvOut) = (*fpResetPrinterW)(pList->hPrinter64,
  401. (PRINTER_DEFAULTSW*)&pInput->ptrDef);
  402. }
  403. else
  404. *((BOOL*)pvOut) = FALSE;
  405. }
  406. break;
  407. case INDEX_QueryColorProfile:
  408. {
  409. PQUERYCOLORPROFILEINPUT pInput = (PQUERYCOLORPROFILEINPUT) pvIn;
  410. ULONG cjProfileSizeOld = pInput->cjProfileSize;
  411. PHPRINTERLIST pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, pInput->hPrinter32);
  412. if (pList)
  413. {
  414. *((BOOL*)pvOut) = (*fpQueryColorProfile)(pList->hPrinter64,
  415. pInput->pDevMode,
  416. pInput->ulQueryMode,
  417. pInput->pvProfileData,
  418. &pInput->cjProfileSize,
  419. &pInput->flProfileFlag);
  420. if ((*(INT*)pvOut) == 0 &&
  421. pInput->cjProfileSize > cjProfileSizeOld &&
  422. (GetLastError() == ERROR_INSUFFICIENT_BUFFER))
  423. {
  424. pInput->lastError = GetLastError();
  425. }
  426. }
  427. else
  428. *((BOOL*)pvOut) = FALSE;
  429. }
  430. break;
  431. case INDEX_UMPDDrvEnableDriver: // special index for DrvEnableDriver
  432. {
  433. PDRVENABLEDRIVERINPUT pInput = (PDRVENABLEDRIVERINPUT) pvIn;
  434. *((PUMPD *) pvOut) = UMPDDrvEnableDriver(pInput->pwszDriver, DDI_DRIVER_VERSION_NT5_01_SP1);
  435. }
  436. break;
  437. case INDEX_DrvEnablePDEV:
  438. {
  439. PDRVENABLEPDEVINPUT pInput = (PDRVENABLEPDEVINPUT) pvIn;
  440. PUMPD pUMPD = (PUMPD) pInput->umpdCookie;
  441. PFN pfn = pUMPD->apfn[INDEX_DrvEnablePDEV];
  442. PUMDHPDEV pUMdhpdev;
  443. HANDLE hPrinter = NULL;
  444. PHPRINTERLIST pList;
  445. // If we have a local hPrinter use it
  446. if (pInput->bWOW64 &&
  447. (pList = FindPrinterHandle((PUMPD)pInput->umpdCookie, pInput->clientPid, HandleToUlong(pInput->hPrinter))))
  448. {
  449. hPrinter = pList->hPrinter64;
  450. }
  451. else
  452. {
  453. hPrinter = pInput->hPrinter;
  454. }
  455. if (pUMdhpdev = (PUMDHPDEV) LOCALALLOC(sizeof(UMDHPDEV)))
  456. {
  457. ZeroMemory(pUMdhpdev, sizeof(UMDHPDEV));
  458. pUMdhpdev->pUMPD = pUMPD;
  459. pUMdhpdev->dhpdev = (DHPDEV) pfn(
  460. pInput->pdm,
  461. pInput->pLogAddress,
  462. pInput->cPatterns,
  463. pInput->phsurfPatterns,
  464. pInput->cjCaps,
  465. pInput->pdevcaps,
  466. pInput->cjDevInfo,
  467. pInput->pDevInfo,
  468. pInput->hdev,
  469. pInput->pDeviceName,
  470. hPrinter);
  471. if (pUMdhpdev->dhpdev == NULL)
  472. {
  473. WARNING ("Driver's DrvEnablePDEV failed\n");
  474. LOCALFREE(pUMdhpdev);
  475. pUMdhpdev = NULL;
  476. }
  477. #if defined(_WIN64)
  478. else
  479. {
  480. if (pInput->bWOW64 && pInput->pdevcaps)
  481. {
  482. GDIINFO *pGdiInfo = (GDIINFO*)pInput->pdevcaps;
  483. if (pGdiInfo->ulHTPatternSize == HT_PATSIZE_USER &&
  484. pGdiInfo->cxHTPat <= HT_USERPAT_CX_MAX &&
  485. pGdiInfo->cyHTPat <= HT_USERPAT_CY_MAX)
  486. {
  487. pInput->cxHTPat = pGdiInfo->cxHTPat;
  488. pInput->cyHTPat = pGdiInfo->cyHTPat;
  489. pInput->bHTPatA = pGdiInfo->pHTPatA ? TRUE : FALSE;
  490. pInput->bHTPatB = pGdiInfo->pHTPatB ? TRUE : FALSE;
  491. pInput->bHTPatC = pGdiInfo->pHTPatC ? TRUE : FALSE;
  492. if (pInput->bHTPatA)
  493. {
  494. RtlCopyMemory(pInput->pHTPatA,
  495. pGdiInfo->pHTPatA,
  496. pInput->cxHTPat*
  497. pInput->cyHTPat);
  498. }
  499. if (pInput->bHTPatB)
  500. {
  501. RtlCopyMemory(pInput->pHTPatB,
  502. pGdiInfo->pHTPatB,
  503. pInput->cxHTPat*
  504. pInput->cyHTPat);
  505. }
  506. if (pInput->bHTPatC)
  507. {
  508. RtlCopyMemory(pInput->pHTPatC,
  509. pGdiInfo->pHTPatC,
  510. pInput->cxHTPat*
  511. pInput->cyHTPat);
  512. }
  513. }
  514. }
  515. }
  516. #endif
  517. }
  518. else
  519. {
  520. WARNING ("umEnablePDEV failed memory allocation \n");
  521. }
  522. *((DHPDEV *) pvOut) = (DHPDEV) pUMdhpdev;
  523. }
  524. break;
  525. case INDEX_DrvCompletePDEV:
  526. {
  527. PDRVCOMPLETEPDEVINPUT pInput = (PDRVCOMPLETEPDEVINPUT) pvIn;
  528. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  529. PUMPD pUMPD = pUMdhpdev->pUMPD;
  530. PFN pfn = pUMPD->apfn[INDEX_DrvCompletePDEV];
  531. pfn(pUMdhpdev->dhpdev, pInput->hdev);
  532. }
  533. break;
  534. case INDEX_DrvFree:
  535. {
  536. PDRVFREEINPUT pInput = (PDRVFREEINPUT) pvIn;
  537. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  538. PUMPD pUMPD = pUMdhpdev->pUMPD;
  539. PFN pfn = pUMPD->apfn[INDEX_DrvFree];
  540. if (pfn)
  541. pfn(pInput->pv, pInput->id);
  542. }
  543. break;
  544. case INDEX_DrvResetPDEV:
  545. {
  546. PDRVRESETPDEVINPUT pInput = (PDRVRESETPDEVINPUT) pvIn;
  547. PUMDHPDEV pUMdhpdevOld= (PUMDHPDEV) pInput->dhpdevOld;
  548. PUMDHPDEV pUMdhpdevNew= (PUMDHPDEV) pInput->dhpdevNew;
  549. PUMPD pUMPDNew = pUMdhpdevNew->pUMPD;
  550. PFN pfn = pUMPDNew->apfn[INDEX_DrvResetPDEV];
  551. *((BOOL *) pvOut) = (BOOL)pfn(pUMdhpdevOld->dhpdev, pUMdhpdevNew->dhpdev);
  552. }
  553. break;
  554. case INDEX_DrvDisablePDEV:
  555. {
  556. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)((PDHPDEVINPUT)pvIn)->dhpdev;
  557. PUMPD pUMPD = pUMdhpdev->pUMPD;
  558. PFN pfn = pUMPD->apfn[INDEX_DrvDisablePDEV];
  559. pfn(pUMdhpdev->dhpdev);
  560. // free up memory allocated for user mode printer drivers
  561. if (pUMdhpdev)
  562. {
  563. LOCALFREE (pUMdhpdev);
  564. }
  565. }
  566. break;
  567. case INDEX_DrvEnableSurface:
  568. {
  569. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)((PDHPDEVINPUT)pvIn)->dhpdev;
  570. PUMPD pUMPD = pUMdhpdev->pUMPD;
  571. PFN pfn = pUMPD->apfn[INDEX_DrvEnableSurface];
  572. *((HSURF *) pvOut) = (HSURF) pfn(pUMdhpdev->dhpdev);
  573. }
  574. break;
  575. case INDEX_DrvDisableSurface:
  576. {
  577. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)((PDHPDEVINPUT)pvIn)->dhpdev;
  578. PUMPD pUMPD = pUMdhpdev->pUMPD;
  579. PFN pfn = pUMPD->apfn[INDEX_DrvDisableSurface];
  580. pfn(pUMdhpdev->dhpdev);
  581. }
  582. break;
  583. case INDEX_DrvStartDoc:
  584. {
  585. PDRVSTARTDOCINPUT pInput = (PDRVSTARTDOCINPUT)pvIn;
  586. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  587. //
  588. // check to make sure we have a dhpdev in the surface
  589. // neither Unidrv or Pscript checks if EngAssociateSurface is
  590. // successful or not
  591. //
  592. if (pUMdhpdev)
  593. {
  594. PUMPD pUMPD = pUMdhpdev->pUMPD;
  595. PFN pfn = pUMPD->apfn[INDEX_DrvStartDoc];
  596. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso, pInput->pwszDocName, pInput->dwJobId);
  597. }
  598. else
  599. *(BOOL *)pvOut = FALSE;
  600. }
  601. break;
  602. case INDEX_DrvEndDoc:
  603. {
  604. PDRVENDDOCINPUT pInput = (PDRVENDDOCINPUT)pvIn;
  605. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  606. PUMPD pUMPD = pUMdhpdev->pUMPD;
  607. PFN pfn = pUMPD->apfn[INDEX_DrvEndDoc];
  608. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso, pInput->fl );
  609. }
  610. break;
  611. case INDEX_DrvStartPage:
  612. {
  613. PSURFOBJINPUT pInput = (PSURFOBJINPUT)pvIn;
  614. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  615. PUMPD pUMPD = pUMdhpdev->pUMPD;
  616. PFN pfn = pUMPD->apfn[INDEX_DrvStartPage];
  617. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso);
  618. }
  619. break;
  620. case INDEX_DrvSendPage:
  621. {
  622. PSURFOBJINPUT pInput = (PSURFOBJINPUT)pvIn;
  623. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  624. PUMPD pUMPD = pUMdhpdev->pUMPD;
  625. PFN pfn = pUMPD->apfn[INDEX_DrvSendPage];
  626. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso);
  627. }
  628. break;
  629. case INDEX_DrvEscape:
  630. {
  631. PDRVESCAPEINPUT pInput = (PDRVESCAPEINPUT) pvIn;
  632. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  633. PUMPD pUMPD = pUMdhpdev->pUMPD;
  634. PFN pfn = pUMPD->apfn[INDEX_DrvEscape];
  635. *((ULONG *) pvOut) = (ULONG) pfn(pInput->pso,
  636. pInput->iEsc,
  637. pInput->cjIn,
  638. pInput->pvIn,
  639. pInput->cjOut,
  640. pInput->pvOut);
  641. }
  642. break;
  643. case INDEX_DrvDrawEscape:
  644. {
  645. PDRVDRAWESCAPEINPUT pInput = (PDRVDRAWESCAPEINPUT) pvIn;
  646. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  647. PUMPD pUMPD = pUMdhpdev->pUMPD;
  648. PFN pfn = pUMPD->apfn[INDEX_DrvDrawEscape];
  649. *((ULONG *) pvOut) = (ULONG) pfn(pInput->pso,
  650. pInput->iEsc,
  651. pInput->pco,
  652. pInput->prcl,
  653. pInput->cjIn,
  654. pInput->pvIn);
  655. }
  656. break;
  657. case INDEX_DrvStartBanding:
  658. {
  659. PDRVBANDINGINPUT pInput = (PDRVBANDINGINPUT)pvIn;
  660. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  661. PUMPD pUMPD = pUMdhpdev->pUMPD;
  662. PFN pfn = pUMPD->apfn[INDEX_DrvStartBanding];
  663. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso, pInput->pptl);
  664. }
  665. break;
  666. case INDEX_DrvQueryPerBandInfo:
  667. {
  668. PDRVPERBANDINPUT pInput = (PDRVPERBANDINPUT)pvIn;
  669. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  670. PUMPD pUMPD = pUMdhpdev->pUMPD;
  671. PFN pfn = pUMPD->apfn[INDEX_DrvQueryPerBandInfo];
  672. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso, pInput->pbi);
  673. }
  674. break;
  675. case INDEX_DrvNextBand:
  676. {
  677. PDRVBANDINGINPUT pInput = (PDRVBANDINGINPUT)pvIn;
  678. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  679. PUMPD pUMPD = pUMdhpdev->pUMPD;
  680. PFN pfn = pUMPD->apfn[INDEX_DrvNextBand];
  681. *((BOOL *) pvOut) = (BOOL)pfn(pInput->pso, pInput->pptl);
  682. }
  683. break;
  684. case INDEX_DrvBitBlt:
  685. {
  686. PDRVBITBLTINPUT pInput = (PDRVBITBLTINPUT)pvIn;
  687. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  688. PUMPD pUMPD = pUMdhpdev->pUMPD;
  689. PFN pfn = pUMPD->apfn[INDEX_DrvBitBlt];
  690. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  691. pInput->psoSrc,
  692. pInput->psoMask,
  693. pInput->pco,
  694. pInput->pxlo,
  695. pInput->prclTrg,
  696. pInput->pptlSrc,
  697. pInput->pptlMask,
  698. pInput->pbo,
  699. pInput->pptlBrush,
  700. pInput->rop4);
  701. if (bWOW64 && pInput->pbo)
  702. {
  703. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  704. }
  705. }
  706. break;
  707. case INDEX_DrvStretchBlt:
  708. {
  709. PDRVSTRETCHBLTINPUT pInput = (PDRVSTRETCHBLTINPUT)pvIn;
  710. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  711. PUMPD pUMPD = pUMdhpdev->pUMPD;
  712. PFN pfn = pUMPD->apfn[INDEX_DrvStretchBlt];
  713. *((BOOL *) pvOut) = (BOOL) pfn (pInput->psoTrg,
  714. pInput->psoSrc,
  715. pInput->psoMask,
  716. pInput->pco,
  717. pInput->pxlo,
  718. pInput->pca,
  719. pInput->pptlHTOrg,
  720. pInput->prclTrg,
  721. pInput->prclSrc,
  722. pInput->pptlMask,
  723. pInput->iMode);
  724. }
  725. break;
  726. case INDEX_DrvStretchBltROP:
  727. {
  728. PDRVSTRETCHBLTINPUT pInput = (PDRVSTRETCHBLTINPUT)pvIn;
  729. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  730. PUMPD pUMPD = pUMdhpdev->pUMPD;
  731. PFN pfn = pUMPD->apfn[INDEX_DrvStretchBltROP];
  732. *((BOOL *) pvOut) = (BOOL) pfn (pInput->psoTrg,
  733. pInput->psoSrc,
  734. pInput->psoMask,
  735. pInput->pco,
  736. pInput->pxlo,
  737. pInput->pca,
  738. pInput->pptlHTOrg,
  739. pInput->prclTrg,
  740. pInput->prclSrc,
  741. pInput->pptlMask,
  742. pInput->iMode,
  743. pInput->pbo,
  744. pInput->rop4);
  745. if (bWOW64 && pInput->pbo)
  746. {
  747. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  748. }
  749. }
  750. break;
  751. case INDEX_DrvPlgBlt:
  752. {
  753. PDRVPLGBLTINPUT pInput = (PDRVPLGBLTINPUT)pvIn;
  754. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  755. PUMPD pUMPD = pUMdhpdev->pUMPD;
  756. PFN pfn = pUMPD->apfn[INDEX_DrvPlgBlt];
  757. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  758. pInput->psoSrc,
  759. pInput->psoMask,
  760. pInput->pco,
  761. pInput->pxlo,
  762. pInput->pca,
  763. pInput->pptlBrushOrg,
  764. pInput->pptfx,
  765. pInput->prcl,
  766. pInput->pptl,
  767. pInput->iMode);
  768. }
  769. break;
  770. case INDEX_DrvCopyBits:
  771. {
  772. PDRVCOPYBITSINPUT pInput = (PDRVCOPYBITSINPUT) pvIn;
  773. PUMDHPDEV pUMdhpdev;
  774. PUMPD pUMPD;
  775. PFN pfn;
  776. SURFOBJ *pso;
  777. //
  778. // Special case when psoSrc is a device surface and
  779. // psoTrg is a bitmap surface. This is used by the engine
  780. // during simulation of certain drawing calls.
  781. //
  782. pso = (pInput->psoTrg->iType == STYPE_BITMAP &&
  783. pInput->psoTrg->dhpdev == NULL) ?
  784. pInput->psoSrc :
  785. pInput->psoTrg;
  786. if (pso && (pUMdhpdev = AdjustUMdhpdev(pso)))
  787. {
  788. pUMPD = pUMdhpdev->pUMPD;
  789. pfn = pUMPD->apfn[INDEX_DrvCopyBits];
  790. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  791. pInput->psoSrc,
  792. pInput->pco,
  793. pInput->pxlo,
  794. pInput->prclTrg,
  795. pInput->pptlSrc);
  796. }
  797. else
  798. {
  799. *((BOOL *) pvOut) = FALSE;
  800. }
  801. }
  802. break;
  803. case INDEX_DrvRealizeBrush:
  804. {
  805. PDRVREALIZEBRUSHINPUT pInput = (PDRVREALIZEBRUSHINPUT)pvIn;
  806. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  807. PUMPD pUMPD = pUMdhpdev->pUMPD;
  808. PFN pfn = pUMPD->apfn[INDEX_DrvRealizeBrush];
  809. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pbo,
  810. pInput->psoTrg,
  811. pInput->psoPat,
  812. pInput->psoMsk,
  813. pInput->pxlo,
  814. pInput->iHatch);
  815. }
  816. break;
  817. case INDEX_DrvLineTo:
  818. {
  819. PDRVLINETOINPUT pInput = (PDRVLINETOINPUT)pvIn;
  820. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  821. PUMPD pUMPD = pUMdhpdev->pUMPD;
  822. PFN pfn = pUMPD->apfn[INDEX_DrvLineTo];
  823. *((BOOL *) pvOut) = (BOOL) pfn (pInput->pso,
  824. pInput->pco,
  825. pInput->pbo,
  826. pInput->x1,
  827. pInput->y1,
  828. pInput->x2,
  829. pInput->y2,
  830. pInput->prclBounds,
  831. pInput->mix);
  832. if (bWOW64 && pInput->pbo)
  833. {
  834. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  835. }
  836. }
  837. break;
  838. case INDEX_DrvStrokePath:
  839. {
  840. PSTROKEANDFILLINPUT pInput = (PSTROKEANDFILLINPUT)pvIn;
  841. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  842. PUMPD pUMPD = pUMdhpdev->pUMPD;
  843. PFN pfn = pUMPD->apfn[INDEX_DrvStrokePath];
  844. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso,
  845. pInput->ppo,
  846. pInput->pco,
  847. pInput->pxo,
  848. pInput->pbo,
  849. pInput->pptlBrushOrg,
  850. pInput->plineattrs,
  851. pInput->mix);
  852. if (bWOW64 && pInput->pbo)
  853. {
  854. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  855. }
  856. }
  857. break;
  858. case INDEX_DrvFillPath:
  859. {
  860. PSTROKEANDFILLINPUT pInput = (PSTROKEANDFILLINPUT)pvIn;
  861. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  862. PUMPD pUMPD = pUMdhpdev->pUMPD;
  863. PFN pfn = pUMPD->apfn[INDEX_DrvFillPath];
  864. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso,
  865. pInput->ppo,
  866. pInput->pco,
  867. pInput->pbo,
  868. pInput->pptlBrushOrg,
  869. pInput->mix,
  870. pInput->flOptions);
  871. if (bWOW64 && pInput->pbo)
  872. {
  873. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  874. }
  875. }
  876. break;
  877. case INDEX_DrvStrokeAndFillPath:
  878. {
  879. PSTROKEANDFILLINPUT pInput = (PSTROKEANDFILLINPUT)pvIn;
  880. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  881. PUMPD pUMPD = pUMdhpdev->pUMPD;
  882. PFN pfn = pUMPD->apfn[INDEX_DrvStrokeAndFillPath];
  883. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso,
  884. pInput->ppo,
  885. pInput->pco,
  886. pInput->pxo,
  887. pInput->pbo,
  888. pInput->plineattrs,
  889. pInput->pboFill,
  890. pInput->pptlBrushOrg,
  891. pInput->mix,
  892. pInput->flOptions);
  893. if (bWOW64 && (pInput->pbo || pInput->pboFill))
  894. {
  895. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, pInput->pboFill);
  896. }
  897. }
  898. break;
  899. case INDEX_DrvPaint:
  900. {
  901. PSTROKEANDFILLINPUT pInput = (PSTROKEANDFILLINPUT)pvIn;
  902. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  903. PUMPD pUMPD = pUMdhpdev->pUMPD;
  904. PFN pfn = pUMPD->apfn[INDEX_DrvPaint];
  905. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso,
  906. pInput->pco,
  907. pInput->pbo,
  908. pInput->pptlBrushOrg,
  909. pInput->mix);
  910. if (bWOW64 && pInput->pbo)
  911. {
  912. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pbo, NULL);
  913. }
  914. }
  915. break;
  916. case INDEX_DrvGradientFill:
  917. {
  918. PGRADIENTINPUT pInput = (PGRADIENTINPUT)pvIn;
  919. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  920. PUMPD pUMPD = pUMdhpdev->pUMPD;
  921. PFN pfn = pUMPD->apfn[INDEX_DrvGradientFill];
  922. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  923. pInput->pco,
  924. pInput->pxlo,
  925. pInput->pVertex,
  926. pInput->nVertex,
  927. pInput->pMesh,
  928. pInput->nMesh,
  929. pInput->prclExtents,
  930. pInput->pptlDitherOrg,
  931. pInput->ulMode);
  932. }
  933. break;
  934. case INDEX_DrvAlphaBlend:
  935. {
  936. PALPHAINPUT pInput = (PALPHAINPUT)pvIn;
  937. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  938. PUMPD pUMPD = pUMdhpdev->pUMPD;
  939. PFN pfn = pUMPD->apfn[INDEX_DrvAlphaBlend];
  940. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  941. pInput->psoSrc,
  942. pInput->pco,
  943. pInput->pxlo,
  944. pInput->prclDest,
  945. pInput->prclSrc,
  946. pInput->pBlendObj);
  947. }
  948. break;
  949. case INDEX_DrvTransparentBlt:
  950. {
  951. PTRANSPARENTINPUT pInput = (PTRANSPARENTINPUT)pvIn;
  952. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->psoTrg);
  953. PUMPD pUMPD = pUMdhpdev->pUMPD;
  954. PFN pfn = pUMPD->apfn[INDEX_DrvTransparentBlt];
  955. *((BOOL *) pvOut) = (BOOL) pfn(pInput->psoTrg,
  956. pInput->psoSrc,
  957. pInput->pco,
  958. pInput->pxlo,
  959. pInput->prclDst,
  960. pInput->prclSrc,
  961. pInput->TransColor,
  962. pInput->ulReserved);
  963. }
  964. break;
  965. case INDEX_DrvTextOut:
  966. {
  967. PTEXTOUTINPUT pInput = (PTEXTOUTINPUT)pvIn;
  968. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  969. PUMPD pUMPD = pUMdhpdev->pUMPD;
  970. PFN pfn = pUMPD->apfn[INDEX_DrvTextOut];
  971. *((BOOL *) pvOut) = (BOOL) pfn(pInput->pso,
  972. pInput->pstro,
  973. pInput->pfo,
  974. pInput->pco,
  975. pInput->prclExtra,
  976. pInput->prclOpaque,
  977. pInput->pboFore,
  978. pInput->pboOpaque,
  979. pInput->pptlOrg,
  980. pInput->mix);
  981. if (bWOW64 && (pInput->pboFore || pInput->pboOpaque))
  982. {
  983. NtGdiBRUSHOBJ_DeleteRbrush(pInput->pboFore, pInput->pboOpaque);
  984. }
  985. }
  986. break;
  987. case INDEX_DrvQueryFont:
  988. {
  989. PQUERYFONTINPUT pInput = (PQUERYFONTINPUT)pvIn;
  990. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)(pInput->dhpdev);
  991. PUMPD pUMPD = pUMdhpdev->pUMPD;
  992. PFN pfn = pUMPD->apfn[INDEX_DrvQueryFont];
  993. *((PIFIMETRICS *) pvOut) = (PIFIMETRICS) pfn(
  994. pUMdhpdev->dhpdev,
  995. pInput->iFile,
  996. pInput->iFace,
  997. pInput->pid);
  998. if (pInput->iFace && *((PIFIMETRICS*)pvOut) && pInput->pv)
  999. {
  1000. ASSERTGDI(pInput->cjMaxData >= (*(PIFIMETRICS*)pvOut)->cjThis, "gdi32!GdiPrinterThunk: not enough buffer for ifimetrics\n");
  1001. if (pInput->cjMaxData >= (*(PIFIMETRICS*)pvOut)->cjThis)
  1002. {
  1003. RtlCopyMemory(pInput->pv, (PBYTE)(*(PIFIMETRICS*)pvOut), (*(PIFIMETRICS*)pvOut)->cjThis);
  1004. }
  1005. else
  1006. {
  1007. iRet = -1;
  1008. WARNING(("Not enough buffer for ifimetrics cjMaxData: 0x%lx cjSize: 0x%lx pInput.pv %lp pvOut %lp\n",
  1009. pInput->cjMaxData, (*(PIFIMETRICS*)pvOut)->cjThis, pInput->pv, pvOut));
  1010. pInput->cjMaxData = 0;
  1011. }
  1012. }
  1013. }
  1014. break;
  1015. case INDEX_DrvQueryFontTree:
  1016. {
  1017. PQUERYFONTINPUT pInput = (PQUERYFONTINPUT)pvIn;
  1018. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)(pInput->dhpdev);
  1019. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1020. PFN pfn = pUMPD->apfn[INDEX_DrvQueryFontTree];
  1021. ULONG cjSize = 0;
  1022. FD_GLYPHSET* pfdg;
  1023. *((PVOID *) pvOut) = (PVOID) pfn (pUMdhpdev->dhpdev,
  1024. pInput->iFile,
  1025. pInput->iFace,
  1026. pInput->iMode,
  1027. pInput->pid);
  1028. if (pInput->iMode == QFT_GLYPHSET && *((FD_GLYPHSET**)pvOut) && pInput->pv)
  1029. {
  1030. pfdg = *((FD_GLYPHSET**)pvOut);
  1031. cjSize = offsetof(FD_GLYPHSET, awcrun) + pfdg->cRuns * sizeof(WCRUN) + pfdg->cGlyphsSupported * sizeof(HGLYPH);
  1032. ASSERTGDI(pInput->cjMaxData >= cjSize, "gdi32!GdiPrinterThunk: not enough buffer for glyphset\n");
  1033. if ((pInput->cjMaxData < cjSize) ||
  1034. !GdiCopyFD_GLYPHSET((FD_GLYPHSET*)pInput->pv, pfdg, cjSize))
  1035. {
  1036. WARNING("GDI32: Not enough bufer or error copying FD_GLYPHSET\n");
  1037. pInput->cjMaxData = 0;
  1038. iRet = -1;
  1039. }
  1040. }
  1041. else if (pInput->iMode == QFT_KERNPAIRS && *(FD_KERNINGPAIR **)pvOut && pInput->pv)
  1042. {
  1043. FD_KERNINGPAIR *pkpEnd = *(FD_KERNINGPAIR **)pvOut;
  1044. while ((pkpEnd->wcFirst) || (pkpEnd->wcSecond) || (pkpEnd->fwdKern))
  1045. {
  1046. pkpEnd += 1;
  1047. cjSize++;
  1048. }
  1049. cjSize = (cjSize + 1) * sizeof(FD_KERNINGPAIR);
  1050. ASSERTGDI(pInput->cjMaxData >= cjSize, "gdi32!GdiPrinterThunk: not enough buffer for Kerningpairs\n");
  1051. if (pInput->cjMaxData >= cjSize)
  1052. {
  1053. RtlCopyMemory(pInput->pv, (PBYTE)(*(FD_KERNINGPAIR **)pvOut), cjSize);
  1054. }
  1055. else
  1056. {
  1057. WARNING(("Not enough buffer forkerningpair cjMaxData: 0x%lx cjSize: 0x%lx pInput.pv %lp pvOut %lp\n",
  1058. pInput->cjMaxData, cjSize, pInput->pv, pvOut));
  1059. pInput->cjMaxData = 0;
  1060. iRet = -1;
  1061. }
  1062. }
  1063. }
  1064. break;
  1065. case INDEX_DrvQueryFontData:
  1066. {
  1067. PQUERYFONTDATAINPUT pInput = (PQUERYFONTDATAINPUT)pvIn;
  1068. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)(pInput->dhpdev);
  1069. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1070. PFN pfn = pUMPD->apfn[INDEX_DrvQueryFontData];
  1071. *((ULONG *) pvOut) = (ULONG)pfn (pUMdhpdev->dhpdev,
  1072. pInput->pfo,
  1073. pInput->iMode,
  1074. pInput->hg,
  1075. pInput->pgd,
  1076. pInput->pv,
  1077. pInput->cjSize);
  1078. }
  1079. break;
  1080. case INDEX_DrvQueryAdvanceWidths:
  1081. {
  1082. PQUERYADVWIDTHSINPUT pInput = (PQUERYADVWIDTHSINPUT)pvIn;
  1083. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)(pInput->dhpdev);
  1084. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1085. PFN pfn = pUMPD->apfn[INDEX_DrvQueryAdvanceWidths];
  1086. *((BOOL *) pvOut) = (BOOL)pfn (pUMdhpdev->dhpdev,
  1087. pInput->pfo,
  1088. pInput->iMode,
  1089. pInput->phg,
  1090. pInput->pvWidths,
  1091. pInput->cGlyphs);
  1092. }
  1093. break;
  1094. case INDEX_DrvGetGlyphMode:
  1095. {
  1096. PQUERYFONTDATAINPUT pInput = (PQUERYFONTDATAINPUT)pvIn;
  1097. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)(pInput->dhpdev);
  1098. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1099. PFN pfn = pUMPD->apfn[INDEX_DrvGetGlyphMode];
  1100. *((ULONG *) pvOut) = (ULONG) pfn (pUMdhpdev->dhpdev, pInput->pfo);
  1101. }
  1102. break;
  1103. case INDEX_DrvFontManagement:
  1104. {
  1105. PFONTMANAGEMENTINPUT pInput = (PFONTMANAGEMENTINPUT)pvIn;
  1106. PUMDHPDEV pUMdhpdev;
  1107. PUMPD pUMPD;
  1108. PFN pfn;
  1109. if (pInput->iMode == QUERYESCSUPPORT)
  1110. pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  1111. else
  1112. pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  1113. pUMPD = pUMdhpdev->pUMPD;
  1114. pfn = pUMPD->apfn[INDEX_DrvFontManagement];
  1115. *((ULONG *) pvOut) = (ULONG)pfn(pInput->pso,
  1116. pInput->pfo,
  1117. pInput->iMode,
  1118. pInput->cjIn,
  1119. pInput->pvIn,
  1120. pInput->cjOut,
  1121. pInput->pvOut);
  1122. }
  1123. break;
  1124. case INDEX_DrvDitherColor:
  1125. {
  1126. PDRVDITHERCOLORINPUT pInput = (PDRVDITHERCOLORINPUT)pvIn;
  1127. PUMDHPDEV pUMdhpdev = (PUMDHPDEV)pInput->dhpdev;
  1128. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1129. PFN pfn = pUMPD->apfn[INDEX_DrvDitherColor];
  1130. *((ULONG *) pvOut) = (ULONG)pfn(pUMdhpdev->dhpdev,
  1131. pInput->iMode,
  1132. pInput->rgb,
  1133. pInput->pul);
  1134. }
  1135. break;
  1136. case INDEX_DrvDeleteDeviceBitmap:
  1137. {
  1138. PDRVDELETEDEVBITMAP pInput = (PDRVDELETEDEVBITMAP) pvIn;
  1139. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  1140. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1141. PFN pfn = pUMPD->apfn[INDEX_DrvDeleteDeviceBitmap];
  1142. pfn(pUMdhpdev->dhpdev, pInput->dhsurf);
  1143. }
  1144. break;
  1145. case INDEX_DrvIcmDeleteColorTransform:
  1146. {
  1147. PDRVICMDELETECOLOR pInput = (PDRVICMDELETECOLOR)pvIn;
  1148. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  1149. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1150. PFN pfn = pUMPD->apfn[INDEX_DrvIcmDeleteColorTransform];
  1151. *((BOOL *) pvOut) = (BOOL)pfn(pUMdhpdev->dhpdev, pInput->hcmXform);
  1152. }
  1153. break;
  1154. case INDEX_DrvIcmCreateColorTransform:
  1155. {
  1156. PDRVICMCREATECOLORINPUT pInput = (PDRVICMCREATECOLORINPUT) pvIn;
  1157. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  1158. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1159. PFN pfn = pUMPD->apfn[INDEX_DrvIcmCreateColorTransform];
  1160. *((HANDLE *) pvOut) = (HANDLE)pfn(pUMdhpdev->dhpdev,
  1161. pInput->pLogColorSpace,
  1162. pInput->pvSourceProfile,
  1163. pInput->cjSourceProfile,
  1164. pInput->pvDestProfile,
  1165. pInput->cjDestProfile,
  1166. pInput->pvTargetProfile,
  1167. pInput->cjTargetProfile,
  1168. pInput->dwReserved);
  1169. }
  1170. break;
  1171. case INDEX_DrvIcmCheckBitmapBits:
  1172. {
  1173. PDRVICMCHECKBITMAPINPUT pInput = (PDRVICMCHECKBITMAPINPUT) pvIn;
  1174. PUMDHPDEV pUMdhpdev = (PUMDHPDEV) pInput->dhpdev;
  1175. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1176. PFN pfn = pUMPD->apfn[INDEX_DrvIcmCheckBitmapBits];
  1177. pfn(pUMdhpdev->dhpdev,
  1178. pInput->hColorTransform,
  1179. pInput->pso,
  1180. pInput->paResults);
  1181. }
  1182. break;
  1183. case INDEX_DrvQueryDeviceSupport:
  1184. {
  1185. PDRVQUERYDEVICEINPUT pInput = (PDRVQUERYDEVICEINPUT) pvIn;
  1186. PUMDHPDEV pUMdhpdev = AdjustUMdhpdev(pInput->pso);
  1187. PUMPD pUMPD = pUMdhpdev->pUMPD;
  1188. PFN pfn = pUMPD->apfn[INDEX_DrvQueryDeviceSupport];
  1189. *((ULONG *) pvOut) = (ULONG) pfn(pInput->pso,
  1190. pInput->pxlo,
  1191. pInput->pxo,
  1192. pInput->iType,
  1193. pInput->cjIn,
  1194. pInput->pvIn,
  1195. pInput->cjOut,
  1196. pInput->pvOut);
  1197. }
  1198. break;
  1199. case INDEX_UMPDAllocUserMem:
  1200. {
  1201. PUMPDALLOCUSERMEMINPUT pInput = (PUMPDALLOCUSERMEMINPUT) pvIn;
  1202. ASSERTGDI(bWOW64, "Calling INDEX_UMPDAllocUserMem during NONE wow64 printing\n");
  1203. *((KERNEL_PVOID*)pvOut) = UMPDAllocUserMem(pInput->cjSize);
  1204. }
  1205. break;
  1206. case INDEX_UMPDCopyMemory:
  1207. {
  1208. PUMPDCOPYMEMINPUT pInput = (PUMPDCOPYMEMINPUT) pvIn;
  1209. ASSERTGDI(bWOW64, "Calling INDEX_UMPDCopyMemory during NONE wow64 printing\n");
  1210. *((KERNEL_PVOID*)pvOut) = UMPDCopyMemory(pInput->pvSrc,
  1211. pInput->pvDest,
  1212. pInput->cjSize);
  1213. }
  1214. break;
  1215. case INDEX_UMPDFreeMemory:
  1216. {
  1217. PUMPDFREEMEMINPUT pInput = (PUMPDFREEMEMINPUT) pvIn;
  1218. ASSERTGDI(bWOW64, "Calling INDEX_UMPDFreeMemory during NONE wow64 printing\n");
  1219. *((BOOL*)pvOut) = UMPDFreeMemory(pInput->pvTrg,
  1220. pInput->pvSrc,
  1221. pInput->pvMsk);
  1222. }
  1223. break;
  1224. case INDEX_UMPDEngFreeUserMem:
  1225. {
  1226. PUMPDFREEMEMINPUT pInput = (PUMPDFREEMEMINPUT) pvIn;
  1227. if (bWOW64)
  1228. {
  1229. *((BOOL*)pvOut) = NtGdiUMPDEngFreeUserMem(&pInput->pvTrg);
  1230. }
  1231. }
  1232. break;
  1233. default:
  1234. WARNING ("Drv call is not supported\n");
  1235. iRet = GPT_ERROR;
  1236. break;
  1237. }
  1238. if (bSetPUMPD)
  1239. {
  1240. NtGdiSetPUMPDOBJ(hSaved, FALSE, &pumpdthdr->humpd, NULL);
  1241. }
  1242. return (iRet);
  1243. }
  1244. #endif // !_GDIPLUS_