64-Bit twain data source manager should be named twaindsm.dll instead of twain_32.dll
Bernd Herd <[email protected]> Sat, 08 Nov 2025 13:42:45 +0100
| Newsgroups | gmane.comp.emulators.wine.devel |
|---|---|
| Organization | Herd Software Entwicklung |
| Message-ID | <[email protected]> |
Hello,
for 64-Bit, the code in dlls/twain_32 should be compiled into a library
installed as twaindsm.dll instead of twain_32.dll, since Windows
applications do expect a 64-Bit Data Source Manager to be named
twaindsm.dll.
How could that be done?
Background:
wine includes an interface from the TWAIN interface common in Windows
to the SANE interface common on Linux. This is dlls/sane.ds, which is
in TWAIN speak a "Data Source". This allows to use most scanners
supported by SANE from WINE, without caring about any special drivers.
Which is a pretty cool thing.
64 Bit TWAIN is somewhat exotic, since Microsoft is pushing towards
their WIA interface and does not include a 64-Bit Data Source Manager
with Windows. The 32-Bit Data Source Manager shipped with Windows is
TWAIN_32.DLL.
This DLL is under control of Microsoft and the TWAIN organization
cannot update it, so they choose to name their update DSM
"twaindsm.dll". I found some more information on that here:
https://github.com/twain/twain-dsm/blob/master/TWAIN_DSM/src/readme.doc](https://github.com/twain/twain-dsm/blob/master/TWAIN_DSM/src/readme.doc)
This twaindsm.dll is available in 32-Bit and 64-Bit. And so the only
64-Bit DSM that application programs expect is twaindsm.dll. There are
hardly any 64-Bit TWAIN drivers available on Windows.
Irfanview 64-Bit uses twaindsm.dll if installed and spawns a 32-Bit
EXE if not.
Older versions of 64-Bit Libreoffice for Windows used twaindsm.dll. New
Versions start a 32-Bit process to use 32-Bit TWAIN.
The code in the dlls/sane.ds searches for "twain_32", and I know two
ways to solve this.
What I don't know is how to change wine so that it compiles
dlls/twain_32 to twaindsm.dll for 64-Bit Builds only and deploy that
dll to the wine prefix.
Any suggestion of how to do that?
Yours
Bernd Herd
:-)