https://bugs.winehq.org/show_bug.cgi?id=53886
Bug ID: 53886 Summary: SendMessage(WM_GETTEXT) is implemented as Unicode instead of Ansi. Product: Wine Version: 7.20 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: vcc_02@yahoo.com Distribution: ---
SendMessage, with WM_GETTEXT returns Unicode, instead of ANSI when targeting other applications. This leads to unusable content, for applications expecting ANSI.
The Windows compatibility can be anything from Win7 to Win10. The behavior is the same on Wine's virtual desktop vs. native Linux desktop. Also, tested on Kubuntu 32-bit and 64-bit.
Test applications (source code available): https://github.com/VCC02/CodeExamples/blob/main/SendMessage_WM_GETTEXT/FP/Ge... https://github.com/VCC02/CodeExamples/blob/main/SendMessage_WM_GETTEXT/FP/Ge... https://github.com/VCC02/CodeExamples/blob/main/SendMessage_WM_GETTEXT/Delph...
Looking at the provided applications.. The "Control Text" editbox should properly display the received text, but its content is truncated by ASCII 0. The "Control Text [no ASCII 0]" editbox is set to display the same text, but it removes the ASCII 0 characters before displaying, so we can see the expected content. Below the "Control Text [no ASCII 0]" editbox, there is a hex representation of the received string, which shows the ASCII 0 characters after every other character, indicating UTF-16. Targeting the same window as the app calling SendMessage(WM_GETTEXT), results in the expecting content. It seems, that the Unicode content is for other windows/controls, from other applications, not the one making the call.
There are three provided executables, all seem to behave the same (FreePascal (CodeTyphon 7.9): 32-bit and 64-bit, and Delphi 2006: 32-bit). All of the three are compiled with no Unicode support (i.e., they call the "A" versions of the Windows API functions, e.g. SendMessageA).
On Wine 7.16 the app may crash after a few seconds. Newer versions of Wine are stable (7.20).
Thank you