Reputation: 21
I'm facing an issue on a Windows server 2019, used as a terminal server.
My app is a Delphi 32 bits executable, and when I ask the Twain dll to list the available scanner, the list is empty.
When using other application such as Twacker or EZTwain, the list is correctly populated.
On other OS (WS 2022, WS 2019 but not used for TSE, W7, W10 and so on...), no issue, everthing goes Ok.
==> question is: why can't I see those scanner ?
Test on other os => no issue
Test with 64bits executable => issue is the same
Run with admin rights => issue is the same
Upvotes: 0
Views: 128
Reputation: 21
Issue was in the LoadLibrary
call, due to the compile option
IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
If this option is not set, the windows directory given by the Windows API (Windows.GetWindowsDirectory
) is
C:\User\xxxUserAccountxxx\WINDOWS
,
instead of
C:\Windows
Thus, the application can not load correctly Twain dll & can not get the data from the twain_32 directory.
Edit: line added in the dpr file
{$R *.RES}
--> {$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}
Upvotes: 2