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.

1308 lines
30 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. oemutil.h
  5. Abstract:
  6. Declarations used to implement OEM plugin architecture
  7. Environment:
  8. Windows NT printer driver
  9. Revision History:
  10. 01/21/97 -davidx-
  11. Created it.
  12. 04/01/97 -zhanw-
  13. Added Unidrv specific DDI hooks (OEMDitherColor, OEMNextBand, OEMStartBanding,
  14. OEMPaint, OEMLineTo).
  15. --*/
  16. #ifndef _OEMUTIL_H_
  17. #define _OEMUTIL_H_
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #ifdef WINNT_40
  22. #undef IsEqualGUID
  23. #define IsEqualGUID(rguid1, rguid2) \
  24. (((PLONG) rguid1)[0] == ((PLONG) rguid2)[0] && \
  25. ((PLONG) rguid1)[1] == ((PLONG) rguid2)[1] && \
  26. ((PLONG) rguid1)[2] == ((PLONG) rguid2)[2] && \
  27. ((PLONG) rguid1)[3] == ((PLONG) rguid2)[3])
  28. #include <wtypes.h>
  29. #endif
  30. typedef BOOL (APIENTRY *PFN_OEMGetInfo)(
  31. DWORD dwMode,
  32. PVOID pBuffer,
  33. DWORD cbSize,
  34. PDWORD pcbNeeded
  35. );
  36. typedef BOOL (APIENTRY *PFN_OEMDriverDMS)(
  37. PVOID pDevObj,
  38. PVOID pBuffer,
  39. DWORD cbSize,
  40. PDWORD pcbNeeded
  41. );
  42. typedef BOOL (APIENTRY *PFN_OEMDevMode)(
  43. DWORD dwMode,
  44. POEMDMPARAM pOemDMParam
  45. );
  46. //
  47. // *** Kernel-mode rendering module - OEM entrypoints ***
  48. //
  49. #ifdef KERNEL_MODE
  50. typedef BOOL (APIENTRY *PFN_OEMEnableDriver)(
  51. DWORD DriverVersion,
  52. DWORD cbSize,
  53. PDRVENABLEDATA pded
  54. );
  55. typedef VOID (APIENTRY *PFN_OEMDisableDriver)(
  56. VOID
  57. );
  58. typedef PDEVOEM (APIENTRY *PFN_OEMEnablePDEV)(
  59. PDEVOBJ pdevobj,
  60. PWSTR pPrinterName,
  61. ULONG cPatterns,
  62. HSURF *phsurfPatterns,
  63. ULONG cjGdiInfo,
  64. GDIINFO *pGdiInfo,
  65. ULONG cjDevInfo,
  66. DEVINFO *pDevInfo,
  67. DRVENABLEDATA *pded
  68. );
  69. typedef VOID (APIENTRY *PFN_OEMDisablePDEV)(
  70. PDEVOBJ pdevobj
  71. );
  72. typedef BOOL (APIENTRY *PFN_OEMResetPDEV)(
  73. PDEVOBJ pdevobjOld,
  74. PDEVOBJ pdevobjNew
  75. );
  76. typedef DWORD (APIENTRY *PFN_OEMCommand)(
  77. PDEVOBJ pdevobj,
  78. DWORD dwIndex,
  79. PVOID pData,
  80. DWORD cbSize
  81. );
  82. typedef INT (APIENTRY *PFN_OEMCommandCallback)(
  83. PDEVOBJ pdevobj,
  84. DWORD dwCallbackID,
  85. DWORD dwCount,
  86. PDWORD pdwParams
  87. );
  88. typedef PBYTE (APIENTRY *PFN_OEMImageProcessing)(
  89. PDEVOBJ pdevobj,
  90. PBYTE pSrcBitmap,
  91. PBITMAPINFOHEADER pBitmapInfoHeader,
  92. PBYTE pColorTable,
  93. DWORD dwCallbackID,
  94. PIPPARAMS pIPParams
  95. );
  96. typedef BOOL (APIENTRY *PFN_OEMFilterGraphics)(
  97. PDEVOBJ pdevobj,
  98. PBYTE pBuf,
  99. DWORD dwLen
  100. );
  101. typedef INT (APIENTRY *PFN_OEMCompression)(
  102. PDEVOBJ pdevobj,
  103. PBYTE pInBuf,
  104. PBYTE pOutBuf,
  105. DWORD dwInLen,
  106. DWORD dwOutLen
  107. );
  108. typedef BOOL (APIENTRY *PFN_OEMHalftonePattern)(
  109. PDEVOBJ pdevobj,
  110. PBYTE pHTPattern,
  111. DWORD dwHTPatternX,
  112. DWORD dwHTPatternY,
  113. DWORD dwHTNumPatterns,
  114. DWORD dwCallbackID,
  115. PBYTE pResource,
  116. DWORD dwResourceSize
  117. );
  118. typedef VOID (APIENTRY *PFN_OEMMemoryUsage)(
  119. PDEVOBJ pdevobj,
  120. POEMMEMORYUSAGE pMemoryUsage
  121. );
  122. typedef DWORD (APIENTRY *PFN_OEMDownloadFontHeader)(
  123. PDEVOBJ pdevobj,
  124. PUNIFONTOBJ pUFObj
  125. );
  126. typedef DWORD (APIENTRY *PFN_OEMDownloadCharGlyph)(
  127. PDEVOBJ pdevobj,
  128. PUNIFONTOBJ pUFObj,
  129. HGLYPH hGlyph,
  130. PDWORD pdwFreeMem
  131. );
  132. typedef DWORD (APIENTRY *PFN_OEMTTDownloadMethod)(
  133. PDEVOBJ pdevobj,
  134. PUNIFONTOBJ pUFObj
  135. );
  136. typedef VOID (APIENTRY *PFN_OEMOutputCharStr)(
  137. PDEVOBJ pdevobj,
  138. PUNIFONTOBJ pUFObj,
  139. DWORD dwType,
  140. DWORD dwCount,
  141. PVOID pGlyph
  142. );
  143. typedef VOID (APIENTRY *PFN_OEMSendFontCmd)(
  144. PDEVOBJ pdevobj,
  145. PUNIFONTOBJ pUFObj,
  146. PFINVOCATION pFInv
  147. );
  148. typedef BOOL (APIENTRY *PFN_OEMTTYGetInfo)(
  149. PDEVOBJ pdevobj,
  150. DWORD dwInfoIndex,
  151. PVOID pOutputBuf,
  152. DWORD dwSize,
  153. DWORD *pcbNeeded
  154. );
  155. typedef BOOL (APIENTRY *PFN_OEMTextOutAsBitmap)(
  156. SURFOBJ *pso,
  157. STROBJ *pstro,
  158. FONTOBJ *pfo,
  159. CLIPOBJ *pco,
  160. RECTL *prclExtra,
  161. RECTL *prclOpaque,
  162. BRUSHOBJ *pboFore,
  163. BRUSHOBJ *pboOpaque,
  164. POINTL *pptlOrg,
  165. MIX mix
  166. );
  167. enum {
  168. EP_OEMGetInfo,
  169. EP_OEMDevMode,
  170. EP_OEMEnableDriver,
  171. EP_OEMDisableDriver,
  172. EP_OEMEnablePDEV,
  173. EP_OEMDisablePDEV,
  174. EP_OEMResetPDEV,
  175. EP_OEMCommand,
  176. EP_OEMDriverDMS,
  177. MAX_OEMENTRIES
  178. };
  179. #ifdef DEFINE_OEMPROC_NAMES
  180. static CONST PSTR OEMProcNames[MAX_OEMENTRIES] = {
  181. "OEMGetInfo",
  182. "OEMDevMode",
  183. "OEMEnableDriver",
  184. "OEMDisableDriver",
  185. "OEMEnablePDEV",
  186. "OEMDisablePDEV",
  187. "OEMResetPDEV",
  188. "OEMCommand",
  189. "OEMDriverDMS",
  190. };
  191. #endif // DEFINE_OEMPROC_NAMES
  192. //
  193. // NOTE: These are different from the entrypoints above.
  194. // They are returned by the OEM module in a table instead
  195. // of being exported by the DLL.
  196. //
  197. typedef BOOL (APIENTRY *PFN_OEMBitBlt)(
  198. SURFOBJ *psoTrg,
  199. SURFOBJ *psoSrc,
  200. SURFOBJ *psoMask,
  201. CLIPOBJ *pco,
  202. XLATEOBJ *pxlo,
  203. RECTL *prclTrg,
  204. POINTL *pptlSrc,
  205. POINTL *pptlMask,
  206. BRUSHOBJ *pbo,
  207. POINTL *pptlBrush,
  208. ROP4 rop4
  209. );
  210. typedef BOOL (APIENTRY *PFN_OEMStretchBlt)(
  211. SURFOBJ *psoDest,
  212. SURFOBJ *psoSrc,
  213. SURFOBJ *psoMask,
  214. CLIPOBJ *pco,
  215. XLATEOBJ *pxlo,
  216. COLORADJUSTMENT *pca,
  217. POINTL *pptlHTOrg,
  218. RECTL *prclDest,
  219. RECTL *prclSrc,
  220. POINTL *pptlMask,
  221. ULONG iMode
  222. );
  223. typedef BOOL (APIENTRY *PFN_OEMCopyBits)(
  224. SURFOBJ *psoDest,
  225. SURFOBJ *psoSrc,
  226. CLIPOBJ *pco,
  227. XLATEOBJ *pxlo,
  228. RECTL *prclDest,
  229. POINTL *pptlSrc
  230. );
  231. typedef BOOL (APIENTRY *PFN_OEMTextOut)(
  232. SURFOBJ *pso,
  233. STROBJ *pstro,
  234. FONTOBJ *pfo,
  235. CLIPOBJ *pco,
  236. RECTL *prclExtra,
  237. RECTL *prclOpaque,
  238. BRUSHOBJ *pboFore,
  239. BRUSHOBJ *pboOpaque,
  240. POINTL *pptlOrg,
  241. MIX mix
  242. );
  243. typedef BOOL (APIENTRY *PFN_OEMStrokePath)(
  244. SURFOBJ *pso,
  245. PATHOBJ *ppo,
  246. CLIPOBJ *pco,
  247. XFORMOBJ *pxo,
  248. BRUSHOBJ *pbo,
  249. POINTL *pptlBrushOrg,
  250. LINEATTRS *plineattrs,
  251. MIX mix
  252. );
  253. typedef BOOL (APIENTRY *PFN_OEMFillPath)(
  254. SURFOBJ *pso,
  255. PATHOBJ *ppo,
  256. CLIPOBJ *pco,
  257. BRUSHOBJ *pbo,
  258. POINTL *pptlBrushOrg,
  259. MIX mix,
  260. FLONG flOptions
  261. );
  262. typedef BOOL (APIENTRY *PFN_OEMStrokeAndFillPath)(
  263. SURFOBJ *pso,
  264. PATHOBJ *ppo,
  265. CLIPOBJ *pco,
  266. XFORMOBJ *pxo,
  267. BRUSHOBJ *pboStroke,
  268. LINEATTRS *plineattrs,
  269. BRUSHOBJ *pboFill,
  270. POINTL *pptlBrushOrg,
  271. MIX mixFill,
  272. FLONG flOptions
  273. );
  274. typedef BOOL (APIENTRY *PFN_OEMRealizeBrush)(
  275. BRUSHOBJ *pbo,
  276. SURFOBJ *psoTarget,
  277. SURFOBJ *psoPattern,
  278. SURFOBJ *psoMask,
  279. XLATEOBJ *pxlo,
  280. ULONG iHatch
  281. );
  282. typedef BOOL (APIENTRY *PFN_OEMStartPage)(
  283. SURFOBJ *pso
  284. );
  285. typedef BOOL (APIENTRY *PFN_OEMSendPage)(
  286. SURFOBJ *pso
  287. );
  288. typedef ULONG (APIENTRY *PFN_OEMEscape)(
  289. SURFOBJ *pso,
  290. ULONG iEsc,
  291. ULONG cjIn,
  292. PVOID pvIn,
  293. ULONG cjOut,
  294. PVOID pvOut
  295. );
  296. typedef BOOL (APIENTRY *PFN_OEMStartDoc)(
  297. SURFOBJ *pso,
  298. PWSTR pwszDocName,
  299. DWORD dwJobId
  300. );
  301. typedef BOOL (APIENTRY *PFN_OEMEndDoc)(
  302. SURFOBJ *pso,
  303. FLONG fl
  304. );
  305. typedef PIFIMETRICS (APIENTRY *PFN_OEMQueryFont)(
  306. DHPDEV dhpdev,
  307. ULONG_PTR iFile,
  308. ULONG iFace,
  309. ULONG_PTR *pid
  310. );
  311. typedef PVOID (APIENTRY *PFN_OEMQueryFontTree)(
  312. DHPDEV dhpdev,
  313. ULONG_PTR iFile,
  314. ULONG iFace,
  315. ULONG iMode,
  316. ULONG_PTR *pid
  317. );
  318. typedef LONG (APIENTRY *PFN_OEMQueryFontData)(
  319. DHPDEV dhpdev,
  320. FONTOBJ *pfo,
  321. ULONG iMode,
  322. HGLYPH hg,
  323. GLYPHDATA *pgd,
  324. PVOID pv,
  325. ULONG cjSize
  326. );
  327. typedef BOOL (APIENTRY *PFN_OEMQueryAdvanceWidths)(
  328. DHPDEV dhpdev,
  329. FONTOBJ *pfo,
  330. ULONG iMode,
  331. HGLYPH *phg,
  332. PVOID pvWidths,
  333. ULONG cGlyphs
  334. );
  335. typedef ULONG (APIENTRY *PFN_OEMFontManagement)(
  336. SURFOBJ *pso,
  337. FONTOBJ *pfo,
  338. ULONG iMode,
  339. ULONG cjIn,
  340. PVOID pvIn,
  341. ULONG cjOut,
  342. PVOID pvOut
  343. );
  344. typedef ULONG (APIENTRY *PFN_OEMGetGlyphMode)(
  345. DHPDEV dhpdev,
  346. FONTOBJ *pfo
  347. );
  348. typedef BOOL (APIENTRY *PFN_OEMNextBand)(
  349. SURFOBJ *pso,
  350. POINTL *pptl
  351. );
  352. typedef BOOL (APIENTRY *PFN_OEMStartBanding)(
  353. SURFOBJ *pso,
  354. POINTL *pptl
  355. );
  356. typedef ULONG (APIENTRY *PFN_OEMDitherColor)(
  357. DHPDEV dhpdev,
  358. ULONG iMode,
  359. ULONG rgbColor,
  360. ULONG *pulDither
  361. );
  362. typedef BOOL (APIENTRY *PFN_OEMPaint)(
  363. SURFOBJ *pso,
  364. CLIPOBJ *pco,
  365. BRUSHOBJ *pbo,
  366. POINTL *pptlBrushOrg,
  367. MIX mix
  368. );
  369. typedef BOOL (APIENTRY *PFN_OEMLineTo)(
  370. SURFOBJ *pso,
  371. CLIPOBJ *pco,
  372. BRUSHOBJ *pbo,
  373. LONG x1,
  374. LONG y1,
  375. LONG x2,
  376. LONG y2,
  377. RECTL *prclBounds,
  378. MIX mix
  379. );
  380. #ifndef WINNT_40
  381. typedef BOOL (APIENTRY *PFN_OEMStretchBltROP)(
  382. SURFOBJ *psoDest,
  383. SURFOBJ *psoSrc,
  384. SURFOBJ *psoMask,
  385. CLIPOBJ *pco,
  386. XLATEOBJ *pxlo,
  387. COLORADJUSTMENT *pca,
  388. POINTL *pptlHTOrg,
  389. RECTL *prclDest,
  390. RECTL *prclSrc,
  391. POINTL *pptlMask,
  392. ULONG iMode,
  393. BRUSHOBJ *pbo,
  394. ROP4 rop4
  395. );
  396. typedef BOOL (APIENTRY *PFN_OEMPlgBlt)(
  397. SURFOBJ *psoDst,
  398. SURFOBJ *psoSrc,
  399. SURFOBJ *psoMask,
  400. CLIPOBJ *pco,
  401. XLATEOBJ *pxlo,
  402. COLORADJUSTMENT *pca,
  403. POINTL *pptlBrushOrg,
  404. POINTFIX *pptfixDest,
  405. RECTL *prclSrc,
  406. POINTL *pptlMask,
  407. ULONG iMode
  408. );
  409. typedef BOOL (APIENTRY *PFN_OEMAlphaBlend)(
  410. SURFOBJ *psoDest,
  411. SURFOBJ *psoSrc,
  412. CLIPOBJ *pco,
  413. XLATEOBJ *pxlo,
  414. RECTL *prclDest,
  415. RECTL *prclSrc,
  416. BLENDOBJ *pBlendObj
  417. );
  418. typedef BOOL (APIENTRY *PFN_OEMGradientFill)(
  419. SURFOBJ *psoDest,
  420. CLIPOBJ *pco,
  421. XLATEOBJ *pxlo,
  422. TRIVERTEX *pVertex,
  423. ULONG nVertex,
  424. PVOID pMesh,
  425. ULONG nMesh,
  426. RECTL *prclExtents,
  427. POINTL *pptlDitherOrg,
  428. ULONG ulMode
  429. );
  430. typedef HANDLE (APIENTRY *PFN_OEMIcmCreateColorTransform)(
  431. DHPDEV dhpdev,
  432. LPLOGCOLORSPACEW pLogColorSpace,
  433. PVOID pvSourceProfile,
  434. ULONG cjSourceProfile,
  435. PVOID pvDestProfile,
  436. ULONG cjDestProfile,
  437. PVOID pvTargetProfile,
  438. ULONG cjTargetProfile,
  439. DWORD dwReserved
  440. );
  441. typedef BOOL (APIENTRY *PFN_OEMIcmDeleteColorTransform)(
  442. DHPDEV dhpdev,
  443. HANDLE hcmXform
  444. );
  445. typedef BOOL (APIENTRY *PFN_OEMQueryDeviceSupport)(
  446. SURFOBJ *pso,
  447. XLATEOBJ *pxlo,
  448. XFORMOBJ *pxo,
  449. ULONG iType,
  450. ULONG cjIn,
  451. PVOID pvIn,
  452. ULONG cjOut,
  453. PVOID pvOut
  454. );
  455. typedef BOOL (APIENTRY *PFN_OEMTransparentBlt)(
  456. SURFOBJ *psoDst,
  457. SURFOBJ *psoSrc,
  458. CLIPOBJ *pco,
  459. XLATEOBJ *pxlo,
  460. RECTL *prclDst,
  461. RECTL *prclSrc,
  462. ULONG iTransColor,
  463. ULONG ulReserved
  464. );
  465. #endif // !WINNT_40
  466. //
  467. // WARNING!!!
  468. // Do not change the following declaration without consulting with
  469. // the people responsible for PSCRIPT and UNIDRV kernel modes.
  470. //
  471. enum {
  472. EP_OEMRealizeBrush,
  473. EP_OEMDitherColor,
  474. EP_OEMCopyBits,
  475. EP_OEMBitBlt,
  476. EP_OEMStretchBlt,
  477. EP_OEMStretchBltROP,
  478. EP_OEMPlgBlt,
  479. EP_OEMTransparentBlt,
  480. EP_OEMAlphaBlend,
  481. EP_OEMGradientFill,
  482. EP_OEMTextOut,
  483. EP_OEMStrokePath,
  484. EP_OEMFillPath,
  485. EP_OEMStrokeAndFillPath,
  486. EP_OEMPaint,
  487. EP_OEMLineTo,
  488. EP_OEMStartPage,
  489. EP_OEMSendPage,
  490. EP_OEMEscape,
  491. EP_OEMStartDoc,
  492. EP_OEMEndDoc,
  493. EP_OEMNextBand,
  494. EP_OEMStartBanding,
  495. EP_OEMQueryFont,
  496. EP_OEMQueryFontTree,
  497. EP_OEMQueryFontData,
  498. EP_OEMQueryAdvanceWidths,
  499. EP_OEMFontManagement,
  500. EP_OEMGetGlyphMode,
  501. EP_OEMIcmCreateColorTransform,
  502. EP_OEMIcmDeleteColorTransform,
  503. EP_OEMQueryDeviceSupport,
  504. //
  505. // The following Unidrv-specific callbacks allow at most one OEM to hook
  506. // out for each function at a time. They must be exported by the OEM dll's.
  507. // New callbacks must be added between EP_UNIDRV_ONLY_FIRST and
  508. // EP_UNIDRV_ONLY_LAST. If you change the first or the last callback,
  509. // remember to update these two constants!! Don't forget to update
  510. // OEMUnidrvProcNames[] in unidrv\control\oemkm.c accordingly.
  511. //
  512. EP_UNIDRV_ONLY_FIRST,
  513. EP_OEMCommandCallback = EP_UNIDRV_ONLY_FIRST,
  514. EP_OEMImageProcessing,
  515. EP_OEMFilterGraphics,
  516. EP_OEMCompression,
  517. EP_OEMHalftonePattern,
  518. EP_OEMMemoryUsage,
  519. EP_OEMDownloadFontHeader,
  520. EP_OEMDownloadCharGlyph,
  521. EP_OEMTTDownloadMethod,
  522. EP_OEMOutputCharStr,
  523. EP_OEMSendFontCmd,
  524. EP_OEMTTYGetInfo,
  525. EP_OEMTextOutAsBitmap,
  526. EP_OEMWritePrinter,
  527. EP_UNIDRV_ONLY_LAST = EP_OEMWritePrinter,
  528. MAX_OEMHOOKS,
  529. };
  530. #define MAX_UNIDRV_ONLY_HOOKS (EP_UNIDRV_ONLY_LAST - EP_UNIDRV_ONLY_FIRST + 1)
  531. #define INVALID_EP 0xFFFFFFFF
  532. #endif // KERNEL_MODE
  533. //
  534. // *** User-mode UI module - OEM entrypoints ***
  535. //
  536. #ifndef KERNEL_MODE
  537. typedef BOOL (APIENTRY *PFN_OEMCommonUIProp)(
  538. DWORD dwMode,
  539. POEMCUIPPARAM pOemCUIPParam
  540. );
  541. typedef LRESULT (APIENTRY *PFN_OEMDocumentPropertySheets)(
  542. PPROPSHEETUI_INFO pPSUIInfo,
  543. LPARAM lParam
  544. );
  545. typedef LRESULT (APIENTRY *PFN_OEMDevicePropertySheets)(
  546. PPROPSHEETUI_INFO pPSUIInfo,
  547. LPARAM lParam
  548. );
  549. typedef BOOL (APIENTRY *PFN_OEMDevQueryPrintEx)(
  550. POEMUIOBJ poemuiobj,
  551. PDEVQUERYPRINT_INFO pDQPInfo,
  552. PDEVMODE pPublicDM,
  553. PVOID pOEMDM
  554. );
  555. typedef DWORD (APIENTRY *PFN_OEMDeviceCapabilities)(
  556. POEMUIOBJ poemuiobj,
  557. HANDLE hPrinter,
  558. PWSTR pDeviceName,
  559. WORD wCapability,
  560. PVOID pOutput,
  561. PDEVMODE pPublicDM,
  562. PVOID pOEMDM,
  563. DWORD dwOld
  564. );
  565. typedef BOOL (APIENTRY *PFN_OEMUpgradePrinter)(
  566. DWORD dwLevel,
  567. PBYTE pDriverUpgradeInfo
  568. );
  569. typedef BOOL (APIENTRY *PFN_OEMPrinterEvent)(
  570. PWSTR pPrinterName,
  571. INT iDriverEvent,
  572. DWORD dwFlags,
  573. LPARAM lParam
  574. );
  575. typedef BOOL (APIENTRY *PFN_OEMDriverEvent)(
  576. DWORD dwDriverEvent,
  577. DWORD dwLevel,
  578. LPBYTE pDriverInfo,
  579. LPARAM lParam
  580. );
  581. typedef BOOL (APIENTRY *PFN_OEMQueryColorProfile)(
  582. HANDLE hPrinter,
  583. POEMUIOBJ poemuiobj,
  584. PDEVMODE pPublicDM,
  585. PVOID pOEMDM,
  586. ULONG ulQueryMode,
  587. VOID *pvProfileData,
  588. ULONG *pcbProfileData,
  589. FLONG *pflProfileData
  590. );
  591. typedef BOOL (APIENTRY *PFN_OEMUpgradeRegistry)(
  592. DWORD dwLevel,
  593. PBYTE pDriverUpgradeInfo,
  594. PFN_DrvUpgradeRegistrySetting pfnUpgradeRegistry
  595. );
  596. typedef INT_PTR (CALLBACK *PFN_OEMFontInstallerDlgProc)(
  597. HWND hWnd,
  598. UINT usMsg,
  599. WPARAM wParam,
  600. LPARAM lParam
  601. );
  602. typedef BOOL (APIENTRY *PFN_OEMUpdateExternalFonts)(
  603. HANDLE hPrinter,
  604. HANDLE hHeap,
  605. PWSTR pwstrCartridges
  606. );
  607. enum {
  608. EP_OEMGetInfo,
  609. EP_OEMDevMode,
  610. EP_OEMCommonUIProp,
  611. EP_OEMDocumentPropertySheets,
  612. EP_OEMDevicePropertySheets,
  613. EP_OEMDevQueryPrintEx,
  614. EP_OEMDeviceCapabilities,
  615. EP_OEMUpgradePrinter,
  616. EP_OEMPrinterEvent,
  617. EP_OEMQueryColorProfile,
  618. EP_OEMUpgradeRegistry,
  619. EP_OEMFontInstallerDlgProc,
  620. EP_OEMUpdateExternalFonts,
  621. EP_OEMDriverEvent,
  622. MAX_OEMENTRIES
  623. };
  624. #ifdef DEFINE_OEMPROC_NAMES
  625. static CONST PSTR OEMProcNames[MAX_OEMENTRIES] = {
  626. "OEMGetInfo",
  627. "OEMDevMode",
  628. "OEMCommonUIProp",
  629. "OEMDocumentPropertySheets",
  630. "OEMDevicePropertySheets",
  631. "OEMDevQueryPrintEx",
  632. "OEMDeviceCapabilities",
  633. "OEMUpgradePrinter",
  634. "OEMPrinterEvent",
  635. "OEMQueryColorProfile",
  636. "OEMUpgradeRegistry",
  637. "OEMFontInstallerDlgProc",
  638. "OEMUpdateExternalFonts",
  639. "OEMDriverEvent",
  640. };
  641. #endif // DEFINE_OEMPROC_NAMES
  642. #endif // !KERNEL_MODE
  643. //
  644. // Data structure containing information about each OEM plugin
  645. //
  646. typedef LONG (APIENTRY *OEMPROC)();
  647. // Constant flag bits for OEM_PLUGIN_ENTRY.dwFlags field
  648. #define OEMENABLEDRIVER_CALLED 0x0001
  649. #define OEMENABLEPDEV_CALLED 0x0002
  650. #define OEMDEVMODE_CALLED 0x0004
  651. #define OEMWRITEPRINTER_HOOKED 0x0008
  652. #define OEMNOT_UNLOAD_PLUGIN 0x0010 //If set, the plugin dll will not be unloaded
  653. #define MAX_OEM_PLUGINS 8
  654. typedef struct _OEM_PLUGIN_ENTRY {
  655. //
  656. // Filenames are fully qualified, NULL means not present
  657. //
  658. PTSTR ptstrDriverFile; // KM module filename
  659. PTSTR ptstrConfigFile; // UM module filename
  660. PTSTR ptstrHelpFile; // help filename
  661. DWORD dwSignature; // unique OEM signature
  662. HANDLE hInstance; // handle to loaded KM or UM module
  663. PVOID pParam; // extra pointer parameter for KM or UM module
  664. DWORD dwFlags; // misc. flag bits
  665. PVOID pOEMDM; // pointer to OEM private devmode
  666. DWORD dwOEMDMSize; // size of OEM private devmode
  667. //
  668. // OEM interface information
  669. //
  670. PVOID pIntfOem; // pointer to OEM plugin's interface
  671. GUID iidIntfOem; // OEM plugin's interface ID
  672. //
  673. // Pointers to various plugin entrypoints, NULL means not present.
  674. // Note that the set of entrypoints diff for KM and UM module.
  675. //
  676. BYTE aubProcFlags[(MAX_OEMENTRIES + 7) / 8];
  677. OEMPROC oemprocs[MAX_OEMENTRIES];
  678. } OEM_PLUGIN_ENTRY, *POEM_PLUGIN_ENTRY;
  679. //
  680. // Information about all plugins assocaited with a driver
  681. //
  682. #define OEM_HAS_PUBLISHER_INFO 0x00000001
  683. typedef struct _OEM_PLUGINS {
  684. PVOID pdriverobj; // reference pointer to driver data structure
  685. DWORD dwCount; // number of plugins
  686. DWORD dwFlags; // misc flags
  687. PUBLISHERINFO PublisherInfo; // info about publisher printing
  688. OEM_PLUGIN_ENTRY aPlugins[1]; // information about each plugin
  689. } OEM_PLUGINS, *POEM_PLUGINS;
  690. //
  691. // Get OEM plugin interface and publish driver helper interface
  692. //
  693. BOOL
  694. BGetOemInterface(
  695. POEM_PLUGIN_ENTRY pOemEntry
  696. );
  697. //
  698. // Retrieve the latest interface supported by OEM plugin
  699. //
  700. BOOL
  701. BQILatestOemInterface(
  702. IN HANDLE hInstance,
  703. IN REFCLSID rclsid,
  704. IN const GUID *PrintOem_IIDs[],
  705. OUT PVOID *ppIntfOem,
  706. OUT GUID *piidIntfOem
  707. );
  708. //
  709. // Release OEM interface
  710. //
  711. ULONG
  712. ReleaseOemInterface(
  713. POEM_PLUGIN_ENTRY pOemEntry
  714. );
  715. //
  716. // Free OEM component
  717. //
  718. VOID
  719. Driver_CoFreeOEMLibrary(
  720. IN HANDLE hInstance
  721. );
  722. HRESULT
  723. HComOEMGetInfo(
  724. POEM_PLUGIN_ENTRY pOemEntry,
  725. DWORD dwMode,
  726. PVOID pBuffer,
  727. DWORD cbSize,
  728. PDWORD pcbNeeded
  729. );
  730. HRESULT
  731. HComOEMDevMode(
  732. POEM_PLUGIN_ENTRY pOemEntry,
  733. DWORD dwMode,
  734. POEMDMPARAM pOemDMParam
  735. );
  736. #if defined(KERNEL_MODE) && defined(WINNT_40)
  737. typedef struct _OEM_PLUGIN_REFCOUNT {
  738. DWORD dwRefCount; // ref count for the OEM render plugin DLL
  739. PTSTR ptstrDriverFile; // OEM render plugin DLL name
  740. struct _OEM_PLUGIN_REFCOUNT *pNext; // next ref count node
  741. } OEM_PLUGIN_REFCOUNT, *POEM_PLUGIN_REFCOUNT;
  742. BOOL
  743. BOEMPluginFirstLoad(
  744. IN PTSTR ptstrDriverFile,
  745. IN OUT POEM_PLUGIN_REFCOUNT *ppOEMPluginRefCount
  746. );
  747. BOOL
  748. BOEMPluginLastUnload(
  749. IN PTSTR ptstrDriverFile,
  750. IN OUT POEM_PLUGIN_REFCOUNT *ppOEMPluginRefCount
  751. );
  752. VOID
  753. VFreePluginRefCountList(
  754. IN OUT POEM_PLUGIN_REFCOUNT *ppOEMPluginRefCount
  755. );
  756. BOOL
  757. BHandleOEMInitialize(
  758. POEM_PLUGIN_ENTRY pOemEntry,
  759. ULONG ulReason
  760. );
  761. #endif // KERNEL_MODE && WINNT_40
  762. //
  763. // In kernel mode, only OEM rendering module is used.
  764. // In user mode, only OEM UI module is loaded.
  765. //
  766. #ifdef KERNEL_MODE
  767. #define CURRENT_OEM_MODULE_NAME(pOemEntry) (pOemEntry)->ptstrDriverFile
  768. HRESULT
  769. HComOEMEnableDriver(
  770. POEM_PLUGIN_ENTRY pOemEntry,
  771. DWORD DriverVersion,
  772. DWORD cbSize,
  773. PDRVENABLEDATA pded
  774. );
  775. HRESULT
  776. HComOEMEnablePDEV(
  777. POEM_PLUGIN_ENTRY pOemEntry,
  778. PDEVOBJ pdevobj,
  779. PWSTR pPrinterName,
  780. ULONG cPatterns,
  781. HSURF *phsurfPatterns,
  782. ULONG cjGdiInfo,
  783. GDIINFO *pGdiInfo,
  784. ULONG cjDevInfo,
  785. DEVINFO *pDevInfo,
  786. DRVENABLEDATA *pded,
  787. OUT PDEVOEM *pDevOem
  788. );
  789. HRESULT
  790. HComOEMResetPDEV(
  791. POEM_PLUGIN_ENTRY pOemEntry,
  792. PDEVOBJ pdevobjOld,
  793. PDEVOBJ pdevobjNew
  794. );
  795. HRESULT
  796. HComOEMDisablePDEV(
  797. POEM_PLUGIN_ENTRY pOemEntry,
  798. PDEVOBJ pdevobj
  799. );
  800. HRESULT
  801. HComOEMDisableDriver(
  802. POEM_PLUGIN_ENTRY pOemEntry
  803. );
  804. HRESULT
  805. HComOEMCommand(
  806. POEM_PLUGIN_ENTRY pOemEntry,
  807. PDEVOBJ pdevobj,
  808. DWORD dwIndex,
  809. PVOID pData,
  810. DWORD cbSize,
  811. OUT DWORD *pdwResult
  812. );
  813. HRESULT
  814. HComOEMWritePrinter(
  815. POEM_PLUGIN_ENTRY pOemEntry,
  816. PDEVOBJ pdevobj,
  817. PVOID pBuf,
  818. DWORD cbBuffer,
  819. OUT PDWORD pcbWritten
  820. );
  821. HRESULT
  822. HComOEMGetPDEVAdjustment(
  823. POEM_PLUGIN_ENTRY pOemEntry,
  824. PDEVOBJ pdevobj,
  825. DWORD dwAdjustType,
  826. PVOID pBuf,
  827. DWORD cbBuffer,
  828. OUT BOOL *pbAdjustmentDone);
  829. #else // !KERNEL_MODE
  830. #define CURRENT_OEM_MODULE_NAME(pOemEntry) (pOemEntry)->ptstrConfigFile
  831. HRESULT
  832. HComOEMCommonUIProp(
  833. POEM_PLUGIN_ENTRY pOemEntry,
  834. DWORD dwMode,
  835. POEMCUIPPARAM pOemCUIPParam
  836. );
  837. HRESULT
  838. HComOEMDocumentPropertySheets(
  839. POEM_PLUGIN_ENTRY pOemEntry,
  840. PPROPSHEETUI_INFO pPSUIInfo,
  841. LPARAM lParam
  842. );
  843. HRESULT
  844. HComOEMDevicePropertySheets(
  845. POEM_PLUGIN_ENTRY pOemEntry,
  846. PPROPSHEETUI_INFO pPSUIInfo,
  847. LPARAM lParam
  848. );
  849. HRESULT
  850. HComOEMDevQueryPrintEx(
  851. POEM_PLUGIN_ENTRY pOemEntry,
  852. POEMUIOBJ poemuiobj,
  853. PDEVQUERYPRINT_INFO pDQPInfo,
  854. PDEVMODE pPublicDM,
  855. PVOID pOEMDM
  856. );
  857. HRESULT
  858. HComOEMDeviceCapabilities(
  859. POEM_PLUGIN_ENTRY pOemEntry,
  860. POEMUIOBJ poemuiobj,
  861. HANDLE hPrinter,
  862. PWSTR pDeviceName,
  863. WORD wCapability,
  864. PVOID pOutput,
  865. PDEVMODE pPublicDM,
  866. PVOID pOEMDM,
  867. DWORD dwOld,
  868. DWORD *pdwResult
  869. );
  870. HRESULT
  871. HComOEMUpgradePrinter(
  872. POEM_PLUGIN_ENTRY pOemEntry,
  873. DWORD dwLevel,
  874. PBYTE pDriverUpgradeInfo
  875. );
  876. HRESULT
  877. HComOEMPrinterEvent(
  878. POEM_PLUGIN_ENTRY pOemEntry,
  879. PWSTR pPrinterName,
  880. INT iDriverEvent,
  881. DWORD dwFlags,
  882. LPARAM lParam
  883. );
  884. HRESULT
  885. HComOEMDriverEvent(
  886. POEM_PLUGIN_ENTRY pOemEntry,
  887. DWORD dwDriverEvent,
  888. DWORD dwLevel,
  889. LPBYTE pDriverInfo,
  890. LPARAM lParam
  891. );
  892. HRESULT
  893. HComOEMQUeryColorProfile(
  894. POEM_PLUGIN_ENTRY pOemEntry,
  895. HANDLE hPrinter,
  896. POEMUIOBJ poemuiobj,
  897. PDEVMODE pPublicDM,
  898. PVOID pOEMDM,
  899. ULONG ulQueryMode,
  900. VOID *pvProfileData,
  901. ULONG *pcbProfileData,
  902. FLONG *pflProfileData
  903. );
  904. HRESULT
  905. HComOEMFontInstallerDlgProc(
  906. POEM_PLUGIN_ENTRY pOemEntry,
  907. HWND hWnd,
  908. UINT usMsg,
  909. WPARAM wParam,
  910. LPARAM lParam
  911. );
  912. HRESULT
  913. HComOEMUpdateExternalFonts(
  914. POEM_PLUGIN_ENTRY pOemEntry,
  915. HANDLE hPrinter,
  916. HANDLE hHeap,
  917. PWSTR pwstrCartridges
  918. );
  919. HRESULT
  920. HComOEMQueryJobAttributes(
  921. POEM_PLUGIN_ENTRY pOemEntry,
  922. HANDLE hPrinter,
  923. PDEVMODE pDevMode,
  924. DWORD dwLevel,
  925. LPBYTE lpAttributeInfo
  926. );
  927. HRESULT
  928. HComOEMHideStandardUI(
  929. POEM_PLUGIN_ENTRY pOemEntry,
  930. DWORD dwMode
  931. );
  932. HRESULT
  933. HComOEMDocumentEvent(
  934. POEM_PLUGIN_ENTRY pOemEntry,
  935. HANDLE hPrinter,
  936. HDC hdc,
  937. INT iEsc,
  938. ULONG cbIn,
  939. PVOID pbIn,
  940. ULONG cbOut,
  941. PVOID pbOut,
  942. PINT piResult
  943. );
  944. #endif // KERNEL_MODE
  945. //
  946. // Get information about OEM plugins for a printer
  947. //
  948. POEM_PLUGINS
  949. PGetOemPluginInfo(
  950. HANDLE hPrinter,
  951. LPCTSTR pctstrDriverPath,
  952. PDRIVER_INFO_3 pDriverInfo3
  953. );
  954. //
  955. // Load OEM plugins modules into memory
  956. //
  957. BOOL
  958. BLoadOEMPluginModules(
  959. POEM_PLUGINS pOemPlugins
  960. );
  961. //
  962. // Dispose of information about OEM plugins and
  963. // unload OEM plugin modules if necessary
  964. //
  965. VOID
  966. VFreeOemPluginInfo(
  967. POEM_PLUGINS pOemPlugins
  968. );
  969. //
  970. // Macro to detect if OEM is using COM interface.
  971. //
  972. // Only exists for user mode drivers.
  973. //
  974. #define HAS_COM_INTERFACE(pOemEntry) \
  975. ((pOemEntry)->pIntfOem != NULL)
  976. //
  977. // Get the address for the specified OEM entrypoint.
  978. //
  979. // NOTE!!! You should always use the macro version
  980. // instead of calling the function directly.
  981. //
  982. #define GET_OEM_ENTRYPOINT(pOemEntry, ep) (PFN_##ep) \
  983. (BITTST((pOemEntry)->aubProcFlags, EP_##ep) ? \
  984. (pOemEntry)->oemprocs[EP_##ep] : \
  985. PGetOemEntrypointAddress(pOemEntry, EP_##ep))
  986. OEMPROC
  987. PGetOemEntrypointAddress(
  988. POEM_PLUGIN_ENTRY pOemEntry,
  989. DWORD dwIndex
  990. );
  991. //
  992. // Find the OEM plugin entry having the specified signature
  993. //
  994. POEM_PLUGIN_ENTRY
  995. PFindOemPluginWithSignature(
  996. POEM_PLUGINS pOemPlugins,
  997. DWORD dwSignature
  998. );
  999. //
  1000. // Calculate the total private devmode size for all OEM plugins
  1001. //
  1002. BOOL
  1003. BCalcTotalOEMDMSize(
  1004. HANDLE hPrinter,
  1005. POEM_PLUGINS pOemPlugins,
  1006. PDWORD pdwOemDMSize
  1007. );
  1008. //
  1009. // Initialize OEM plugin default devmodes
  1010. //
  1011. BOOL
  1012. BInitOemPluginDefaultDevmode(
  1013. IN HANDLE hPrinter,
  1014. IN PDEVMODE pPublicDM,
  1015. OUT POEM_DMEXTRAHEADER pOemDM,
  1016. IN OUT POEM_PLUGINS pOemPlugins
  1017. );
  1018. //
  1019. // Validate and merge OEM plugin private devmode fields
  1020. //
  1021. BOOL
  1022. BValidateAndMergeOemPluginDevmode(
  1023. IN HANDLE hPrinter,
  1024. OUT PDEVMODE pPublicDMOut,
  1025. IN PDEVMODE pPublicDMIn,
  1026. OUT POEM_DMEXTRAHEADER pOemDMOut,
  1027. IN POEM_DMEXTRAHEADER pOemDMIn,
  1028. IN OUT POEM_PLUGINS pOemPlugins
  1029. );
  1030. //
  1031. // This function scans through the OEM plugin devmodes block and
  1032. // verifies if every plugin devmode in that block is constructed correctly.
  1033. //
  1034. BOOL
  1035. bIsValidPluginDevmodes(
  1036. IN POEM_DMEXTRAHEADER pOemDM,
  1037. IN LONG cbOemDMSize
  1038. );
  1039. //
  1040. // Convert OEM plugin default devmodes to current version
  1041. //
  1042. BOOL
  1043. BConvertOemPluginDevmode(
  1044. IN HANDLE hPrinter,
  1045. OUT PDEVMODE pPublicDMOut,
  1046. IN PDEVMODE pPublicDMIn,
  1047. OUT POEM_DMEXTRAHEADER pOemDMOut,
  1048. IN POEM_DMEXTRAHEADER pOemDMIn,
  1049. IN LONG cbOemDMInSize,
  1050. IN POEM_PLUGINS pOemPlugins
  1051. );
  1052. //
  1053. // Function called by OEM plugins to access driver private devmode settings
  1054. //
  1055. BOOL
  1056. BGetDevmodeSettingForOEM(
  1057. IN PDEVMODE pdm,
  1058. IN DWORD dwIndex,
  1059. OUT PVOID pOutput,
  1060. IN DWORD cbSize,
  1061. OUT PDWORD pcbNeeded
  1062. );
  1063. //
  1064. // Function called by OEM plugins to access driver settings in registry
  1065. //
  1066. BOOL
  1067. BGetPrinterDataSettingForOEM(
  1068. IN PRINTERDATA *pPrinterData,
  1069. IN DWORD dwIndex,
  1070. OUT PVOID pOutput,
  1071. IN DWORD cbSize,
  1072. OUT PDWORD pcbNeeded
  1073. );
  1074. //
  1075. // Function called by OEM plugins to find out the currently selected
  1076. // option(s) for the specified feature
  1077. //
  1078. BOOL
  1079. BGetGenericOptionSettingForOEM(
  1080. IN PUIINFO pUIInfo,
  1081. IN POPTSELECT pOptionsArray,
  1082. IN PCSTR pstrFeatureName,
  1083. OUT PSTR pstrOutput,
  1084. IN DWORD cbSize,
  1085. OUT PDWORD pcbNeeded,
  1086. OUT PDWORD pdwOptionsReturned
  1087. );
  1088. #ifdef __cplusplus
  1089. }
  1090. #endif
  1091. #endif // !_OEMUTIL_H_