Dmitry Timoshkov wrote:
"Jeff Latimer" lats@yless4u.com.au wrote:
The issue is that the client passes data using messaging or DDEML there is no method in the api to inform the server whether the data is Unicode or not. The only method I have determined is to use IsTextUnicode() but that is guessing. However, it looks like Windows guesses too.
Have you looked at the info returned DdeQueryConvInfo, particularly iCodePage in the conversation context?
I have inserted DdeQueryConvInfo into dde.c for checking whether it would help in determining the Unicodeness of the passed data. The results are below. The tests are to pass two messages, the 1st is non Unicode and 2nd is Unicode. As can be seen, DdeQueryConvInfo does not help with determining if the data is Unicode as the codepage is determined by the Client initialisation not from the data.
dde.c:2472: start end to end server ASCII dde.c:2403: Start end to end client ASCII dde.c:2275: server iCodePage=1004 dde.c:2440: client iCodePage=1004 dde.c:2275: server iCodePage=1004 dde.c:2452: client iCodePage=1004 dde: 15 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2472: start end to end server UNICODE dde.c:2403: Start end to end client UNICODE dde.c:2275: server iCodePage=1200 dde.c:2440: client iCodePage=1200 dde.c:2275: server iCodePage=1200 dde.c:2452: client iCodePage=1200 dde: 15 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2472: start end to end server UNICODE dde.c:2403: Start end to end client ASCII dde.c:2275: server iCodePage=1004 dde.c:2440: client iCodePage=1004 dde.c:2275: server iCodePage=1004 dde.c:2452: client iCodePage=1004 dde: 15 tests executed (0 marked as todo, 0 failures), 0 skipped. dde.c:2472: start end to end server ASCII dde.c:2403: Start end to end client UNICODE dde.c:2275: server iCodePage=1200 dde.c:2440: client iCodePage=1200 dde.c:2275: server iCodePage=1200 dde.c:2452: client iCodePage=1200
Server code issuing the query pConvInfo.cb = sizeof(pConvInfo); err = DdeQueryConvInfo(hconv, QID_SYNC, &pConvInfo); ok(err == TRUE, "should be the number of bytes not %d\n", err); err = DdeGetLastError(server_pid); ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err); trace("server iCodePage=%d\n", pConvInfo.ConvCtxt.iCodePage);
Client code issuing the query pConvInfo.cb = sizeof(pConvInfo); err = DdeQueryConvInfo(hconv, QID_SYNC, &pConvInfo); ok(err == TRUE, "should be the number of bytes not %d\n", err); err = DdeGetLastError(client_pid); ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err); trace("Client iCodePage=%d\n", pConvInfo.ConvCtxt.iCodePage);