How to hook STRETCHBLT (printer driver)

Discussion in 'Windows Vista Drivers' started by blacklee, Mar 8, 2006.

  1. blacklee

    blacklee Guest

    Dear All,

    I am writing a printer driver,I want to hook the STRETCHBLT
    function,but I can not get it work。

    My codes section as below,
    /////////////////////////////////////////////////////
    hSurf = EngCreateBitmap( sizeSurface,
    GetBmpDelta(Format,
    pPDEV- >ulHorzRes),Format,BMF_USERMEM|BMF_TOPDOWN, NULL) ;

    EngAssociateSurface( (HSURF)hSurf, pPDEV->hDev, HOOK_STRETCHBLT ) ;

    //////////////////////////////////////////////////////
    BOOL WINAPI DrvStretchBlt(
    IN SURFOBJ *psoDest,
    IN SURFOBJ *psoSrc,
    IN SURFOBJ *psoMask,
    IN CLIPOBJ *pco,
    IN XLATEOBJ *pxlo,
    IN COLORADJUSTMENT *pca,
    IN POINTL *pptlHTOrg,
    IN RECTL *prclDest,
    IN RECTL *prclSrc,
    IN POINTL *pptlMask,
    IN ULONG iMode
    )
    {
    MessageBox(NULL,L"DrvStretchBlt",L"printer driver",MB_OK);

    iMode = HALFTONE;
    return EngStretchBlt(
    psoDest,
    psoSrc,
    psoMask,
    pco,
    pxlo,
    pca,
    pptlHTOrg,
    prclDest,
    prclSrc,
    pptlMask,
    iMode
    ) ;
    }
    /////////////////////////////////////////////////////////


    Anybody can give me some advice,Thanks a lotï¼

    Best Regards,
    Black
     
    blacklee, Mar 8, 2006
    #1
    1. Advertisements

  2. blacklee

    Terry Guest

    Guessing:

    A) DrvStretchBlt() is not in the DrvEnableDriver() function table
    B) hSurf is not an HSURF (no cast should be required)
    C) GetBmpDelta() does not work properly.
    D) sizeSurface is incorrect.
    E) Format is incorrect

    Dear All,

    I am writing a printer driver,I want to hook the STRETCHBLT
    function,but I can not get it work?

    My codes section as below,
    /////////////////////////////////////////////////////
    hSurf = EngCreateBitmap( sizeSurface,
    GetBmpDelta(Format,
    pPDEV- >ulHorzRes),Format,BMF_USERMEM|BMF_TOPDOWN, NULL) ;

    EngAssociateSurface( (HSURF)hSurf, pPDEV->hDev, HOOK_STRETCHBLT ) ;

    //////////////////////////////////////////////////////
    BOOL WINAPI DrvStretchBlt(
    IN SURFOBJ *psoDest,
    IN SURFOBJ *psoSrc,
    IN SURFOBJ *psoMask,
    IN CLIPOBJ *pco,
    IN XLATEOBJ *pxlo,
    IN COLORADJUSTMENT *pca,
    IN POINTL *pptlHTOrg,
    IN RECTL *prclDest,
    IN RECTL *prclSrc,
    IN POINTL *pptlMask,
    IN ULONG iMode
    )
    {
    MessageBox(NULL,L"DrvStretchBlt",L"printer driver",MB_OK);

    iMode = HALFTONE;
    return EngStretchBlt(
    psoDest,
    psoSrc,
    psoMask,
    pco,
    pxlo,
    pca,
    pptlHTOrg,
    prclDest,
    prclSrc,
    pptlMask,
    iMode
    ) ;
    }
    /////////////////////////////////////////////////////////


    Anybody can give me some advice,Thanks a lot!

    Best Regards,
    Black
     
    Terry, Mar 8, 2006
    #2
    1. Advertisements

  3. blacklee

    Vipin [MVP] Guest

    Have a look at DrvStretchBlt and DrvStretchBltTROP entry points.
    Have a look at the source SURFOBJ, it will have the bitmap bits
    you would like to get hold of.

    --
    Vipin Aravind
    http://www.explorewindows.com


    Dear All,

    I am writing a printer driver,I want to hook the STRETCHBLT
    function,but I can not get it work?

    My codes section as below,
    /////////////////////////////////////////////////////
    hSurf = EngCreateBitmap( sizeSurface,
    GetBmpDelta(Format,
    pPDEV- >ulHorzRes),Format,BMF_USERMEM|BMF_TOPDOWN, NULL) ;

    EngAssociateSurface( (HSURF)hSurf, pPDEV->hDev, HOOK_STRETCHBLT ) ;

    //////////////////////////////////////////////////////
    BOOL WINAPI DrvStretchBlt(
    IN SURFOBJ *psoDest,
    IN SURFOBJ *psoSrc,
    IN SURFOBJ *psoMask,
    IN CLIPOBJ *pco,
    IN XLATEOBJ *pxlo,
    IN COLORADJUSTMENT *pca,
    IN POINTL *pptlHTOrg,
    IN RECTL *prclDest,
    IN RECTL *prclSrc,
    IN POINTL *pptlMask,
    IN ULONG iMode
    )
    {
    MessageBox(NULL,L"DrvStretchBlt",L"printer driver",MB_OK);

    iMode = HALFTONE;
    return EngStretchBlt(
    psoDest,
    psoSrc,
    psoMask,
    pco,
    pxlo,
    pca,
    pptlHTOrg,
    prclDest,
    prclSrc,
    pptlMask,
    iMode
    ) ;
    }
    /////////////////////////////////////////////////////////


    Anybody can give me some advice,Thanks a lot!

    Best Regards,
    Black
     
    Vipin [MVP], Mar 8, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.