On Wed Nov 19 18:30:09 2025 +0000, Alexandre Julliard wrote:
Why do we need it at all? It isn't part of Windows, my understanding is that apps are supposed to install it themselves.
Am Mittwoch, dem 19.11.2025 um 12:30 -0600 schrieb Alexandre Julliard (@julliard):
Alexandre Julliard commented on a discussion on loader/wine.inf.in: https://gitlab.winehq.org/wine/wine/-/merge_requests/9519#note_122976
> [FakeDllsWin64] > 10,twain_64,sane.ds > 10,twain_64,gphoto2.ds > +10,,twaindsm.dll,twain_32.dll
Why do we need it at all? It isn't part of Windows, my understanding is that apps are supposed to install it themselves.
Hello,
applications usually assume that twaindsm.dll comes with the Data Source. Since wine is installing the sane.ds and gphoto2.ds data sources, it is logical that application devopers assume there are no data sources installed if there is no twaindsm.dll.
When testing I found 2 applications that use twaindsm.dll besides my own. One is Irfanview 64-Bit and if twaindsm.dll (64-Bit) is missing, it assumes there are no 64-Bit Data sources.
The other is an old version of LibreOffice. New versions of 64-Bit Libreoffice meanwhile include a 32-Bit application to perform TWAIN with 32-Bit technology and they don't offer 64-Bit TWAIN any more.
The TWAIN spec says:
"Applications that wish to use access the Data Source Manager, must install it themselves." (Page 12-1). That sentence can be read so that it is not the responsibility of the operating system to provide the DSM. Or it can be read as it is not the responsibility of the Data Source. But the TWAIN spec also says on page 2-9:
"Installation of the Data Source Manager TWAIN Applications and Sources should install the latest version of the Data Source Manager."
So if Sources should install the latest version of the DSM and Wine includes Data Source sane.ds and gphoto2.ds, it should install the latest version of the DSM. However the TWAIN DSM is C++ code and wine includes no C++ code. So I found it reasonable to extend the dlls/twain_32 with the most important TWAIN 2 features to work with 64 Bit and ship the wine DSM as twaindsm.dll.
However neither the DS, nor the dlls/twain_32 are fully TWAIN 2.0 compliant yet. And they don't need to be to work for the three test cases I was able to come up with.
The TWAIN.org version of twaindsm.dll offers memory management callbacks, that themselfs only use the old GlobalAlloc/GlobalFree as the Wine version does, so is essentially a no-op. And it stores the last recently used DS in the registry, which seems to be missing in the Wine version.