Add 32->16 mapping for SBM_GETRANGE/SBM_SETRANGE messages
Dmitry Timoshkov
dmitry at baikal.ru
Wed Jun 9 01:20:19 CDT 2004
Hello,
since our [S|G]etScrollRange implementation now sends messages to
the control for SB_CTL case, 16-bit applications crash due to the fact
that wParam of SBM_GETRANGE message gets truncated in the 32->16 path.
This patch adds support for 32->16 mapping for SBM_GETRANGE/SBM_SETRANGE
messages by converting them to SBM_GETRANGE16/SBM_SETRANGE16 messages based
on the results I got with a 16-bit test app I wrote for that purpose.
Please apply after another scrollbar patch.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
- Add 32->16 mapping for SBM_GETRANGE/SBM_SETRANGE messages.
- Add support for SBM_GETRANGE16 message in the scrollbar window proc.
diff -u cvs/hq/wine/controls/scroll.c wine_hq_src/controls/scroll.c
--- cvs/hq/wine/controls/scroll.c 2004-06-09 14:30:11.000000000 +0900
+++ wine/controls/scroll.c 2004-06-09 14:31:01.000000000 +0900
@@ -1378,8 +1378,12 @@ static LRESULT WINAPI ScrollBarWndProc(
return 0;
case SBM_GETRANGE16:
- FIXME("don't know how to handle SBM_GETRANGE16 (wp=%04x,lp=%08lx)\n", wParam, lParam );
- return 0;
+ {
+ INT min, max;
+
+ SCROLL_GetScrollRange(hwnd, SB_CTL, &min, &max);
+ return MAKELRESULT(min, max);
+ }
case SBM_GETRANGE:
return SCROLL_GetScrollRange(hwnd, SB_CTL, (LPINT)wParam, (LPINT)lParam);
diff -u cvs/hq/wine/windows/winproc.c wine_hq_src/windows/winproc.c
--- cvs/hq/wine/windows/winproc.c 2004-02-20 21:00:54.000000000 +0800
+++ wine/windows/winproc.c 2004-06-08 19:49:20.000000000 +0900
@@ -1876,6 +1876,16 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UI
*pwparam16 = (WPARAM16)LOWORD(wParam32);
switch(msg32)
{
+ case SBM_SETRANGE:
+ *pmsg16 = SBM_SETRANGE16;
+ *plparam = MAKELPARAM(wParam32, *plparam);
+ *pwparam16 = 0;
+ return 0;
+
+ case SBM_GETRANGE:
+ *pmsg16 = SBM_GETRANGE16;
+ return 1;
+
case BM_GETCHECK:
case BM_SETCHECK:
case BM_GETSTATE:
@@ -2385,6 +2395,11 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd,
{
switch(msg)
{
+ case SBM_GETRANGE:
+ *(LPINT)wParam = LOWORD(p16->lResult);
+ *(LPINT)lParam = HIWORD(p16->lResult);
+ break;
+
case LB_ADDFILE:
case LB_ADDSTRING:
case LB_DIR:
@@ -2934,6 +2949,9 @@ LRESULT WINAPI __wine_call_wndproc_32A(
WPARAM wParam32;
HWND hwnd32 = WIN_Handle32( hwnd );
+ TRACE_(msg)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
+ func, hwnd32, SPY_GetMsgName(msg, hwnd32), wParam, lParam);
+
if (WINPROC_MapMsg16To32A( hwnd32, msg, wParam, &msg32, &wParam32, &lParam ) == -1)
return 0;
result = WINPROC_CallWndProc( func, hwnd32, msg32, wParam32, lParam );
@@ -2952,6 +2970,9 @@ LRESULT WINAPI __wine_call_wndproc_32W(
WPARAM wParam32;
HWND hwnd32 = WIN_Handle32( hwnd );
+ TRACE_(msg)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
+ func, hwnd32, SPY_GetMsgName(msg, hwnd32), wParam, lParam);
+
if (WINPROC_MapMsg16To32W( hwnd32, msg, wParam, &msg32, &wParam32, &lParam ) == -1)
return 0;
result = WINPROC_CallWndProc( func, hwnd32, msg32, wParam32, lParam );
More information about the wine-patches
mailing list