Alexandre Julliard wrote:
Jeff Latimer <lats(a)yless4u.com.au> writes:
@@ -772,12 +774,51 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
if (ptr) { - hDdeData = DdeCreateDataHandle(0, ptr, GlobalSize(pXAct->hMem), + DWORD memSize, ptrSize = GlobalSize(pXAct->hMem); + + TRACE("Client is %s, Server is %s, Text is %s\n", + IsWindowUnicode(pConv->hwndClient) ? "Unicode" : "ANSI", + IsWindowUnicode(pConv->hwndServer) ? "Unicode" : "ANSI", + IsTextUnicode(ptr, ptrSize, NULL) ? "Unicode" : "ANSI"); + + if (!(IsWindowUnicode(pConv->hwndClient)) && !(IsWindowUnicode(pConv->hwndServer)) && IsTextUnicode(ptr, ptrSize, NULL)) + memSize = WideCharToMultiByte( CP_ACP, 0, ptr, ptrSize / sizeof(WCHAR), NULL, 0, NULL, NULL); + + else if (IsWindowUnicode(pConv->hwndServer) && !IsTextUnicode(ptr, ptrSize, NULL)) + memSize = MultiByteToWideChar( CP_ACP, 0, ptr, ptrSize, NULL, 0) * sizeof(WCHAR);
Using IsTextUnicode doesn't look right, you shouldn't need to guess.
I am not sure how to get around guessing in this case. The client call DdeClientTransaction and passes the data as LPBYTE. The server receives the data as a block of bytes and has to work out whether the data is Unicode. The client does not really know if the data is Unicode and DDE does not pass a data type with XTYP_EXECUTE. I could stick a FIXME note in there for the meantime. Jeff