intrface.h
上传用户:looem2003
上传日期:2014-07-20
资源大小:13733k
文件大小:11k
源码类别:

打印编程

开发平台:

Visual C++

  1. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. //  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. //  PARTICULAR PURPOSE.
  5. //
  6. //  Copyright  1997 - 2003  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. //  FILE:   Intrface.H
  9. //
  10. //
  11. //  PURPOSE:    Define COM interface for User Mode Printer Customization DLL.
  12. //
  13. //  PLATFORMS:
  14. //
  15. //    Windows XP, Windows Server 2003, Windows codenamed Longhorn
  16. //
  17. //
  18. //  History:
  19. //          06/26/03    xxx created.
  20. //
  21. //
  22. #ifndef _INTERFACE_H
  23. #define _INTERFACE_H
  24. /////////////////////////////////////////////////////////
  25. //      String Literals
  26. /////////////////////////////////////////////////////////
  27. CONST CHAR NAME_CommandCallback[]       = "CommandCallback";
  28. CONST CHAR NAME_Compression[]               = "Compression";
  29. CONST CHAR NAME_DownloadCharGlyph[]     = "DownloadCharGlyph";
  30. CONST CHAR NAME_DownloadFontHeader[]        = "DownloadFontHeader";
  31. CONST CHAR NAME_FilterGraphics[]            = "FilterGraphics";
  32. CONST CHAR NAME_HalftonePattern[]           = "HalftonePattern";
  33. CONST CHAR NAME_ImageProcessing[]           = "ImageProcessing";
  34. CONST CHAR NAME_MemoryUsage[]           = "MemoryUsage";
  35. CONST CHAR NAME_OutputCharStr[]         = "OutputCharStr";
  36. CONST CHAR NAME_SendFontCmd[]           = "SendFontCmd";
  37. CONST CHAR NAME_TextOutAsBitmap[]           = "TextOutAsBitmap";
  38. CONST CHAR NAME_TTDownloadMethod[]      = "TTDownloadMethod";
  39. CONST CHAR NAME_TTYGetInfo[]                = "TTYGetInfo";
  40. CONST CHAR NAME_WritePrinter[]              = "WritePrinter";
  41. ////////////////////////////////////////////////////////////////////////////////
  42. //
  43. //  COemUni2
  44. //
  45. //  Interface for Unidrv OEM sample rendering module
  46. //
  47. class COemUni2 : public IPrintOemUni2
  48. {
  49. public:
  50.     // *** IUnknown methods ***
  51.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj);
  52.     STDMETHOD_(ULONG,AddRef)  (THIS);
  53.     STDMETHOD_(ULONG,Release) (THIS);
  54.     //
  55.     // Method for publishing Driver interface.
  56.     //
  57.     STDMETHOD(PublishDriverInterface)(THIS_ IUnknown    *pIUnknown);
  58.     //
  59.     // Method for getting the implemented methods.
  60.     // Returns S_OK if the given method is implemneted.
  61.     // Returns S_FALSE if the given method is notimplemneted.
  62.     //
  63.     STDMETHOD(GetImplementedMethod)(THIS_ __in PSTR  pMethodName);
  64.     //
  65.     // Method for OEM to specify DDIs that have been hooked
  66.     //
  67.     STDMETHOD(EnableDriver) (THIS_ DWORD            DriverVersion,
  68.                                 DWORD               cbSize,
  69.                                 PDRVENABLEDATA      pded);
  70.     //
  71.     // Method to notify OEM plugin that it is no longer required
  72.     //
  73.     STDMETHOD(DisableDriver) (THIS);
  74.     //
  75.     // Method for OEM plugin to contruct its own PDEV
  76.     //
  77.     STDMETHOD(EnablePDEV)(THIS_ PDEVOBJ     pdevobj,
  78.                             __in PWSTR          pPrinterName,
  79.                             ULONG               cPatterns,
  80.                             HSURF               *phsurfPatterns,
  81.                             ULONG               cjGdiInfo,
  82.                             GDIINFO             *pGdiInfo,
  83.                             ULONG               cjDevInfo,
  84.                             DEVINFO             *pDevInfo,
  85.                             DRVENABLEDATA       *pded,
  86.                             OUT PDEVOEM     *pDevOem);
  87.     //
  88.     // Method for OEM to free any resource associated with its PDEV
  89.     //
  90.     STDMETHOD(DisablePDEV)(THIS_ PDEVOBJ    pdevobj);
  91.     //
  92.     // Method for OEM to transfer from old PDEV to new PDEV
  93.     //
  94.     STDMETHOD(ResetPDEV)(THIS_ PDEVOBJ      pdevobjOld,
  95.                             PDEVOBJ             pdevobjNew);
  96.     //
  97.     // Get OEM dll related information
  98.     //
  99.     STDMETHOD(GetInfo)(THIS_ DWORD      dwMode,
  100.                         PVOID               pBuffer,
  101.                         DWORD               cbSize,
  102.                         PDWORD              pcbNeeded);
  103.     //
  104.     // OEMDriverDMS - UNIDRV only, return E_NOTIMPL on Pscript
  105.     //
  106.     STDMETHOD(DriverDMS)(THIS_ PVOID        pDevObj,
  107.                             PVOID           pBuffer,
  108.                             DWORD           cbSize,
  109.                             PDWORD          pcbNeeded);
  110.     //
  111.     // OEMDevMode
  112.     //
  113.     STDMETHOD(DevMode)(THIS_ DWORD      dwMode,
  114.                         POEMDMPARAM     pOemDMParam);
  115.     //
  116.     // OEMCommandCallback - UNIDRV only, return E_NOTIMPL on Pscript
  117.     //
  118.     STDMETHOD(CommandCallback)(THIS_ PDEVOBJ        pdevobj,
  119.                                     DWORD               dwCallbackID,
  120.                                     DWORD               dwCount,
  121.                                     PDWORD              pdwParams,
  122.                                     OUT INT             *piResult);
  123.     //
  124.     // OEMImageProcessing - UNIDRV only, return E_NOTIMPL on Pscript
  125.     //
  126.     STDMETHOD(ImageProcessing)(THIS_ PDEVOBJ            pdevobj,
  127.                                     PBYTE                   pSrcBitmap,
  128.                                     PBITMAPINFOHEADER       pBitmapInfoHeader,
  129.                                     PBYTE                   pColorTable,
  130.                                     DWORD                   dwCallbackID,
  131.                                     PIPPARAMS               pIPParams,
  132.                                     OUT PBYTE               *ppbResult);
  133.     //
  134.     // OEMFilterGraphics - UNIDRV only, return E_NOTIMPL on Pscript
  135.     //
  136.     STDMETHOD(FilterGraphics)(THIS_ PDEVOBJ pdevobj,
  137.                                 PBYTE           pBuf,
  138.                                 DWORD           dwLen);
  139.     //
  140.     // OEMCompression - UNIDRV only, return E_NOTIMPL on Pscript
  141.     //
  142.     STDMETHOD(Compression)(THIS_ PDEVOBJ        pdevobj,
  143.                                 PBYTE               pInBuf,
  144.                                 PBYTE               pOutBuf,
  145.                                 DWORD               dwInLen,
  146.                                 DWORD               dwOutLen,
  147.                                 OUT INT             *piResult);
  148.     //
  149.     // OEMHalftone - UNIDRV only, return E_NOTIMPL on Pscript
  150.     //
  151.     STDMETHOD(HalftonePattern)(THIS_ PDEVOBJ        pdevobj,
  152.                                 PBYTE               pHTPattern,
  153.                                 DWORD               dwHTPatternX,
  154.                                 DWORD               dwHTPatternY,
  155.                                 DWORD               dwHTNumPatterns,
  156.                                 DWORD               dwCallbackID,
  157.                                 PBYTE               pResource,
  158.                                 DWORD               dwResourceSize);
  159.     //
  160.     // OEMMemoryUsage - UNIDRV only, return E_NOTIMPL on Pscript
  161.     //
  162.     STDMETHOD(MemoryUsage)(THIS_ PDEVOBJ        pdevobj,
  163.                                 POEMMEMORYUSAGE pMemoryUsage);
  164.     //
  165.     // OEMTTYGetInfo - UNIDRV only, return E_NOTIMPL on Pscript
  166.     //
  167.     STDMETHOD(TTYGetInfo)(THIS_ PDEVOBJ     pdevobj,
  168.                             DWORD               dwInfoIndex,
  169.                             PVOID               pOutputBuf,
  170.                             DWORD               dwSize,
  171.                             DWORD               *pcbcNeeded);
  172.     //
  173.     // OEMDownloadFontheader - UNIDRV only
  174.     //
  175.     STDMETHOD(DownloadFontHeader)(THIS_ PDEVOBJ pdevobj,
  176.                                         PUNIFONTOBJ     pUFObj,
  177.                                         OUT DWORD       *pdwResult);
  178.     //
  179.     // OEMDownloadCharGlyph - UNIDRV only
  180.     //
  181.     STDMETHOD(DownloadCharGlyph)(THIS_ PDEVOBJ  pdevobj,
  182.                                     PUNIFONTOBJ         pUFObj,
  183.                                     HGLYPH              hGlyph,
  184.                                     PDWORD              pdwWidth,
  185.                                     OUT DWORD           *pdwResult);
  186.     //
  187.     // OEMTTDownloadMethod - UNIDRV only
  188.     //
  189.     STDMETHOD(TTDownloadMethod)(THIS_ PDEVOBJ   pdevobj,
  190.                                     PUNIFONTOBJ         pUFObj,
  191.                                     OUT DWORD           *pdwResult);
  192.     //
  193.     // OEMOutputCharStr - UNIDRV only
  194.     //
  195.     STDMETHOD(OutputCharStr)(THIS_ PDEVOBJ      pdevobj,
  196.                                 PUNIFONTOBJ         pUFObj,
  197.                                 DWORD               dwType,
  198.                                 DWORD               dwCount,
  199.                                 PVOID               pGlyph);
  200.     //
  201.     // OEMSendFontCmd - UNIDRV only
  202.     //
  203.     STDMETHOD(SendFontCmd)(THIS_ PDEVOBJ        pdevobj,
  204.                                 PUNIFONTOBJ         pUFObj,
  205.                                 PFINVOCATION        pFInv);
  206.     //
  207.     // OEMTextOutAsBitmap - UNIDRV only
  208.     //
  209.     STDMETHOD(TextOutAsBitmap)(THIS_ SURFOBJ        *pso,
  210.                                     STROBJ              *pstro,
  211.                                     FONTOBJ             *pfo,
  212.                                     CLIPOBJ             *pco,
  213.                                     RECTL               *prclExtra,
  214.                                     RECTL               *prclOpaque,
  215.                                     BRUSHOBJ            *pboFore,
  216.                                     BRUSHOBJ            *pboOpaque,
  217.                                     POINTL              *pptlOrg,
  218.                                     MIX                 mix);
  219.     //
  220.     // IPrintOemUni2 methods
  221.     //
  222.     //
  223.     // Method for plugin to hook out spooler's WritePrinter API so it
  224.     // can get access to output data Universal driver is generating
  225.     //
  226.     // At DrvEnablePDEV time, Universal driver will call this function with
  227.     // pdevobj = NULL, pBuf = NULL, cbBuffer = 0 to detect if the plugin
  228.     // implements this function. Plugin should return S_OK to indicate it is
  229.     // implementing this function, or return E_NOTIMPL otherwise.
  230.     //
  231.     // In pcbWritten, plugins should return the number of bytes written to the
  232.     // spooler's WritePrinter function. Zero doesn't carry a special meaning,
  233.     // errors must be reported through the returned HRESULT.
  234.     //
  235.     STDMETHOD(WritePrinter)(THIS_ PDEVOBJ       pdevobj,
  236.                             PVOID               pBuf,
  237.                             DWORD               cbBuffer,
  238.                             PDWORD              pcbWritten);
  239.     COemUni2();
  240.     ~COemUni2();
  241. protected:
  242.     LONG                m_cRef;
  243.     IPrintOemDriverUni* m_pOEMHelp;
  244. };
  245. #endif