Skip to content

dlls/gphoto2.ds: Fix bug. Return the DIB as a GlobalAlloc handle according to TWAIN spec instead of a HBITMAP

DG_IMAGE/DAT_IMAGEMEMXFER/MSG_GET returned the newly downloaded image as a HBITMAP handle Created by CreateDIBSection, which is in conflict with the TWIN Specification that requires a GlobalAlloc'ed handle filles with BITMAPINFO struct and bitmap data. The Handle must also be 64-Bit on 64-Bit WIN32. The code in dlls/sane.ds already did this correctly.

Without this change the gphoto2.ds will likely not work with usual windows software with TWAIN support.

Also contains a correction that after each image being transfered, the source needs to recuce the number of remaining images to transfer, else it will never reduce the currentState from 6 to 5 causing an error message when closing the data source.

The newly created GlobalAlloc memory block contains the DIB in bottom-up order (biHeight > 0), not top-down as before (biHeight < 0). This meets the approach in sane.ds

Merge request reports

Loading