On Wednesday 14 January 2009 08:29:33 Jeff Latimer wrote:
I have tested this a number of ways and I can not see a mechanism that DDE can determine whether data passed is UNICODE (pData is of type LPBYTE). In my tests, the case of the server uses a UNICODE window it is immaterial as to the type of window the client uses but is dependent on the type of data passed.
This has been discussed before, we cannot rely on IsTextUnicode since it's just a heuristic. MSDN mentions that the character set depends on whether the client called DdeInitializeA or DdeInitializeW, and it can be overridden by setting iCodePage in the CONVCONTEXT structure.
This suggests to me that we'll need some form of IPC.
-Hans
Hans Leidekker wrote:
On Wednesday 14 January 2009 08:29:33 Jeff Latimer wrote:
I have tested this a number of ways and I can not see a mechanism that DDE can determine whether data passed is UNICODE (pData is of type LPBYTE). In my tests, the case of the server uses a UNICODE window it is immaterial as to the type of window the client uses but is dependent on the type of data passed.
This has been discussed before, we cannot rely on IsTextUnicode since it's just a heuristic. MSDN mentions that the character set depends on whether the client called DdeInitializeA or DdeInitializeW, and it can be overridden by setting iCodePage in the CONVCONTEXT structure.
This suggests to me that we'll need some form of IPC.
-Hans
The problem is complicated by the data type of LPBYTE. The application does not pass the type of the data to the client. I am at a loss as to how DDE actually determines the type at the client side.
Jeff
"Jeff Latimer" lats@yless4u.com.au wrote:
The problem is complicated by the data type of LPBYTE. The application does not pass the type of the data to the client. I am at a loss as to how DDE actually determines the type at the client side.
Then the first thing to do is to write some test cases.
Dmitry Timoshkov wrote:
Then the first thing to do is to write some test cases.
I will set some up.
Dmitry Timoshkov wrote:
Then the first thing to do is to write some test cases.
I have had another look at the existing test cases that I added a few months ago. I have rerun the tests before and after the patch "[3/5] user32: Resend: Move character conversion logic to dde_server.d & remove todo's" and have attached the results. The key values for msg_index are 10, 16 and 22.
msg_index=10 tests 2 Unicode interfaces passing non Unicode data
the data is converted to Unicode
msg_index=16 tests a non Unicode client passing non Unicode data to a Unicode server
the data is converted to Unicode
msg_index=22 tests a Unicode client passing non Unicode data to a non Unicode server
This one is strange as it produces garbage in Windows. It seems to be doing a WideToMultiByte conversion on the non Unicode data. In this case it appear not to detect the data is not Unicode and converts it anyway, hence the small size. It appears to be an undeveloped case in Windows.
To clarify the tests as to which messages are being converted I have submitted patch "user32/tests: Clarify the msgs to differentiate Unicode and ASCII in tests".
Jeff
The tests in dde.c show the behaviour of the conversion. All tests pass using crosstest on XP. The key msg_index values are 10, 16 and 22.
if (msg_index == 10 || msg_index ==11 || msg_index == 16 || msg_index ==17) if (msg_index == 10 || msg_index == 16) todo_wine ok(size == 34, "Expected that size should be 34 not %d, msg_index=%d\n", size, msg_index); else ok(size == 34, "Expected that size should be 34 not %d, msg_index=%d\n", size, msg_index); else if (msg_index ==22) todo_wine ok(size == 9, "Expected that size should be 9 not %d, msg_index=%d\n", size, msg_index); else
Tests run betfore the patch
../../../tools/runtest -P wine -M user32.dll -T ../../.. -p user32_test.exe.so dde.c && touch dde.ok fixme:win:show_window previous 00000000 fixme:ddeml:DdeClientTransaction Unknown transaction type 2022 fixme:ddeml:DdeClientTransaction Unknown transaction type 1062 fixme:ddeml:DdeClientTransaction Unknown transaction type 8072 fixme:ddeml:DdeClientTransaction Unknown transaction type 80c2 fixme:ddeml:DdeClientTransaction Unknown transaction type 8002 fixme:ddeml:DdeClientTransaction Unknown transaction type 80f2 fixme:ddeml:DdeClientTransaction Unknown transaction type 80a2 fixme:ddeml:DdeClientTransaction Unknown transaction type 80d2 fixme:ddeml:DdeClientTransaction Unknown transaction type 20e2 fixme:ddeml:DdeClientTransaction Unknown transaction type 8080 dde: 81 tests executed (1 marked as todo, 0 failures), 0 skipped. err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation dde: 99 tests executed (4 marked as todo, 0 failures), 0 skipped. dde.c:2411: start end to end server 1 dde.c:2353: Start end to end client 1 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2411: start end to end server 0 dde.c:2353: Start end to end client 0 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2411: start end to end server 0 dde.c:2353: Start end to end client 1 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2411: start end to end server 1 dde.c:2353: Start end to end client 0 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:1176: dde_server_wndprocW: 0x80028 0081 00000000 0033fa58 dde.c:1176: dde_server_wndprocW: 0x80028 0083 00000000 0033fa08 dde.c:1176: dde_server_wndprocW: 0x80028 0001 00000000 0033fa58 dde.c:1176: dde_server_wndprocW: 0x80028 0005 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0003 00000000 00640064 dde.c:1304: server hwnd 0x80028, client hwnd 0x7002c dde.c:1176: dde_server_wndprocW: 0x80028 03e0 0007002e 0000c024 dde.c:1184: server: got WM_DDE_INITIATE from 0x7002e with 0000c024 dde.c:1190: server: sending WM_DDE_ACK to 0x7002e dde.c:1159: hook_dde_client_wndproc: 0x7002e 03e4 00080028 0000c024 dde.c:1165: WM_DDE_ACK: status 0000 hglobal (nil) dde.c:1370: hwnd 0x7002e, hwndPartner 0x80028 dde.c:1372: sending test client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 001229da dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 001229da dde.c:1208: 001229da => lo 0000 hi 1229da dde.c:1217: ignoring unknown WM_DDE_EXECUTE command dde.c:1229: server: posting NEGATIVE WM_DDE_ACK to 0x7002e dde.c:1380: sending ANSI client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 00122312 dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 00122312 dde.c:1208: 00122312 => lo 0000 hi 122312 dde.c:1229: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1389: sending unicode client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 00121b22 dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 00121b22 dde.c:1208: 00121b22 => lo 0000 hi 121b22 dde.c:1229: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1176: dde_server_wndprocW: 0x80028 03e1 0007002e 00000000 dde.c:1243: server: got WM_DDE_TERMINATE from 0x7002e with 00000000 dde.c:1250: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1159: hook_dde_client_wndproc: 0x7002e 0002 00000000 00000000 dde.c:1159: hook_dde_client_wndproc: 0x7002e 0082 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0002 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0082 00000000 00000000 dde: 616 tests executed (22 marked as todo, 0 failures), 0 skipped.
Tests run after patched code
../../../tools/runtest -P wine -M user32.dll -T ../../.. -p user32_test.exe.so dde.c && touch dde.ok fixme:win:show_window previous 00000000 fixme:ddeml:DdeClientTransaction Unknown transaction type 2022 fixme:ddeml:DdeClientTransaction Unknown transaction type 1062 fixme:ddeml:DdeClientTransaction Unknown transaction type 8072 fixme:ddeml:DdeClientTransaction Unknown transaction type 80c2 fixme:ddeml:DdeClientTransaction Unknown transaction type 8002 fixme:ddeml:DdeClientTransaction Unknown transaction type 80f2 fixme:ddeml:DdeClientTransaction Unknown transaction type 80a2 fixme:ddeml:DdeClientTransaction Unknown transaction type 80d2 fixme:ddeml:DdeClientTransaction Unknown transaction type 20e2 fixme:ddeml:DdeClientTransaction Unknown transaction type 8080 dde: 81 tests executed (1 marked as todo, 0 failures), 0 skipped. err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation err:ddeml:WDML_ServerConvProc mismatch between C/S windows and conversation dde: 99 tests executed (4 marked as todo, 0 failures), 0 skipped. dde.c:2419: start end to end server ASCII dde.c:2361: Start end to end client ASCII dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2419: start end to end server UNICODE dde.c:2361: Start end to end client UNICODE dde.c:2253: Test succeeded inside todo block: Expected that size should be 34 not 34, msg_index=10 dde.c:2279: Test succeeded inside todo block: Expected "Test dde command", msg_index=10 dde.c:2282: Test succeeded inside todo block: Expected 34, got 34, msg_index=10 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2419: start end to end server UNICODE dde.c:2361: Start end to end client ASCII dde.c:2253: Test succeeded inside todo block: Expected that size should be 34 not 34, msg_index=16 dde.c:2279: Test succeeded inside todo block: Expected "Test dde command", msg_index=16 dde.c:2282: Test succeeded inside todo block: Expected 34, got 34, msg_index=16 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2419: start end to end server ASCII dde.c:2361: Start end to end client UNICODE dde.c:2261: Test succeeded inside todo block: Expected that size should be 9 not 9, msg_index=22 dde: 11 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:1176: dde_server_wndprocW: 0x80028 0081 00000000 0033fa58 dde.c:1176: dde_server_wndprocW: 0x80028 0083 00000000 0033fa08 dde.c:1176: dde_server_wndprocW: 0x80028 0001 00000000 0033fa58 dde.c:1176: dde_server_wndprocW: 0x80028 0005 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0003 00000000 00640064 dde.c:1304: server hwnd 0x80028, client hwnd 0x7002c dde.c:1176: dde_server_wndprocW: 0x80028 03e0 0007002e 0000c024 dde.c:1184: server: got WM_DDE_INITIATE from 0x7002e with 0000c024 dde.c:1190: server: sending WM_DDE_ACK to 0x7002e dde.c:1159: hook_dde_client_wndproc: 0x7002e 03e4 00080028 0000c024 dde.c:1165: WM_DDE_ACK: status 0000 hglobal (nil) dde.c:1370: hwnd 0x7002e, hwndPartner 0x80028 dde.c:1372: sending test client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 001225d2 dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 001225d2 dde.c:1208: 001225d2 => lo 0000 hi 1225d2 dde.c:1217: ignoring unknown WM_DDE_EXECUTE command dde.c:1229: server: posting NEGATIVE WM_DDE_ACK to 0x7002e dde.c:1380: sending ANSI client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 00122312 dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 00122312 dde.c:1208: 00122312 => lo 0000 hi 122312 dde.c:1229: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1389: sending unicode client transaction command dde.c:1176: dde_server_wndprocW: 0x80028 03e8 0007002e 00121b22 dde.c:1205: server: got WM_DDE_EXECUTE from 0x7002e with 00121b22 dde.c:1208: 00121b22 => lo 0000 hi 121b22 dde.c:1229: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1176: dde_server_wndprocW: 0x80028 03e1 0007002e 00000000 dde.c:1243: server: got WM_DDE_TERMINATE from 0x7002e with 00000000 dde.c:1250: server: posting POSITIVE WM_DDE_ACK to 0x7002e dde.c:1159: hook_dde_client_wndproc: 0x7002e 0002 00000000 00000000 dde.c:1159: hook_dde_client_wndproc: 0x7002e 0082 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0002 00000000 00000000 dde.c:1176: dde_server_wndprocW: 0x80028 0082 00000000 00000000 dde: 616 tests executed (15 marked as todo, 7 failures), 0 skipped.