# NAME

META_DIBBITBLT

# NEAREST API CALL

    #include <windows.h>

    BOOL32 BitBlt
    (
        HDC32 hdcDst,
        INT32 xDst,
        INT32 yDst,
        INT32 width,
        INT32 height,
        HDC32 hdcSrc,
        INT32 xSrc,
        INT32 ySrc,
        DWORD rop
    );

# DESCRIPTION

DIBBITBLT is the operand that BitBlt converts to automatically when used with a metafile. It has two forms so watch out.

DibBitBlt basically copies a dib into a dest location transformed by the ROP, but it can also be used with ROP's that dont use the src at all.

Form 1
In the scenario where hdcSrc is NULL, then the arguments are as follows

U16 | Value
0 | rop
1
2 | ySrc
3 | xSrc
4 | ???, probably nothing
5 | height
6 | width
7 | yDst
8 | xDst

Form 2
In the scenario where hdcSrc is not NULL, then the arguments are as follows

U16 | Value
0 | rop
1
2 | ySrc
3 | xSrc
4 | height
5 | width
6 | yDst
7 | xDst
8 until the end | the src dib |

rop is the ROP.
ySrc is the starting y coord to copy from (in log units i suppose) in the dib (if it exists).
xSrc it the x coord to copy from (in log units i suppose) in the dib (if it exists).
height is height in logical units of the destination rectangle
width is width in logical units of the destination rectangle
yDst is the y pos in logical units of the rectangle to copy to in the destination window
xDst is the x pos in logical units of the rectangle to copy to in the destination window

The primary purpose of this is to copy a dib to a given location, but it can be used to do all sorts of ROP tricks as well or instead.

back

Some realworld examples and thoughts at the time on DIBBITBLT

    DIBBITBLT is created from a BitBlt call, i havent seen BITBLT in the wild at
    all and suspect that it doesnt exist.

    theres two sets of possibilites for the parameters.
    one that fits the layout of the call which is used
    when the src is NULL, i.e....

    head
    40 09

    0 }__dwRop
    1 }

    2 srcy
    00 00

    3 srcx
    00 00

    4       ?
    00 00

    5 height
    50 00

    6 width
    50 00

    7 dest y
    00 00

    8 dest x
    5a 00

    and the other when src is not NULL, with the calls that use
    src, where in effect argument 4 (the src dc) is missing
    and the dib placed after the end of the parameters. I suppose
    you can tell one from the other either by looking at the
    no of parameters, or by seeing if no 4 is 0, or by seeing
    if the dwROP requires a src, i use approach one, as its simple.

    head
    40 09

    0 }__dwROP
    1 }
    09 0a fb 00

    2 srcy
    00 00

    3 srcx
    00 00

    4 dest height
    50 00

    5 dest width
    50 00

    6 dest y
    b4 00

    7 dest x
    b4 00

    8 the dib itself.
    28 00

    9
    00 00

    10
    50 00

    11
    00 00

    12
    50 00

    13
    00 00

    01 00

    Caolan