Added mapping to/from unicode for WM_CHAR, WM_DEADCHAR, WM_SYSCHAR,
WM_SYSDEADCHAR messages.
diff --git a/windows/message.c b/windows/message.c
index 30b41a9..3ed0bfb 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -1083,7 +1083,7 @@
}
case MAKELONG( QMSG_WIN32A, QMSG_WIN32W ):
- switch ( WINPROC_MapMsg32ATo32W( msg->hwnd, msg->message, msg->wParam, &msg->lParam ) )
+ switch ( WINPROC_MapMsg32ATo32W( msg->hwnd, msg->message, &msg->wParam, &msg->lParam ) )
{
case 0:
return TRUE;
@@ -1095,7 +1095,7 @@
}
case MAKELONG( QMSG_WIN32W, QMSG_WIN32A ):
- switch ( WINPROC_MapMsg32WTo32A( msg->hwnd, msg->message, msg->wParam, &msg->lParam ) )
+ switch ( WINPROC_MapMsg32WTo32A( msg->hwnd, msg->message, &msg->wParam, &msg->lParam ) )
{
case 0:
return TRUE;
@@ -1185,7 +1185,8 @@
MSG tmpMsg = qmsg->msg;
if ( !MSG_ConvertMsg( &tmpMsg, qmsg->type, type ) )
{
- ERR( "Message of wrong type contains pointer parameters. Skipped!\n ");
+ ERR( "Message %s of wrong type contains pointer parameters. Skipped!\n",
+ SPY_GetMsgName(tmpMsg.message));
QUEUE_RemoveMsg( msgQueue, qmsg );
goto retry;
}
diff --git a/windows/winproc.c b/windows/winproc.c
index ddf8942..34a322a 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -546,21 +546,21 @@
* Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
*
* FIXME:
- * WM_CHAR, WM_CHARTOITEM, WM_DEADCHAR, WM_MENUCHAR, WM_SYSCHAR, WM_SYSDEADCHAR
+ * WM_CHARTOITEM, WM_MENUCHAR
*
* FIXME:
* WM_GETTEXT/WM_SETTEXT and static control with SS_ICON style:
* the first four bytes are the handle of the icon
* when the WM_SETTEXT message has been used to set the icon
*/
-INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam )
+INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam )
{
switch(msg)
{
case WM_GETTEXT:
{
LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0,
- wParam * sizeof(WCHAR) + sizeof(LPARAM) );
+ *pwparam * sizeof(WCHAR) + sizeof(LPARAM) );
if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr;
@@ -663,6 +663,18 @@
}
return 1;
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ {
+ char ch = *pwparam;
+ WCHAR wch;
+ MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1);
+ *pwparam = wch;
+ }
+ return 0;
+
case WM_ASKCBFORMATNAME:
case WM_DEVMODECHANGE:
case WM_PAINTCLIPBOARD:
@@ -783,13 +795,14 @@
* Map a message from Unicode to Ansi.
* Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
*/
-INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam )
-{ switch(msg)
+INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam )
+{
+ switch(msg)
{
case WM_GETTEXT:
{
LPARAM *ptr = (LPARAM *)HeapAlloc( GetProcessHeap(), 0,
- wParam + sizeof(LPARAM) );
+ *pwparam + sizeof(LPARAM) );
if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */
*plparam = (LPARAM)ptr;
@@ -887,6 +900,18 @@
}
return 1;
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ {
+ WCHAR wch = *pwparam;
+ char ch;
+ WideCharToMultiByte( CP_ACP, 0, &wch, 1, &ch, 1, NULL, NULL );
+ *pwparam = ch;
+ }
+ return 0;
+
case WM_ASKCBFORMATNAME:
case WM_DEVMODECHANGE:
case WM_PAINTCLIPBOARD:
@@ -1380,7 +1405,7 @@
case WM_GETTEXT:
case WM_SETTEXT:
*plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam);
- return WINPROC_MapMsg32ATo32W( hwnd, *pmsg32, *pwparam32, plparam );
+ return WINPROC_MapMsg32ATo32W( hwnd, *pmsg32, pwparam32, plparam );
case WM_NCCREATE:
case WM_CREATE:
{
@@ -1444,6 +1469,19 @@
return 1;
}
else return 0;
+
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ {
+ char ch = wParam16;
+ WCHAR wch;
+ MultiByteToWideChar( CP_ACP, 0, &ch, 1, &wch, 1);
+ *pwparam32 = wch;
+ }
+ return 0;
+
default: /* No Unicode translation needed */
return WINPROC_MapMsg16To32A( msg16, wParam16, pmsg32,
pwparam32, plparam );
@@ -2219,6 +2257,19 @@
*plparam = (LPARAM)SEGPTR_GET(str);
}
return 1;
+
+ case WM_CHAR:
+ case WM_DEADCHAR:
+ case WM_SYSCHAR:
+ case WM_SYSDEADCHAR:
+ {
+ WCHAR wch = wParam32;
+ char ch;
+ WideCharToMultiByte( CP_ACP, 0, &wch, 1, &ch, 1, NULL, NULL);
+ *pwparam16 = ch;
+ }
+ return 0;
+
default: /* No Unicode translation needed (?) */
return WINPROC_MapMsg32ATo16( hwnd, msg32, wParam32, pmsg16,
pwparam16, plparam );
@@ -2271,7 +2322,7 @@
{
LRESULT result;
- if (WINPROC_MapMsg32ATo32W( hwnd, msg, wParam, &lParam ) == -1) return 0;
+ if (WINPROC_MapMsg32ATo32W( hwnd, msg, &wParam, &lParam ) == -1) return 0;
result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
WINPROC_UnmapMsg32ATo32W( hwnd, msg, wParam, lParam );
return result;
@@ -2289,7 +2340,7 @@
{
LRESULT result;
- if (WINPROC_MapMsg32WTo32A( hwnd, msg, wParam, &lParam ) == -1) return 0;
+ if (WINPROC_MapMsg32WTo32A( hwnd, msg, &wParam, &lParam ) == -1) return 0;
result = WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
WINPROC_UnmapMsg32WTo32A( hwnd, msg, wParam, lParam );
return result;