2 * Window procedure callbacks
4 * Copyright 1995 Martin von Loewis
5 * Copyright 1996 Alexandre Julliard
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
33 #include "wine/winbase16.h"
34 #include "wine/winuser16.h"
38 #include "user_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DECLARE_DEBUG_CHANNEL(msg
);
45 WINE_DECLARE_DEBUG_CHANNEL(relay
);
46 WINE_DEFAULT_DEBUG_CHANNEL(win
);
48 typedef struct tagWINDOWPROC
50 WNDPROC16 proc16
; /* 16-bit window proc */
51 WNDPROC procA
; /* ASCII window proc */
52 WNDPROC procW
; /* Unicode window proc */
55 #define WINPROC_HANDLE (~0UL >> 16)
56 #define MAX_WINPROCS 8192
58 static WINDOWPROC winproc_array
[MAX_WINPROCS
];
59 static UINT winproc_used
;
61 static CRITICAL_SECTION winproc_cs
;
62 static CRITICAL_SECTION_DEBUG critsect_debug
=
65 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
66 0, 0, { (DWORD_PTR
)(__FILE__
": winproc_cs") }
68 static CRITICAL_SECTION winproc_cs
= { &critsect_debug
, -1, 0, 0, 0, 0 };
70 /* find an existing winproc for a given 16-bit function and type */
71 /* FIXME: probably should do something more clever than a linear search */
72 static inline WINDOWPROC
*find_winproc16( WNDPROC16 func
)
76 for (i
= 0; i
< winproc_used
; i
++)
78 if (winproc_array
[i
].proc16
== func
) return &winproc_array
[i
];
83 /* find an existing winproc for a given function and type */
84 /* FIXME: probably should do something more clever than a linear search */
85 static inline WINDOWPROC
*find_winproc( WNDPROC funcA
, WNDPROC funcW
)
89 for (i
= 0; i
< winproc_used
; i
++)
91 if (funcA
&& winproc_array
[i
].procA
!= funcA
) continue;
92 if (funcW
&& winproc_array
[i
].procW
!= funcW
) continue;
93 return &winproc_array
[i
];
98 /* return the window proc for a given handle, or NULL for an invalid handle */
99 static inline WINDOWPROC
*handle_to_proc( WNDPROC handle
)
101 UINT index
= LOWORD(handle
);
102 if ((ULONG_PTR
)handle
>> 16 != WINPROC_HANDLE
) return NULL
;
103 if (index
>= winproc_used
) return NULL
;
104 return &winproc_array
[index
];
107 /* create a handle for a given window proc */
108 static inline WNDPROC
proc_to_handle( WINDOWPROC
*proc
)
110 return (WNDPROC
)(ULONG_PTR
)((proc
- winproc_array
) | (WINPROC_HANDLE
<< 16));
113 /* allocate and initialize a new winproc */
114 static inline WINDOWPROC
*alloc_winproc( WNDPROC funcA
, WNDPROC funcW
)
118 /* check if the function is already a win proc */
119 if (funcA
&& (proc
= handle_to_proc( funcA
))) return proc
;
120 if (funcW
&& (proc
= handle_to_proc( funcW
))) return proc
;
121 if (!funcA
&& !funcW
) return NULL
;
123 EnterCriticalSection( &winproc_cs
);
125 /* check if we already have a winproc for that function */
126 if (!(proc
= find_winproc( funcA
, funcW
)))
128 if (winproc_used
< MAX_WINPROCS
)
130 proc
= &winproc_array
[winproc_used
++];
133 TRACE( "allocated %p for %p/%p (%d/%d used)\n",
134 proc_to_handle(proc
), funcA
, funcW
, winproc_used
, MAX_WINPROCS
);
136 else FIXME( "too many winprocs, cannot allocate one for %p/%p\n", funcA
, funcW
);
138 else TRACE( "reusing %p for %p/%p\n", proc_to_handle(proc
), funcA
, funcW
);
140 LeaveCriticalSection( &winproc_cs
);
147 #include "pshpack1.h"
149 /* Window procedure 16-to-32-bit thunk */
152 BYTE popl_eax
; /* popl %eax (return address) */
153 BYTE pushl_func
; /* pushl $proc */
155 BYTE pushl_eax
; /* pushl %eax */
156 BYTE ljmp
; /* ljmp relay*/
157 DWORD relay_offset
; /* __wine_call_wndproc */
163 #define MAX_THUNKS (0x10000 / sizeof(WINPROC_THUNK))
165 static WINPROC_THUNK
*thunk_array
;
166 static UINT thunk_selector
;
167 static UINT thunk_used
;
169 /* return the window proc for a given handle, or NULL for an invalid handle */
170 static inline WINDOWPROC
*handle16_to_proc( WNDPROC16 handle
)
172 if (HIWORD(handle
) == thunk_selector
)
174 UINT index
= LOWORD(handle
) / sizeof(WINPROC_THUNK
);
175 /* check alignment */
176 if (index
* sizeof(WINPROC_THUNK
) != LOWORD(handle
)) return NULL
;
177 /* check array limits */
178 if (index
>= thunk_used
) return NULL
;
179 return thunk_array
[index
].proc
;
181 return handle_to_proc( (WNDPROC
)handle
);
184 /* allocate a 16-bit thunk for an existing window proc */
185 static WNDPROC16
alloc_win16_thunk( WINDOWPROC
*proc
)
187 static FARPROC16 relay
;
190 if (proc
->proc16
) return proc
->proc16
;
192 EnterCriticalSection( &winproc_cs
);
194 if (!thunk_array
) /* allocate the array and its selector */
198 if (!(thunk_selector
= wine_ldt_alloc_entries(1))) goto done
;
199 if (!(thunk_array
= VirtualAlloc( NULL
, MAX_THUNKS
* sizeof(WINPROC_THUNK
), MEM_COMMIT
,
200 PAGE_EXECUTE_READWRITE
))) goto done
;
201 wine_ldt_set_base( &entry
, thunk_array
);
202 wine_ldt_set_limit( &entry
, MAX_THUNKS
* sizeof(WINPROC_THUNK
) - 1 );
203 wine_ldt_set_flags( &entry
, WINE_LDT_FLAGS_CODE
| WINE_LDT_FLAGS_32BIT
);
204 wine_ldt_set_entry( thunk_selector
, &entry
);
205 relay
= GetProcAddress16( GetModuleHandle16("user"), "__wine_call_wndproc" );
208 /* check if it already exists */
209 for (i
= 0; i
< thunk_used
; i
++) if (thunk_array
[i
].proc
== proc
) break;
211 if (i
== thunk_used
) /* create a new one */
213 WINPROC_THUNK
*thunk
;
215 if (thunk_used
>= MAX_THUNKS
) goto done
;
216 thunk
= &thunk_array
[thunk_used
++];
217 thunk
->popl_eax
= 0x58; /* popl %eax */
218 thunk
->pushl_func
= 0x68; /* pushl $proc */
220 thunk
->pushl_eax
= 0x50; /* pushl %eax */
221 thunk
->ljmp
= 0xea; /* ljmp relay*/
222 thunk
->relay_offset
= OFFSETOF(relay
);
223 thunk
->relay_sel
= SELECTOROF(relay
);
225 proc
->proc16
= (WNDPROC16
)MAKESEGPTR( thunk_selector
, i
* sizeof(WINPROC_THUNK
) );
227 LeaveCriticalSection( &winproc_cs
);
233 static inline WINDOWPROC
*handle16_to_proc( WNDPROC16 handle
)
235 return handle_to_proc( (WNDPROC
)handle
);
238 static inline WNDPROC16
alloc_win16_thunk( WINDOWPROC
*proc
)
243 #endif /* __i386__ */
247 /* Some window procedures modify register they shouldn't, or are not
248 * properly declared stdcall; so we need a small assembly wrapper to
250 extern LRESULT
WINPROC_wrapper( WNDPROC proc
, HWND hwnd
, UINT msg
,
251 WPARAM wParam
, LPARAM lParam
);
252 __ASM_GLOBAL_FUNC( WINPROC_wrapper
,
263 "movl 8(%ebp),%eax\n\t"
265 "leal -12(%ebp),%esp\n\t"
272 static inline LRESULT
WINPROC_wrapper( WNDPROC proc
, HWND hwnd
, UINT msg
,
273 WPARAM wParam
, LPARAM lParam
)
275 return proc( hwnd
, msg
, wParam
, lParam
);
277 #endif /* __i386__ */
280 static void MINMAXINFO32to16( const MINMAXINFO
*from
, MINMAXINFO16
*to
)
282 to
->ptReserved
.x
= from
->ptReserved
.x
;
283 to
->ptReserved
.y
= from
->ptReserved
.y
;
284 to
->ptMaxSize
.x
= from
->ptMaxSize
.x
;
285 to
->ptMaxSize
.y
= from
->ptMaxSize
.y
;
286 to
->ptMaxPosition
.x
= from
->ptMaxPosition
.x
;
287 to
->ptMaxPosition
.y
= from
->ptMaxPosition
.y
;
288 to
->ptMinTrackSize
.x
= from
->ptMinTrackSize
.x
;
289 to
->ptMinTrackSize
.y
= from
->ptMinTrackSize
.y
;
290 to
->ptMaxTrackSize
.x
= from
->ptMaxTrackSize
.x
;
291 to
->ptMaxTrackSize
.y
= from
->ptMaxTrackSize
.y
;
294 static void MINMAXINFO16to32( const MINMAXINFO16
*from
, MINMAXINFO
*to
)
296 to
->ptReserved
.x
= from
->ptReserved
.x
;
297 to
->ptReserved
.y
= from
->ptReserved
.y
;
298 to
->ptMaxSize
.x
= from
->ptMaxSize
.x
;
299 to
->ptMaxSize
.y
= from
->ptMaxSize
.y
;
300 to
->ptMaxPosition
.x
= from
->ptMaxPosition
.x
;
301 to
->ptMaxPosition
.y
= from
->ptMaxPosition
.y
;
302 to
->ptMinTrackSize
.x
= from
->ptMinTrackSize
.x
;
303 to
->ptMinTrackSize
.y
= from
->ptMinTrackSize
.y
;
304 to
->ptMaxTrackSize
.x
= from
->ptMaxTrackSize
.x
;
305 to
->ptMaxTrackSize
.y
= from
->ptMaxTrackSize
.y
;
308 static void WINDOWPOS32to16( const WINDOWPOS
* from
, WINDOWPOS16
* to
)
310 to
->hwnd
= HWND_16(from
->hwnd
);
311 to
->hwndInsertAfter
= HWND_16(from
->hwndInsertAfter
);
316 to
->flags
= from
->flags
;
319 static void WINDOWPOS16to32( const WINDOWPOS16
* from
, WINDOWPOS
* to
)
321 to
->hwnd
= WIN_Handle32(from
->hwnd
);
322 to
->hwndInsertAfter
= (from
->hwndInsertAfter
== (HWND16
)-1) ?
323 HWND_TOPMOST
: WIN_Handle32(from
->hwndInsertAfter
);
328 to
->flags
= from
->flags
;
331 /* The strings are not copied */
332 static void CREATESTRUCT32Ato16( const CREATESTRUCTA
* from
, CREATESTRUCT16
* to
)
334 to
->lpCreateParams
= (SEGPTR
)from
->lpCreateParams
;
335 to
->hInstance
= HINSTANCE_16(from
->hInstance
);
336 to
->hMenu
= HMENU_16(from
->hMenu
);
337 to
->hwndParent
= HWND_16(from
->hwndParent
);
342 to
->style
= from
->style
;
343 to
->dwExStyle
= from
->dwExStyle
;
346 static void CREATESTRUCT16to32A( const CREATESTRUCT16
* from
, CREATESTRUCTA
*to
)
349 to
->lpCreateParams
= (LPVOID
)from
->lpCreateParams
;
350 to
->hInstance
= HINSTANCE_32(from
->hInstance
);
351 to
->hMenu
= HMENU_32(from
->hMenu
);
352 to
->hwndParent
= WIN_Handle32(from
->hwndParent
);
357 to
->style
= from
->style
;
358 to
->dwExStyle
= from
->dwExStyle
;
361 /* The strings are not copied */
362 static void MDICREATESTRUCT32Ato16( const MDICREATESTRUCTA
* from
, MDICREATESTRUCT16
* to
)
364 to
->hOwner
= HINSTANCE_16(from
->hOwner
);
369 to
->style
= from
->style
;
370 to
->lParam
= from
->lParam
;
373 static void MDICREATESTRUCT16to32A( const MDICREATESTRUCT16
* from
, MDICREATESTRUCTA
*to
)
375 to
->hOwner
= HINSTANCE_32(from
->hOwner
);
380 to
->style
= from
->style
;
381 to
->lParam
= from
->lParam
;
384 /**********************************************************************
385 * WINPROC_CallWndProc32
387 * Call a 32-bit WndProc.
389 static LRESULT
WINPROC_CallWndProc( WNDPROC proc
, HWND hwnd
, UINT msg
,
390 WPARAM wParam
, LPARAM lParam
)
396 hwnd
= WIN_GetFullHandle( hwnd
);
398 DPRINTF( "%04lx:Call window proc %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
399 GetCurrentThreadId(), proc
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
401 retvalue
= WINPROC_wrapper( proc
, hwnd
, msg
, wParam
, lParam
);
404 DPRINTF( "%04lx:Ret window proc %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx) retval=%08lx\n",
405 GetCurrentThreadId(), proc
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
, retvalue
);
409 /***********************************************************************
410 * WINPROC_CallWndProc16
412 * Call a 16-bit window procedure
414 static LRESULT WINAPI
WINPROC_CallWndProc16( WNDPROC16 proc
, HWND16 hwnd
,
415 UINT16 msg
, WPARAM16 wParam
,
426 DRAWITEMSTRUCT16 dis16
;
427 COMPAREITEMSTRUCT16 cis16
;
433 /* Window procedures want ax = hInstance, ds = es = ss */
435 memset(&context
, 0, sizeof(context
));
436 context
.SegDs
= context
.SegEs
= SELECTOROF(NtCurrentTeb()->WOW32Reserved
);
437 context
.SegFs
= wine_get_fs();
438 context
.SegGs
= wine_get_gs();
439 if (!(context
.Eax
= GetWindowWord( HWND_32(hwnd
), GWLP_HINSTANCE
))) context
.Eax
= context
.SegDs
;
440 context
.SegCs
= SELECTOROF(proc
);
441 context
.Eip
= OFFSETOF(proc
);
442 context
.Ebp
= OFFSETOF(NtCurrentTeb()->WOW32Reserved
) + (WORD
)&((STACK16FRAME
*)0)->bp
;
446 /* Some programs (eg. the "Undocumented Windows" examples, JWP) only
447 work if structures passed in lParam are placed in the stack/data
448 segment. Programmers easily make the mistake of converting lParam
449 to a near rather than a far pointer, since Windows apparently
450 allows this. We copy the structures to the 16 bit stack; this is
451 ugly but makes these programs work. */
456 size
= sizeof(CREATESTRUCT16
); break;
458 size
= sizeof(DRAWITEMSTRUCT16
); break;
460 size
= sizeof(COMPAREITEMSTRUCT16
); break;
464 memcpy( &args
.u
, MapSL(lParam
), size
);
465 lParam
= (SEGPTR
)NtCurrentTeb()->WOW32Reserved
- size
;
469 args
.params
[4] = hwnd
;
470 args
.params
[3] = msg
;
471 args
.params
[2] = wParam
;
472 args
.params
[1] = HIWORD(lParam
);
473 args
.params
[0] = LOWORD(lParam
);
474 WOWCallback16Ex( 0, WCB16_REGS
, sizeof(args
.params
) + size
, &args
, (DWORD
*)&context
);
475 return MAKELONG( LOWORD(context
.Eax
), LOWORD(context
.Edx
) );
479 /**********************************************************************
482 * Get a window procedure pointer that can be passed to the Windows program.
484 WNDPROC16
WINPROC_GetProc16( WNDPROC proc
, BOOL unicode
)
488 if (unicode
) ptr
= alloc_winproc( NULL
, proc
);
489 else ptr
= alloc_winproc( proc
, NULL
);
492 return alloc_win16_thunk( ptr
);
496 /**********************************************************************
499 * Get a window procedure pointer that can be passed to the Windows program.
501 WNDPROC
WINPROC_GetProc( WNDPROC proc
, BOOL unicode
)
503 WINDOWPROC
*ptr
= handle_to_proc( proc
);
505 if (!ptr
) return proc
;
508 if (ptr
->procW
) return ptr
->procW
;
513 if (ptr
->procA
) return ptr
->procA
;
519 /**********************************************************************
520 * WINPROC_AllocProc16
522 * Allocate a window procedure for a window or class.
524 * Note that allocated winprocs are never freed; the idea is that even if an app creates a
525 * lot of windows, it will usually only have a limited number of window procedures, so the
526 * array won't grow too large, and this way we avoid the need to track allocations per window.
528 WNDPROC
WINPROC_AllocProc16( WNDPROC16 func
)
532 if (!func
) return NULL
;
534 /* check if the function is already a win proc */
535 if (!(proc
= handle16_to_proc( func
)))
537 EnterCriticalSection( &winproc_cs
);
539 /* then check if we already have a winproc for that function */
540 if (!(proc
= find_winproc16( func
)))
542 if (winproc_used
< MAX_WINPROCS
)
544 proc
= &winproc_array
[winproc_used
++];
546 TRACE( "allocated %p for %p/16-bit (%d/%d used)\n",
547 proc_to_handle(proc
), func
, winproc_used
, MAX_WINPROCS
);
549 else FIXME( "too many winprocs, cannot allocate one for 16-bit %p\n", func
);
551 else TRACE( "reusing %p for %p/16-bit\n", proc_to_handle(proc
), func
);
553 LeaveCriticalSection( &winproc_cs
);
555 return proc_to_handle( proc
);
559 /**********************************************************************
562 * Allocate a window procedure for a window or class.
564 * Note that allocated winprocs are never freed; the idea is that even if an app creates a
565 * lot of windows, it will usually only have a limited number of window procedures, so the
566 * array won't grow too large, and this way we avoid the need to track allocations per window.
568 WNDPROC
WINPROC_AllocProc( WNDPROC funcA
, WNDPROC funcW
)
572 if (!(proc
= alloc_winproc( funcA
, funcW
))) return NULL
;
573 return proc_to_handle( proc
);
577 /**********************************************************************
580 * Return the window procedure type, or the default value if not a winproc handle.
582 BOOL
WINPROC_IsUnicode( WNDPROC proc
, BOOL def_val
)
584 WINDOWPROC
*ptr
= handle_to_proc( proc
);
586 if (!ptr
) return def_val
;
587 if (ptr
->procA
&& ptr
->procW
) return def_val
; /* can be both */
588 return (ptr
->procW
!= NULL
);
592 /**********************************************************************
593 * WINPROC_TestLBForStr
595 * Return TRUE if the lparam is a string
597 inline static BOOL
WINPROC_TestLBForStr( HWND hwnd
, UINT msg
)
599 DWORD style
= GetWindowLongA( hwnd
, GWL_STYLE
);
600 if (msg
<= CB_MSGMAX
)
601 return (!(style
& (CBS_OWNERDRAWFIXED
| CBS_OWNERDRAWVARIABLE
)) || (style
& CBS_HASSTRINGS
));
603 return (!(style
& (LBS_OWNERDRAWFIXED
| LBS_OWNERDRAWVARIABLE
)) || (style
& LBS_HASSTRINGS
));
606 /**********************************************************************
607 * WINPROC_MapMsg32ATo32W
609 * Map a message from Ansi to Unicode.
610 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
613 * WM_GETTEXT/WM_SETTEXT and static control with SS_ICON style:
614 * the first four bytes are the handle of the icon
615 * when the WM_SETTEXT message has been used to set the icon
617 INT
WINPROC_MapMsg32ATo32W( HWND hwnd
, UINT msg
, WPARAM
*pwparam
, LPARAM
*plparam
)
622 case WM_ASKCBFORMATNAME
:
624 LPARAM
*ptr
= HeapAlloc( GetProcessHeap(), 0,
625 *pwparam
* sizeof(WCHAR
) + sizeof(LPARAM
) );
627 *ptr
++ = *plparam
; /* Store previous lParam */
628 *plparam
= (LPARAM
)ptr
;
631 /* lparam is string (0-terminated) */
633 case WM_WININICHANGE
:
634 case WM_DEVMODECHANGE
:
639 if (!*plparam
) return 0;
642 DWORD len
= MultiByteToWideChar(CP_ACP
, 0, (LPCSTR
)*plparam
, -1, NULL
, 0);
643 WCHAR
*buf
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
644 MultiByteToWideChar(CP_ACP
, 0, (LPCSTR
)*plparam
, -1, buf
, len
);
645 *plparam
= (LPARAM
)buf
;
646 return (*plparam
? 1 : -1);
648 case WM_GETTEXTLENGTH
:
649 case CB_GETLBTEXTLEN
:
651 return 1; /* need to map result */
655 UNICODE_STRING usBuffer
;
657 { CREATESTRUCTW cs
; /* new structure */
658 LPCWSTR lpszName
; /* allocated Name */
659 LPCWSTR lpszClass
; /* allocated Class */
662 struct s
*xs
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(struct s
));
664 xs
->cs
= *(CREATESTRUCTW
*)*plparam
;
665 if (HIWORD(xs
->cs
.lpszName
))
667 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,(LPCSTR
)xs
->cs
.lpszName
);
668 xs
->lpszName
= xs
->cs
.lpszName
= usBuffer
.Buffer
;
670 if (HIWORD(xs
->cs
.lpszClass
))
672 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,(LPCSTR
)xs
->cs
.lpszClass
);
673 xs
->lpszClass
= xs
->cs
.lpszClass
= usBuffer
.Buffer
;
676 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
678 MDICREATESTRUCTW
*mdi_cs
= HeapAlloc(GetProcessHeap(), 0, sizeof(*mdi_cs
));
679 *mdi_cs
= *(MDICREATESTRUCTW
*)xs
->cs
.lpCreateParams
;
680 if (HIWORD(mdi_cs
->szTitle
))
682 RtlCreateUnicodeStringFromAsciiz(&usBuffer
, (LPCSTR
)mdi_cs
->szTitle
);
683 mdi_cs
->szTitle
= usBuffer
.Buffer
;
685 if (HIWORD(mdi_cs
->szClass
))
687 RtlCreateUnicodeStringFromAsciiz(&usBuffer
, (LPCSTR
)mdi_cs
->szClass
);
688 mdi_cs
->szClass
= usBuffer
.Buffer
;
690 xs
->cs
.lpCreateParams
= mdi_cs
;
693 *plparam
= (LPARAM
)xs
;
698 MDICREATESTRUCTW
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) );
700 *cs
= *(MDICREATESTRUCTW
*)*plparam
;
701 if (HIWORD(cs
->szClass
))
703 UNICODE_STRING usBuffer
;
704 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,(LPCSTR
)cs
->szClass
);
705 cs
->szClass
= usBuffer
.Buffer
;
707 if (HIWORD(cs
->szTitle
))
709 UNICODE_STRING usBuffer
;
710 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,(LPCSTR
)cs
->szTitle
);
711 cs
->szTitle
= usBuffer
.Buffer
;
713 *plparam
= (LPARAM
)cs
;
717 /* Listbox / Combobox */
719 case LB_INSERTSTRING
:
721 case LB_FINDSTRINGEXACT
:
722 case LB_SELECTSTRING
:
724 case CB_INSERTSTRING
:
725 case CB_FINDSTRINGEXACT
:
727 case CB_SELECTSTRING
:
728 if(!*plparam
) return 0;
729 if ( WINPROC_TestLBForStr( hwnd
, msg
))
731 UNICODE_STRING usBuffer
;
732 RtlCreateUnicodeStringFromAsciiz(&usBuffer
,(LPCSTR
)*plparam
);
733 *plparam
= (LPARAM
)usBuffer
.Buffer
;
735 return (*plparam
? 1 : -1);
737 case LB_GETTEXT
: /* FIXME: fixed sized buffer */
739 if ( WINPROC_TestLBForStr( hwnd
, msg
))
741 LPARAM
*ptr
= HeapAlloc( GetProcessHeap(), 0, 512 * sizeof(WCHAR
) + sizeof(LPARAM
) );
743 *ptr
++ = *plparam
; /* Store previous lParam */
744 *plparam
= (LPARAM
)ptr
;
750 { WORD len
= (WORD
)*plparam
;
751 LPARAM
*ptr
= HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM
) + sizeof (WORD
) + len
*sizeof(WCHAR
) );
753 *ptr
++ = *plparam
; /* Store previous lParam */
754 *((WORD
*) ptr
) = len
; /* Store the length */
755 *plparam
= (LPARAM
)ptr
;
765 case EM_SETPASSWORDCHAR
:
767 CHAR ch
= LOWORD(*pwparam
);
769 MultiByteToWideChar(CP_ACP
, 0, &ch
, 1, &wch
, 1);
770 *pwparam
= MAKEWPARAM( wch
, HIWORD(*pwparam
) );
778 ch
[0] = (*pwparam
>> 8);
779 ch
[1] = *pwparam
& 0xff;
781 MultiByteToWideChar(CP_ACP
, 0, ch
, 2, &wch
, 1);
783 MultiByteToWideChar(CP_ACP
, 0, &ch
[1], 1, &wch
, 1);
784 *pwparam
= MAKEWPARAM( wch
, HIWORD(*pwparam
) );
788 case WM_PAINTCLIPBOARD
:
789 case WM_SIZECLIPBOARD
:
790 FIXME_(msg
)("message %s (0x%x) needs translation, please report\n", SPY_GetMsgName(msg
, hwnd
), msg
);
792 default: /* No translation needed */
798 /**********************************************************************
799 * WINPROC_UnmapMsg32ATo32W
801 * Unmap a message that was mapped from Ansi to Unicode.
803 LRESULT
WINPROC_UnmapMsg32ATo32W( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
804 LRESULT result
, WNDPROC dispatch
)
809 case WM_ASKCBFORMATNAME
:
811 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
812 if (!wParam
) result
= 0;
813 else if (!(result
= WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1,
814 (LPSTR
)*ptr
, wParam
, NULL
, NULL
)))
816 ((LPSTR
)*ptr
)[wParam
-1] = 0;
819 else result
--; /* do not count terminating null */
820 HeapFree( GetProcessHeap(), 0, ptr
);
823 case WM_GETTEXTLENGTH
:
824 case CB_GETLBTEXTLEN
:
828 /* Determine respective GETTEXT message */
830 (msg
== WM_GETTEXTLENGTH
) ? WM_GETTEXT
:
831 ((msg
== CB_GETLBTEXTLEN
) ? CB_GETLBTEXT
: LB_GETTEXT
);
832 /* wParam differs between the messages */
833 WPARAM wp
= (msg
== WM_GETTEXTLENGTH
) ? (WPARAM
)(result
+ 1) : wParam
;
835 WCHAR
* p
= HeapAlloc (GetProcessHeap(), 0, (result
+ 1) * sizeof(WCHAR
));
842 n
= WINPROC_CallWndProc(dispatch
, hwnd
, msgGetText
, wp
, (LPARAM
)p
);
844 n
= SendMessageW (hwnd
, msgGetText
, wp
, (LPARAM
)p
);
846 result
= WideCharToMultiByte( CP_ACP
, 0, p
, n
, NULL
, 0, 0, NULL
);
847 HeapFree (GetProcessHeap(), 0, p
);
855 { CREATESTRUCTW cs
; /* new structure */
856 LPWSTR lpszName
; /* allocated Name */
857 LPWSTR lpszClass
; /* allocated Class */
859 struct s
*xs
= (struct s
*)lParam
;
860 HeapFree( GetProcessHeap(), 0, xs
->lpszName
);
861 HeapFree( GetProcessHeap(), 0, xs
->lpszClass
);
863 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
865 MDICREATESTRUCTW
*mdi_cs
= (MDICREATESTRUCTW
*)xs
->cs
.lpCreateParams
;
866 if (HIWORD(mdi_cs
->szTitle
))
867 HeapFree(GetProcessHeap(), 0, (LPVOID
)mdi_cs
->szTitle
);
868 if (HIWORD(mdi_cs
->szClass
))
869 HeapFree(GetProcessHeap(), 0, (LPVOID
)mdi_cs
->szClass
);
870 HeapFree(GetProcessHeap(), 0, mdi_cs
);
872 HeapFree( GetProcessHeap(), 0, xs
);
878 MDICREATESTRUCTW
*cs
= (MDICREATESTRUCTW
*)lParam
;
879 if (HIWORD(cs
->szTitle
))
880 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szTitle
);
881 if (HIWORD(cs
->szClass
))
882 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szClass
);
883 HeapFree( GetProcessHeap(), 0, cs
);
888 case WM_WININICHANGE
:
889 case WM_DEVMODECHANGE
:
894 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
897 /* Listbox / Combobox */
899 case LB_INSERTSTRING
:
901 case LB_FINDSTRINGEXACT
:
902 case LB_SELECTSTRING
:
904 case CB_INSERTSTRING
:
906 case CB_FINDSTRINGEXACT
:
907 case CB_SELECTSTRING
:
908 if ( WINPROC_TestLBForStr( hwnd
, msg
))
909 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
914 if ( WINPROC_TestLBForStr( hwnd
, msg
))
916 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
918 result
= WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1,
919 (LPSTR
)*ptr
, 0x7fffffff, NULL
, NULL
) - 1;
920 HeapFree( GetProcessHeap(), 0, ptr
);
927 LPARAM
* ptr
= (LPARAM
*)lParam
- 1; /* get the old lParam */
928 WORD len
= *(WORD
*) lParam
;
929 result
= WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, result
,
930 (LPSTR
)*ptr
, len
, NULL
, NULL
);
931 if (result
< len
) ((LPSTR
)*ptr
)[result
] = 0;
932 HeapFree( GetProcessHeap(), 0, ptr
);
940 static UINT
convert_handle_16_to_32(HANDLE16 src
, unsigned int flags
)
943 UINT sz
= GlobalSize16(src
);
946 if (!(dst
= GlobalAlloc(flags
, sz
)))
948 ptr16
= GlobalLock16(src
);
949 ptr32
= GlobalLock(dst
);
950 if (ptr16
!= NULL
&& ptr32
!= NULL
) memcpy(ptr32
, ptr16
, sz
);
957 /**********************************************************************
958 * WINPROC_MapMsg16To32A
960 * Map a message from 16- to 32-bit Ansi.
961 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
963 INT
WINPROC_MapMsg16To32A( HWND hwnd
, UINT16 msg16
, WPARAM16 wParam16
, UINT
*pmsg32
,
964 WPARAM
*pwparam32
, LPARAM
*plparam
)
966 *pmsg32
= (UINT
)msg16
;
967 *pwparam32
= (WPARAM
)wParam16
;
974 *pwparam32
= MAKEWPARAM( wParam16
, HIWORD(*plparam
) );
975 *plparam
= (LPARAM
)WIN_Handle32( LOWORD(*plparam
) );
979 *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
980 *plparam
= (LPARAM
)WIN_Handle32( HIWORD(*plparam
) );
983 if ( HIWORD(*plparam
) > CTLCOLOR_STATIC
) return -1;
984 *pmsg32
= WM_CTLCOLORMSGBOX
+ HIWORD(*plparam
);
985 *pwparam32
= (WPARAM
)HDC_32(wParam16
);
986 *plparam
= (LPARAM
)WIN_Handle32( LOWORD(*plparam
) );
990 COMPAREITEMSTRUCT16
* cis16
= MapSL(*plparam
);
991 COMPAREITEMSTRUCT
*cis
= HeapAlloc(GetProcessHeap(), 0, sizeof(*cis
));
993 cis
->CtlType
= cis16
->CtlType
;
994 cis
->CtlID
= cis16
->CtlID
;
995 cis
->hwndItem
= WIN_Handle32( cis16
->hwndItem
);
996 cis
->itemID1
= cis16
->itemID1
;
997 cis
->itemData1
= cis16
->itemData1
;
998 cis
->itemID2
= cis16
->itemID2
;
999 cis
->itemData2
= cis16
->itemData2
;
1000 cis
->dwLocaleId
= 0; /* FIXME */
1001 *plparam
= (LPARAM
)cis
;
1006 PCOPYDATASTRUCT16 pcds16
= MapSL(*plparam
);
1007 PCOPYDATASTRUCT pcds
= HeapAlloc ( GetProcessHeap(), 0, sizeof(*pcds
));
1008 pcds
->dwData
= pcds16
->dwData
;
1009 pcds
->cbData
= pcds16
->cbData
;
1010 pcds
->lpData
= MapSL( pcds16
->lpData
);
1011 *plparam
= (LPARAM
)pcds
;
1016 DELETEITEMSTRUCT16
* dis16
= MapSL(*plparam
);
1017 DELETEITEMSTRUCT
*dis
= HeapAlloc(GetProcessHeap(), 0, sizeof(*dis
));
1018 if (!dis
) return -1;
1019 dis
->CtlType
= dis16
->CtlType
;
1020 dis
->CtlID
= dis16
->CtlID
;
1021 dis
->hwndItem
= WIN_Handle32( dis16
->hwndItem
);
1022 dis
->itemData
= dis16
->itemData
;
1023 *plparam
= (LPARAM
)dis
;
1026 case WM_MEASUREITEM
:
1028 MEASUREITEMSTRUCT16
* mis16
= MapSL(*plparam
);
1029 MEASUREITEMSTRUCT
*mis
= HeapAlloc(GetProcessHeap(), 0,
1030 sizeof(*mis
) + sizeof(LPARAM
));
1031 if (!mis
) return -1;
1032 mis
->CtlType
= mis16
->CtlType
;
1033 mis
->CtlID
= mis16
->CtlID
;
1034 mis
->itemID
= mis16
->itemID
;
1035 mis
->itemWidth
= mis16
->itemWidth
;
1036 mis
->itemHeight
= mis16
->itemHeight
;
1037 mis
->itemData
= mis16
->itemData
;
1038 *(LPARAM
*)(mis
+ 1) = *plparam
; /* Store the previous lParam */
1039 *plparam
= (LPARAM
)mis
;
1044 DRAWITEMSTRUCT16
* dis16
= MapSL(*plparam
);
1045 DRAWITEMSTRUCT
*dis
= HeapAlloc(GetProcessHeap(), 0, sizeof(*dis
));
1046 if (!dis
) return -1;
1047 dis
->CtlType
= dis16
->CtlType
;
1048 dis
->CtlID
= dis16
->CtlID
;
1049 dis
->itemID
= dis16
->itemID
;
1050 dis
->itemAction
= dis16
->itemAction
;
1051 dis
->itemState
= dis16
->itemState
;
1052 dis
->hwndItem
= (dis
->CtlType
== ODT_MENU
) ? (HWND
)HMENU_32(dis16
->hwndItem
)
1053 : WIN_Handle32( dis16
->hwndItem
);
1054 dis
->hDC
= HDC_32(dis16
->hDC
);
1055 dis
->itemData
= dis16
->itemData
;
1056 dis
->rcItem
.left
= dis16
->rcItem
.left
;
1057 dis
->rcItem
.top
= dis16
->rcItem
.top
;
1058 dis
->rcItem
.right
= dis16
->rcItem
.right
;
1059 dis
->rcItem
.bottom
= dis16
->rcItem
.bottom
;
1060 *plparam
= (LPARAM
)dis
;
1063 case WM_GETMINMAXINFO
:
1065 MINMAXINFO
*mmi
= HeapAlloc( GetProcessHeap(), 0, sizeof(*mmi
) + sizeof(LPARAM
));
1066 if (!mmi
) return -1;
1067 MINMAXINFO16to32( MapSL(*plparam
), mmi
);
1068 *(LPARAM
*)(mmi
+ 1) = *plparam
; /* Store the previous lParam */
1069 *plparam
= (LPARAM
)mmi
;
1074 case WM_WININICHANGE
:
1075 case WM_DEVMODECHANGE
:
1076 case WM_ASKCBFORMATNAME
:
1077 *plparam
= (LPARAM
)MapSL(*plparam
);
1081 MDICREATESTRUCT16
*cs16
= MapSL(*plparam
);
1082 MDICREATESTRUCTA
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) + sizeof(LPARAM
) );
1084 MDICREATESTRUCT16to32A( cs16
, cs
);
1085 cs
->szTitle
= MapSL(cs16
->szTitle
);
1086 cs
->szClass
= MapSL(cs16
->szClass
);
1087 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1088 *plparam
= (LPARAM
)cs
;
1091 case WM_MDIGETACTIVE
:
1092 *plparam
= (LPARAM
)HeapAlloc( GetProcessHeap(), 0, sizeof(BOOL
) );
1093 *(BOOL
*)(*plparam
) = 0;
1096 if(wParam16
) *pmsg32
=WM_MDIREFRESHMENU
;
1097 *pwparam32
= (WPARAM
)HMENU_32(LOWORD(*plparam
));
1098 *plparam
= (LPARAM
)HMENU_32(HIWORD(*plparam
));
1101 *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
1102 *plparam
= (LPARAM
)HMENU_32(HIWORD(*plparam
));
1105 if((LOWORD(*plparam
) & MF_POPUP
) && (LOWORD(*plparam
) != 0xFFFF))
1107 HMENU hmenu
=HMENU_32(HIWORD(*plparam
));
1108 UINT Pos
=MENU_FindSubMenu( &hmenu
, HMENU_32(wParam16
));
1109 if(Pos
==0xFFFF) Pos
=0; /* NO_SELECTED_ITEM */
1110 *pwparam32
= MAKEWPARAM( Pos
, LOWORD(*plparam
) );
1112 else *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
1113 *plparam
= (LPARAM
)HMENU_32(HIWORD(*plparam
));
1115 case WM_MDIACTIVATE
:
1118 *pwparam32
= (WPARAM
)WIN_Handle32( HIWORD(*plparam
) );
1119 *plparam
= (LPARAM
)WIN_Handle32( LOWORD(*plparam
) );
1121 else /* message sent to MDI client */
1122 *pwparam32
= wParam16
;
1126 NCCALCSIZE_PARAMS16
*nc16
;
1127 NCCALCSIZE_PARAMS
*nc
;
1129 nc
= HeapAlloc( GetProcessHeap(), 0, sizeof(*nc
) + sizeof(LPARAM
) );
1131 nc16
= MapSL(*plparam
);
1132 nc
->rgrc
[0].left
= nc16
->rgrc
[0].left
;
1133 nc
->rgrc
[0].top
= nc16
->rgrc
[0].top
;
1134 nc
->rgrc
[0].right
= nc16
->rgrc
[0].right
;
1135 nc
->rgrc
[0].bottom
= nc16
->rgrc
[0].bottom
;
1138 nc
->lppos
= HeapAlloc( GetProcessHeap(), 0, sizeof(*nc
->lppos
) );
1139 nc
->rgrc
[1].left
= nc16
->rgrc
[1].left
;
1140 nc
->rgrc
[1].top
= nc16
->rgrc
[1].top
;
1141 nc
->rgrc
[1].right
= nc16
->rgrc
[1].right
;
1142 nc
->rgrc
[1].bottom
= nc16
->rgrc
[1].bottom
;
1143 nc
->rgrc
[2].left
= nc16
->rgrc
[2].left
;
1144 nc
->rgrc
[2].top
= nc16
->rgrc
[2].top
;
1145 nc
->rgrc
[2].right
= nc16
->rgrc
[2].right
;
1146 nc
->rgrc
[2].bottom
= nc16
->rgrc
[2].bottom
;
1147 if (nc
->lppos
) WINDOWPOS16to32( MapSL(nc16
->lppos
), nc
->lppos
);
1149 *(LPARAM
*)(nc
+ 1) = *plparam
; /* Store the previous lParam */
1150 *plparam
= (LPARAM
)nc
;
1156 CREATESTRUCT16
*cs16
= MapSL(*plparam
);
1157 CREATESTRUCTA
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) + sizeof(LPARAM
) );
1159 CREATESTRUCT16to32A( cs16
, cs
);
1160 cs
->lpszName
= MapSL(cs16
->lpszName
);
1161 cs
->lpszClass
= MapSL(cs16
->lpszClass
);
1163 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1165 MDICREATESTRUCT16
*mdi_cs16
;
1166 MDICREATESTRUCTA
*mdi_cs
= HeapAlloc(GetProcessHeap(), 0, sizeof(*mdi_cs
));
1169 HeapFree(GetProcessHeap(), 0, cs
);
1172 mdi_cs16
= (MDICREATESTRUCT16
*)MapSL(cs16
->lpCreateParams
);
1173 MDICREATESTRUCT16to32A(mdi_cs16
, mdi_cs
);
1174 mdi_cs
->szTitle
= MapSL(mdi_cs16
->szTitle
);
1175 mdi_cs
->szClass
= MapSL(mdi_cs16
->szClass
);
1177 cs
->lpCreateParams
= mdi_cs
;
1179 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1180 *plparam
= (LPARAM
)cs
;
1183 case WM_PARENTNOTIFY
:
1184 if ((wParam16
== WM_CREATE
) || (wParam16
== WM_DESTROY
))
1186 *pwparam32
= MAKEWPARAM( wParam16
, HIWORD(*plparam
) );
1187 *plparam
= (LPARAM
)WIN_Handle32( LOWORD(*plparam
) );
1190 case WM_WINDOWPOSCHANGING
:
1191 case WM_WINDOWPOSCHANGED
:
1193 WINDOWPOS
*wp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*wp
) + sizeof(LPARAM
) );
1195 WINDOWPOS16to32( MapSL(*plparam
), wp
);
1196 *(LPARAM
*)(wp
+ 1) = *plparam
; /* Store the previous lParam */
1197 *plparam
= (LPARAM
)wp
;
1203 LPMSG16 msg16
= MapSL(*plparam
);
1204 LPMSG msg32
= HeapAlloc( GetProcessHeap(), 0, sizeof(MSG
) );
1206 if (!msg32
) return -1;
1207 msg32
->hwnd
= WIN_Handle32( msg16
->hwnd
);
1208 msg32
->message
= msg16
->message
;
1209 msg32
->wParam
= msg16
->wParam
;
1210 msg32
->lParam
= msg16
->lParam
;
1211 msg32
->time
= msg16
->time
;
1212 msg32
->pt
.x
= msg16
->pt
.x
;
1213 msg32
->pt
.y
= msg16
->pt
.y
;
1214 *plparam
= (LPARAM
)msg32
;
1219 *plparam
= (LPARAM
)MapSL(*plparam
);
1221 case WM_ACTIVATEAPP
:
1222 /* We need this when SetActiveWindow sends a Sendmessage16() to
1223 * a 32bit window. Might be superflous with 32bit interprocess
1224 * message queues. */
1225 if (*plparam
) *plparam
= HTASK_32( *plparam
);
1229 MDINEXTMENU
*next
= HeapAlloc( GetProcessHeap(), 0, sizeof(*next
) );
1230 if (!next
) return -1;
1231 next
->hmenuIn
= (HMENU
)*plparam
;
1232 next
->hmenuNext
= 0;
1234 *plparam
= (LPARAM
)next
;
1237 case WM_PAINTCLIPBOARD
:
1238 case WM_SIZECLIPBOARD
:
1239 FIXME_(msg
)("message %04x needs translation\n",msg16
);
1241 case WM_DDE_INITIATE
:
1242 case WM_DDE_TERMINATE
:
1243 case WM_DDE_UNADVISE
:
1244 case WM_DDE_REQUEST
:
1245 *pwparam32
= (WPARAM
)WIN_Handle32(wParam16
);
1255 *pwparam32
= (WPARAM
)WIN_Handle32(wParam16
);
1256 lo16
= LOWORD(*plparam
);
1257 hi
= HIWORD(*plparam
);
1258 if (lo16
&& !(lo32
= convert_handle_16_to_32(lo16
, GMEM_DDESHARE
)))
1260 *plparam
= PackDDElParam(msg16
, lo32
, hi
);
1262 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
1269 *pwparam32
= (WPARAM
)WIN_Handle32(wParam16
);
1271 lo
= LOWORD(*plparam
);
1272 hi
= HIWORD(*plparam
);
1274 if (GlobalGetAtomNameA(hi
, buf
, 2) > 0) flag
|= 1;
1275 if (GlobalSize16(hi
) != 0) flag
|= 2;
1281 MESSAGE("DDE_ACK: neither atom nor handle!!!\n");
1286 break; /* atom, nothing to do */
1288 MESSAGE("DDE_ACK: %x both atom and handle... choosing handle\n", hi
);
1291 hi
= convert_handle_16_to_32(hi
, GMEM_DDESHARE
);
1294 *plparam
= PackDDElParam(WM_DDE_ACK
, lo
, hi
);
1296 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
1297 case WM_DDE_EXECUTE
:
1298 *plparam
= convert_handle_16_to_32(*plparam
, GMEM_DDESHARE
);
1299 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
1300 default: /* No translation needed */
1306 /**********************************************************************
1307 * WINPROC_UnmapMsg16To32A
1309 * Unmap a message that was mapped from 16- to 32-bit Ansi.
1311 LRESULT
WINPROC_UnmapMsg16To32A( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
1316 case WM_COMPAREITEM
:
1320 HeapFree( GetProcessHeap(), 0, (LPVOID
)lParam
);
1322 case WM_MEASUREITEM
:
1324 MEASUREITEMSTRUCT16
*mis16
;
1325 MEASUREITEMSTRUCT
*mis
= (MEASUREITEMSTRUCT
*)lParam
;
1326 lParam
= *(LPARAM
*)(mis
+ 1);
1327 mis16
= MapSL(lParam
);
1328 mis16
->itemWidth
= (UINT16
)mis
->itemWidth
;
1329 mis16
->itemHeight
= (UINT16
)mis
->itemHeight
;
1330 HeapFree( GetProcessHeap(), 0, mis
);
1333 case WM_GETMINMAXINFO
:
1335 MINMAXINFO
*mmi
= (MINMAXINFO
*)lParam
;
1336 lParam
= *(LPARAM
*)(mmi
+ 1);
1337 MINMAXINFO32to16( mmi
, MapSL(lParam
));
1338 HeapFree( GetProcessHeap(), 0, mmi
);
1343 MDICREATESTRUCTA
*cs
= (MDICREATESTRUCTA
*)lParam
;
1344 lParam
= *(LPARAM
*)(cs
+ 1);
1345 MDICREATESTRUCT32Ato16( cs
, MapSL(lParam
) );
1346 HeapFree( GetProcessHeap(), 0, cs
);
1349 case WM_MDIGETACTIVE
:
1350 result
= MAKELONG( LOWORD(result
), (BOOL16
)(*(BOOL
*)lParam
) );
1351 HeapFree( GetProcessHeap(), 0, (BOOL
*)lParam
);
1355 NCCALCSIZE_PARAMS16
*nc16
;
1356 NCCALCSIZE_PARAMS
*nc
= (NCCALCSIZE_PARAMS
*)lParam
;
1357 lParam
= *(LPARAM
*)(nc
+ 1);
1358 nc16
= MapSL(lParam
);
1359 nc16
->rgrc
[0].left
= nc
->rgrc
[0].left
;
1360 nc16
->rgrc
[0].top
= nc
->rgrc
[0].top
;
1361 nc16
->rgrc
[0].right
= nc
->rgrc
[0].right
;
1362 nc16
->rgrc
[0].bottom
= nc
->rgrc
[0].bottom
;
1365 nc16
->rgrc
[1].left
= nc
->rgrc
[1].left
;
1366 nc16
->rgrc
[1].top
= nc
->rgrc
[1].top
;
1367 nc16
->rgrc
[1].right
= nc
->rgrc
[1].right
;
1368 nc16
->rgrc
[1].bottom
= nc
->rgrc
[1].bottom
;
1369 nc16
->rgrc
[2].left
= nc
->rgrc
[2].left
;
1370 nc16
->rgrc
[2].top
= nc
->rgrc
[2].top
;
1371 nc16
->rgrc
[2].right
= nc
->rgrc
[2].right
;
1372 nc16
->rgrc
[2].bottom
= nc
->rgrc
[2].bottom
;
1375 WINDOWPOS32to16( nc
->lppos
, MapSL(nc16
->lppos
));
1376 HeapFree( GetProcessHeap(), 0, nc
->lppos
);
1379 HeapFree( GetProcessHeap(), 0, nc
);
1385 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)lParam
;
1386 lParam
= *(LPARAM
*)(cs
+ 1);
1387 CREATESTRUCT32Ato16( cs
, MapSL(lParam
) );
1389 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1390 HeapFree(GetProcessHeap(), 0, cs
->lpCreateParams
);
1392 HeapFree( GetProcessHeap(), 0, cs
);
1395 case WM_WINDOWPOSCHANGING
:
1396 case WM_WINDOWPOSCHANGED
:
1398 WINDOWPOS
*wp
= (WINDOWPOS
*)lParam
;
1399 lParam
= *(LPARAM
*)(wp
+ 1);
1400 WINDOWPOS32to16(wp
, MapSL(lParam
));
1401 HeapFree( GetProcessHeap(), 0, wp
);
1407 LPMSG msg32
= (LPMSG
)lParam
;
1408 HeapFree( GetProcessHeap(), 0, msg32
);
1413 MDINEXTMENU
*next
= (MDINEXTMENU
*)lParam
;
1414 result
= MAKELONG( HMENU_16(next
->hmenuNext
), HWND_16(next
->hwndNext
) );
1415 HeapFree( GetProcessHeap(), 0, next
);
1423 /**********************************************************************
1424 * WINPROC_MapMsg16To32W
1426 * Map a message from 16- to 32-bit Unicode.
1427 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
1429 INT
WINPROC_MapMsg16To32W( HWND hwnd
, UINT16 msg16
, WPARAM16 wParam16
, UINT
*pmsg32
,
1430 WPARAM
*pwparam32
, LPARAM
*plparam
)
1435 *pmsg32
=(UINT
)msg16
;
1436 *pwparam32
= (WPARAM
)wParam16
;
1441 case WM_WININICHANGE
:
1442 case WM_DEVMODECHANGE
:
1443 case WM_ASKCBFORMATNAME
:
1444 *plparam
= (LPARAM
)MapSL(*plparam
);
1445 return WINPROC_MapMsg32ATo32W( hwnd
, *pmsg32
, pwparam32
, plparam
);
1446 case WM_GETTEXTLENGTH
:
1447 case CB_GETLBTEXTLEN
:
1449 return 1; /* need to map result */
1453 CREATESTRUCT16
*cs16
= MapSL(*plparam
);
1454 CREATESTRUCTW
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) + sizeof(LPARAM
) );
1456 CREATESTRUCT16to32A( cs16
, (CREATESTRUCTA
*)cs
);
1457 cs
->lpszName
= map_str_16_to_32W(cs16
->lpszName
);
1458 cs
->lpszClass
= map_str_16_to_32W(cs16
->lpszClass
);
1460 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1462 MDICREATESTRUCT16
*mdi_cs16
;
1463 MDICREATESTRUCTW
*mdi_cs
= HeapAlloc(GetProcessHeap(), 0, sizeof(*mdi_cs
));
1466 HeapFree(GetProcessHeap(), 0, cs
);
1469 mdi_cs16
= (MDICREATESTRUCT16
*)MapSL(cs16
->lpCreateParams
);
1470 MDICREATESTRUCT16to32A(mdi_cs16
, (MDICREATESTRUCTA
*)mdi_cs
);
1471 mdi_cs
->szTitle
= map_str_16_to_32W(mdi_cs16
->szTitle
);
1472 mdi_cs
->szClass
= map_str_16_to_32W(mdi_cs16
->szClass
);
1474 cs
->lpCreateParams
= mdi_cs
;
1476 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1477 *plparam
= (LPARAM
)cs
;
1482 MDICREATESTRUCT16
*cs16
= MapSL(*plparam
);
1483 MDICREATESTRUCTW
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) + sizeof(LPARAM
) );
1485 MDICREATESTRUCT16to32A( cs16
, (MDICREATESTRUCTA
*)cs
);
1486 cs
->szTitle
= map_str_16_to_32W(cs16
->szTitle
);
1487 cs
->szClass
= map_str_16_to_32W(cs16
->szClass
);
1488 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1489 *plparam
= (LPARAM
)cs
;
1495 LPMSG16 msg16
= MapSL(*plparam
);
1496 LPMSG msg32
= HeapAlloc( GetProcessHeap(), 0, sizeof(MSG
) );
1498 if (!msg32
) return -1;
1499 msg32
->hwnd
= WIN_Handle32( msg16
->hwnd
);
1500 msg32
->message
= msg16
->message
;
1501 msg32
->wParam
= msg16
->wParam
;
1502 msg32
->lParam
= msg16
->lParam
;
1503 msg32
->time
= msg16
->time
;
1504 msg32
->pt
.x
= msg16
->pt
.x
;
1505 msg32
->pt
.y
= msg16
->pt
.y
;
1506 switch(msg32
->message
)
1511 case WM_SYSDEADCHAR
:
1513 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1514 msg32
->wParam
= wch
;
1517 *plparam
= (LPARAM
)msg32
;
1524 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1525 *pwparam32
= MAKEWPARAM( wch
, HIWORD(*plparam
) );
1526 *plparam
= (LPARAM
)WIN_Handle32( LOWORD(*plparam
) );
1530 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1531 *pwparam32
= MAKEWPARAM( wch
, LOWORD(*plparam
) );
1532 *plparam
= (LPARAM
)HMENU_32(HIWORD(*plparam
));
1537 case WM_SYSDEADCHAR
:
1539 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1543 return WINPROC_MapMsg32ATo32W( hwnd
, *pmsg32
, pwparam32
, plparam
);
1545 default: /* No Unicode translation needed */
1546 return WINPROC_MapMsg16To32A( hwnd
, msg16
, wParam16
, pmsg32
,
1547 pwparam32
, plparam
);
1552 /**********************************************************************
1553 * WINPROC_UnmapMsg16To32W
1555 * Unmap a message that was mapped from 16- to 32-bit Unicode.
1557 LRESULT
WINPROC_UnmapMsg16To32W( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
1558 LRESULT result
, WNDPROC dispatch
)
1564 case WM_GETTEXTLENGTH
:
1565 case CB_GETLBTEXTLEN
:
1567 case WM_ASKCBFORMATNAME
:
1568 return WINPROC_UnmapMsg32ATo32W( hwnd
, msg
, wParam
, lParam
, result
, dispatch
);
1572 CREATESTRUCTW
*cs
= (CREATESTRUCTW
*)lParam
;
1573 lParam
= *(LPARAM
*)(cs
+ 1);
1574 CREATESTRUCT32Ato16( (CREATESTRUCTA
*)cs
, MapSL(lParam
) );
1575 unmap_str_16_to_32W( cs
->lpszName
);
1576 unmap_str_16_to_32W( cs
->lpszClass
);
1578 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1580 MDICREATESTRUCTW
*mdi_cs
= (MDICREATESTRUCTW
*)cs
->lpCreateParams
;
1581 unmap_str_16_to_32W( mdi_cs
->szTitle
);
1582 unmap_str_16_to_32W( mdi_cs
->szClass
);
1583 HeapFree(GetProcessHeap(), 0, cs
->lpCreateParams
);
1585 HeapFree( GetProcessHeap(), 0, cs
);
1590 MDICREATESTRUCTW
*cs
= (MDICREATESTRUCTW
*)lParam
;
1591 lParam
= *(LPARAM
*)(cs
+ 1);
1592 MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA
*)cs
, MapSL(lParam
) );
1593 unmap_str_16_to_32W( cs
->szTitle
);
1594 unmap_str_16_to_32W( cs
->szClass
);
1595 HeapFree( GetProcessHeap(), 0, cs
);
1601 LPMSG msg32
= (LPMSG
)lParam
;
1602 HeapFree( GetProcessHeap(), 0, msg32
);
1606 return WINPROC_UnmapMsg16To32A( hwnd
, msg
, wParam
, lParam
, result
);
1611 static HANDLE16
convert_handle_32_to_16(UINT src
, unsigned int flags
)
1614 UINT sz
= GlobalSize((HANDLE
)src
);
1617 if (!(dst
= GlobalAlloc16(flags
, sz
)))
1619 ptr32
= GlobalLock((HANDLE
)src
);
1620 ptr16
= GlobalLock16(dst
);
1621 if (ptr16
!= NULL
&& ptr32
!= NULL
) memcpy(ptr16
, ptr32
, sz
);
1622 GlobalUnlock((HANDLE
)src
);
1623 GlobalUnlock16(dst
);
1629 /**********************************************************************
1630 * WINPROC_MapMsg32ATo16
1632 * Map a message from 32-bit Ansi to 16-bit.
1633 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
1635 INT
WINPROC_MapMsg32ATo16( HWND hwnd
, UINT msg32
, WPARAM wParam32
,
1636 UINT16
*pmsg16
, WPARAM16
*pwparam16
,
1639 *pmsg16
= (UINT16
)msg32
;
1640 *pwparam16
= (WPARAM16
)LOWORD(wParam32
);
1644 *pmsg16
= SBM_SETRANGE16
;
1645 *plparam
= MAKELPARAM(wParam32
, *plparam
);
1650 *pmsg16
= SBM_GETRANGE16
;
1658 *pmsg16
= (UINT16
)msg32
+ (BM_GETCHECK16
- BM_GETCHECK
);
1667 case EM_SCROLLCARET
:
1670 case EM_GETLINECOUNT
:
1682 case EM_LINEFROMCHAR
:
1683 case EM_SETTABSTOPS
:
1684 case EM_SETPASSWORDCHAR
:
1685 case EM_EMPTYUNDOBUFFER
:
1686 case EM_GETFIRSTVISIBLELINE
:
1687 case EM_SETREADONLY
:
1688 case EM_SETWORDBREAKPROC
:
1689 case EM_GETWORDBREAKPROC
:
1690 case EM_GETPASSWORDCHAR
:
1691 *pmsg16
= (UINT16
)msg32
+ (EM_GETSEL16
- EM_GETSEL
);
1696 case LB_DELETESTRING
:
1697 case LB_GETANCHORINDEX
:
1698 case LB_GETCARETINDEX
:
1701 case LB_GETHORIZONTALEXTENT
:
1702 case LB_GETITEMDATA
:
1703 case LB_GETITEMHEIGHT
:
1705 case LB_GETSELCOUNT
:
1707 case LB_GETTOPINDEX
:
1708 case LB_RESETCONTENT
:
1709 case LB_SELITEMRANGE
:
1710 case LB_SELITEMRANGEEX
:
1711 case LB_SETANCHORINDEX
:
1712 case LB_SETCARETINDEX
:
1713 case LB_SETCOLUMNWIDTH
:
1715 case LB_SETHORIZONTALEXTENT
:
1716 case LB_SETITEMDATA
:
1717 case LB_SETITEMHEIGHT
:
1719 case LB_SETTOPINDEX
:
1720 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
1722 case CB_DELETESTRING
:
1724 case CB_GETLBTEXTLEN
:
1726 case CB_RESETCONTENT
:
1730 case CB_SHOWDROPDOWN
:
1731 case CB_SETITEMDATA
:
1732 case CB_SETITEMHEIGHT
:
1733 case CB_GETITEMHEIGHT
:
1734 case CB_SETEXTENDEDUI
:
1735 case CB_GETEXTENDEDUI
:
1736 case CB_GETDROPPEDSTATE
:
1737 *pmsg16
= (UINT16
)msg32
+ (CB_GETEDITSEL16
- CB_GETEDITSEL
);
1740 *pmsg16
= CB_GETEDITSEL16
;
1745 case LB_FINDSTRINGEXACT
:
1746 case LB_INSERTSTRING
:
1747 case LB_SELECTSTRING
:
1750 *plparam
= (LPARAM
)MapLS( (LPSTR
)*plparam
);
1751 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
1756 case CB_FINDSTRINGEXACT
:
1757 case CB_INSERTSTRING
:
1758 case CB_SELECTSTRING
:
1760 *plparam
= (LPARAM
)MapLS( (LPSTR
)*plparam
);
1761 *pmsg16
= (UINT16
)msg32
+ (CB_GETEDITSEL16
- CB_GETEDITSEL
);
1764 case LB_GETITEMRECT
:
1766 RECT16
*rect
= HeapAlloc( GetProcessHeap(), 0, sizeof(RECT16
) + sizeof(LPARAM
) );
1767 if (!rect
) return -1;
1768 *(LPARAM
*)(rect
+ 1) = *plparam
; /* Store the previous lParam */
1769 *plparam
= MapLS( rect
);
1771 *pmsg16
= LB_GETITEMRECT16
;
1773 case LB_GETSELITEMS
:
1775 LPARAM
*items
; /* old LPARAM first, then *pwparam16 x INT16 entries */
1777 *pwparam16
= (WPARAM16
)min( wParam32
, 0x7f80 ); /* Must be < 64K */
1778 if (!(items
= HeapAlloc( GetProcessHeap(), 0,
1779 *pwparam16
* sizeof(INT16
) + sizeof(LPARAM
)))) return -1;
1780 *items
++ = *plparam
; /* Store the previous lParam */
1781 *plparam
= MapLS( items
);
1783 *pmsg16
= LB_GETSELITEMS16
;
1785 case LB_SETTABSTOPS
:
1790 *pwparam16
= (WPARAM16
)min( wParam32
, 0x7f80 ); /* Must be < 64K */
1791 if (!(stops
= HeapAlloc( GetProcessHeap(), 0,
1792 *pwparam16
* sizeof(INT16
) + sizeof(LPARAM
)))) return -1;
1793 for (i
= 0; i
< *pwparam16
; i
++) stops
[i
] = *((LPINT
)*plparam
+i
);
1794 *plparam
= MapLS( stops
);
1797 *pmsg16
= LB_SETTABSTOPS16
;
1800 case CB_GETDROPPEDCONTROLRECT
:
1802 RECT16
*rect
= HeapAlloc( GetProcessHeap(), 0, sizeof(RECT16
) + sizeof(LPARAM
) );
1803 if (!rect
) return -1;
1804 *(LPARAM
*)(rect
+ 1) = *plparam
; /* Store the previous lParam */
1805 *plparam
= (LPARAM
)MapLS(rect
);
1807 *pmsg16
= CB_GETDROPPEDCONTROLRECT16
;
1811 *plparam
= (LPARAM
)MapLS( (LPVOID
)(*plparam
) );
1812 *pmsg16
= LB_GETTEXT16
;
1816 *plparam
= (LPARAM
)MapLS( (LPVOID
)(*plparam
) );
1817 *pmsg16
= CB_GETLBTEXT16
;
1822 *plparam
= MAKELONG( (INT16
)(INT
)wParam32
, (INT16
)*plparam
);
1823 *pmsg16
= EM_SETSEL16
;
1830 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
) );
1834 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HWND16
)*plparam
);
1838 PCOPYDATASTRUCT pcds32
= (PCOPYDATASTRUCT
) *plparam
;
1839 PCOPYDATASTRUCT16 pcds
= HeapAlloc( GetProcessHeap(), 0, sizeof( *pcds
));
1840 pcds
->dwData
= pcds32
->dwData
;
1841 pcds
->cbData
= pcds32
->cbData
;
1842 pcds
->lpData
= MapLS( pcds32
->lpData
);
1843 *plparam
= MapLS( pcds
);
1846 case WM_CTLCOLORMSGBOX
:
1847 case WM_CTLCOLOREDIT
:
1848 case WM_CTLCOLORLISTBOX
:
1849 case WM_CTLCOLORBTN
:
1850 case WM_CTLCOLORDLG
:
1851 case WM_CTLCOLORSCROLLBAR
:
1852 case WM_CTLCOLORSTATIC
:
1853 *pmsg16
= WM_CTLCOLOR
;
1854 *plparam
= MAKELPARAM( (HWND16
)*plparam
,
1855 (WORD
)msg32
- WM_CTLCOLORMSGBOX
);
1857 case WM_COMPAREITEM
:
1859 COMPAREITEMSTRUCT
*cis32
= (COMPAREITEMSTRUCT
*)*plparam
;
1860 COMPAREITEMSTRUCT16
*cis
= HeapAlloc( GetProcessHeap(), 0, sizeof(COMPAREITEMSTRUCT16
));
1861 if (!cis
) return -1;
1862 cis
->CtlType
= (UINT16
)cis32
->CtlType
;
1863 cis
->CtlID
= (UINT16
)cis32
->CtlID
;
1864 cis
->hwndItem
= HWND_16( cis32
->hwndItem
);
1865 cis
->itemID1
= (UINT16
)cis32
->itemID1
;
1866 cis
->itemData1
= cis32
->itemData1
;
1867 cis
->itemID2
= (UINT16
)cis32
->itemID2
;
1868 cis
->itemData2
= cis32
->itemData2
;
1869 *plparam
= MapLS( cis
);
1874 DELETEITEMSTRUCT
*dis32
= (DELETEITEMSTRUCT
*)*plparam
;
1875 DELETEITEMSTRUCT16
*dis
= HeapAlloc( GetProcessHeap(), 0, sizeof(DELETEITEMSTRUCT16
) );
1876 if (!dis
) return -1;
1877 dis
->CtlType
= (UINT16
)dis32
->CtlType
;
1878 dis
->CtlID
= (UINT16
)dis32
->CtlID
;
1879 dis
->itemID
= (UINT16
)dis32
->itemID
;
1880 dis
->hwndItem
= (dis
->CtlType
== ODT_MENU
) ? (HWND16
)LOWORD(dis32
->hwndItem
)
1881 : HWND_16( dis32
->hwndItem
);
1882 dis
->itemData
= dis32
->itemData
;
1883 *plparam
= MapLS( dis
);
1888 DRAWITEMSTRUCT
*dis32
= (DRAWITEMSTRUCT
*)*plparam
;
1889 DRAWITEMSTRUCT16
*dis
= HeapAlloc( GetProcessHeap(), 0, sizeof(DRAWITEMSTRUCT16
) );
1890 if (!dis
) return -1;
1891 dis
->CtlType
= (UINT16
)dis32
->CtlType
;
1892 dis
->CtlID
= (UINT16
)dis32
->CtlID
;
1893 dis
->itemID
= (UINT16
)dis32
->itemID
;
1894 dis
->itemAction
= (UINT16
)dis32
->itemAction
;
1895 dis
->itemState
= (UINT16
)dis32
->itemState
;
1896 dis
->hwndItem
= HWND_16( dis32
->hwndItem
);
1897 dis
->hDC
= HDC_16(dis32
->hDC
);
1898 dis
->itemData
= dis32
->itemData
;
1899 dis
->rcItem
.left
= dis32
->rcItem
.left
;
1900 dis
->rcItem
.top
= dis32
->rcItem
.top
;
1901 dis
->rcItem
.right
= dis32
->rcItem
.right
;
1902 dis
->rcItem
.bottom
= dis32
->rcItem
.bottom
;
1903 *plparam
= MapLS( dis
);
1906 case WM_MEASUREITEM
:
1908 MEASUREITEMSTRUCT
*mis32
= (MEASUREITEMSTRUCT
*)*plparam
;
1909 MEASUREITEMSTRUCT16
*mis
= HeapAlloc( GetProcessHeap(), 0, sizeof(*mis
)+sizeof(LPARAM
));
1910 if (!mis
) return -1;
1911 mis
->CtlType
= (UINT16
)mis32
->CtlType
;
1912 mis
->CtlID
= (UINT16
)mis32
->CtlID
;
1913 mis
->itemID
= (UINT16
)mis32
->itemID
;
1914 mis
->itemWidth
= (UINT16
)mis32
->itemWidth
;
1915 mis
->itemHeight
= (UINT16
)mis32
->itemHeight
;
1916 mis
->itemData
= mis32
->itemData
;
1917 *(LPARAM
*)(mis
+ 1) = *plparam
; /* Store the previous lParam */
1918 *plparam
= MapLS( mis
);
1921 case WM_GETMINMAXINFO
:
1923 MINMAXINFO16
*mmi
= HeapAlloc( GetProcessHeap(), 0, sizeof(*mmi
) + sizeof(LPARAM
) );
1924 if (!mmi
) return -1;
1925 MINMAXINFO32to16( (MINMAXINFO
*)*plparam
, mmi
);
1926 *(LPARAM
*)(mmi
+ 1) = *plparam
; /* Store the previous lParam */
1927 *plparam
= MapLS( mmi
);
1931 case WM_ASKCBFORMATNAME
:
1933 LPARAM
*str
; /* store LPARAM, then *pwparam16 char space */
1934 *pwparam16
= (WPARAM16
)min( wParam32
, 0xff80 ); /* Must be < 64K */
1935 if (!(str
= HeapAlloc( GetProcessHeap(), 0, *pwparam16
+ sizeof(LPARAM
)))) return -1;
1936 *str
++ = *plparam
; /* Store the previous lParam */
1937 *plparam
= MapLS( str
);
1942 MDICREATESTRUCT16
*cs
;
1943 MDICREATESTRUCTA
*cs32
= (MDICREATESTRUCTA
*)*plparam
;
1945 if (!(cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(MDICREATESTRUCT16
) ))) return -1;
1946 MDICREATESTRUCT32Ato16( cs32
, cs
);
1947 cs
->szTitle
= MapLS( cs32
->szTitle
);
1948 cs
->szClass
= MapLS( cs32
->szClass
);
1949 *plparam
= MapLS( cs
);
1952 case WM_MDIGETACTIVE
:
1955 *plparam
= MAKELPARAM( (HMENU16
)LOWORD(wParam32
),
1956 (HMENU16
)LOWORD(*plparam
) );
1957 *pwparam16
= (*plparam
== 0);
1960 if(HIWORD(wParam32
) & MF_POPUP
)
1963 if (((UINT
)HIWORD(wParam32
) != 0xFFFF) || (*plparam
))
1965 if((hmenu
= GetSubMenu((HMENU
)*plparam
, *pwparam16
)))
1966 *pwparam16
=HMENU_16(hmenu
);
1971 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HMENU16
)*plparam
);
1973 case WM_MDIACTIVATE
:
1974 if (GetWindowLongW( hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1976 *pwparam16
= ((HWND
)*plparam
== hwnd
);
1977 *plparam
= MAKELPARAM( (HWND16
)LOWORD(*plparam
),
1978 (HWND16
)LOWORD(wParam32
) );
1982 *pwparam16
= HWND_16( (HWND
)wParam32
);
1988 NCCALCSIZE_PARAMS
*nc32
= (NCCALCSIZE_PARAMS
*)*plparam
;
1989 NCCALCSIZE_PARAMS16
*nc
= HeapAlloc( GetProcessHeap(), 0, sizeof(*nc
) + sizeof(LPARAM
));
1992 nc
->rgrc
[0].left
= nc32
->rgrc
[0].left
;
1993 nc
->rgrc
[0].top
= nc32
->rgrc
[0].top
;
1994 nc
->rgrc
[0].right
= nc32
->rgrc
[0].right
;
1995 nc
->rgrc
[0].bottom
= nc32
->rgrc
[0].bottom
;
1999 nc
->rgrc
[1].left
= nc32
->rgrc
[1].left
;
2000 nc
->rgrc
[1].top
= nc32
->rgrc
[1].top
;
2001 nc
->rgrc
[1].right
= nc32
->rgrc
[1].right
;
2002 nc
->rgrc
[1].bottom
= nc32
->rgrc
[1].bottom
;
2003 nc
->rgrc
[2].left
= nc32
->rgrc
[2].left
;
2004 nc
->rgrc
[2].top
= nc32
->rgrc
[2].top
;
2005 nc
->rgrc
[2].right
= nc32
->rgrc
[2].right
;
2006 nc
->rgrc
[2].bottom
= nc32
->rgrc
[2].bottom
;
2007 if (!(wp
= HeapAlloc( GetProcessHeap(), 0, sizeof(WINDOWPOS16
) )))
2009 HeapFree( GetProcessHeap(), 0, nc
);
2012 WINDOWPOS32to16( nc32
->lppos
, wp
);
2013 nc
->lppos
= MapLS( wp
);
2015 *(LPARAM
*)(nc
+ 1) = *plparam
; /* Store the previous lParam */
2016 *plparam
= MapLS( nc
);
2023 CREATESTRUCTA
*cs32
= (CREATESTRUCTA
*)*plparam
;
2025 if (!(cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(CREATESTRUCT16
) ))) return -1;
2026 CREATESTRUCT32Ato16( cs32
, cs
);
2027 cs
->lpszName
= MapLS( cs32
->lpszName
);
2028 cs
->lpszClass
= MapLS( cs32
->lpszClass
);
2030 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
2032 MDICREATESTRUCT16
*mdi_cs16
;
2033 MDICREATESTRUCTA
*mdi_cs
= (MDICREATESTRUCTA
*)cs32
->lpCreateParams
;
2034 mdi_cs16
= HeapAlloc(GetProcessHeap(), 0, sizeof(*mdi_cs16
));
2037 HeapFree(GetProcessHeap(), 0, cs
);
2040 MDICREATESTRUCT32Ato16(mdi_cs
, mdi_cs16
);
2041 mdi_cs16
->szTitle
= MapLS( mdi_cs
->szTitle
);
2042 mdi_cs16
->szClass
= MapLS( mdi_cs
->szClass
);
2043 cs
->lpCreateParams
= MapLS( mdi_cs16
);
2045 *plparam
= MapLS( cs
);
2048 case WM_PARENTNOTIFY
:
2049 if ((LOWORD(wParam32
)==WM_CREATE
) || (LOWORD(wParam32
)==WM_DESTROY
))
2050 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
));
2051 /* else nothing to do */
2054 *plparam
= MapLS( (NMHDR
*)*plparam
); /* NMHDR is already 32-bit */
2057 case WM_WININICHANGE
:
2058 case WM_DEVMODECHANGE
:
2059 *plparam
= MapLS( (LPSTR
)*plparam
);
2061 case WM_WINDOWPOSCHANGING
:
2062 case WM_WINDOWPOSCHANGED
:
2064 WINDOWPOS16
*wp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*wp
) + sizeof(LPARAM
) );
2066 WINDOWPOS32to16( (WINDOWPOS
*)*plparam
, wp
);
2067 *(LPARAM
*)(wp
+ 1) = *plparam
; /* Store the previous lParam */
2068 *plparam
= MapLS( wp
);
2073 LPMSG msg32
= (LPMSG
) *plparam
;
2074 LPMSG16 msg16
= HeapAlloc( GetProcessHeap(), 0, sizeof(MSG16
) );
2076 if (!msg16
) return -1;
2077 msg16
->hwnd
= HWND_16( msg32
->hwnd
);
2078 msg16
->message
= msg32
->message
;
2079 msg16
->wParam
= msg32
->wParam
;
2080 msg16
->lParam
= msg32
->lParam
;
2081 msg16
->time
= msg32
->time
;
2082 msg16
->pt
.x
= msg32
->pt
.x
;
2083 msg16
->pt
.y
= msg32
->pt
.y
;
2084 *plparam
= MapLS( msg16
);
2089 case WM_ACTIVATEAPP
:
2090 if (*plparam
) *plparam
= HTASK_16( (HANDLE
)*plparam
);
2094 MDINEXTMENU
*next
= (MDINEXTMENU
*)*plparam
;
2095 *plparam
= (LPARAM
)next
->hmenuIn
;
2099 if (IsIconic( hwnd
) && GetClassLongPtrW( hwnd
, GCLP_HICON
))
2101 *pmsg16
= WM_PAINTICON
;
2106 if (IsIconic( hwnd
) && GetClassLongPtrW( hwnd
, GCLP_HICON
))
2107 *pmsg16
= WM_ICONERASEBKGND
;
2109 case WM_PAINTCLIPBOARD
:
2110 case WM_SIZECLIPBOARD
:
2111 FIXME_(msg
)("message %04x needs translation\n", msg32
);
2113 /* following messages should not be sent to 16-bit apps */
2116 case WM_CAPTURECHANGED
:
2117 case WM_STYLECHANGING
:
2118 case WM_STYLECHANGED
:
2120 case WM_DDE_INITIATE
:
2121 case WM_DDE_TERMINATE
:
2122 case WM_DDE_UNADVISE
:
2123 case WM_DDE_REQUEST
:
2124 *pwparam16
= HWND_16((HWND
)wParam32
);
2133 *pwparam16
= HWND_16((HWND
)wParam32
);
2134 UnpackDDElParam(msg32
, *plparam
, &lo32
, &hi
);
2135 if (lo32
&& !(lo16
= convert_handle_32_to_16(lo32
, GMEM_DDESHARE
)))
2137 *plparam
= MAKELPARAM(lo16
, hi
);
2139 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
2146 *pwparam16
= HWND_16((HWND
)wParam32
);
2148 UnpackDDElParam(msg32
, *plparam
, &lo
, &hi
);
2150 if (GlobalGetAtomNameA((ATOM
)hi
, buf
, sizeof(buf
)) > 0) flag
|= 1;
2151 if (GlobalSize((HANDLE
)hi
) != 0) flag
|= 2;
2157 MESSAGE("DDE_ACK: neither atom nor handle!!!\n");
2162 break; /* atom, nothing to do */
2164 MESSAGE("DDE_ACK: %x both atom and handle... choosing handle\n", hi
);
2167 hi
= convert_handle_32_to_16(hi
, GMEM_DDESHARE
);
2170 *plparam
= MAKELPARAM(lo
, hi
);
2172 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
2173 case WM_DDE_EXECUTE
:
2174 *plparam
= convert_handle_32_to_16(*plparam
, GMEM_DDESHARE
);
2175 return 0; /* FIXME don't know how to free allocated memory (handle) !! */
2176 default: /* No translation needed */
2182 /**********************************************************************
2183 * WINPROC_UnmapMsg32ATo16
2185 * Unmap a message that was mapped from 32-bit Ansi to 16-bit.
2187 void WINPROC_UnmapMsg32ATo16( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
2193 *(LPINT
)wParam
= LOWORD(p16
->lResult
);
2194 *(LPINT
)lParam
= HIWORD(p16
->lResult
);
2201 case LB_FINDSTRINGEXACT
:
2202 case LB_INSERTSTRING
:
2203 case LB_SELECTSTRING
:
2207 case CB_FINDSTRINGEXACT
:
2208 case CB_INSERTSTRING
:
2209 case CB_SELECTSTRING
:
2213 case WM_WININICHANGE
:
2214 case WM_DEVMODECHANGE
:
2215 UnMapLS( (SEGPTR
)p16
->lParam
);
2217 case LB_SETTABSTOPS
:
2218 case WM_COMPAREITEM
:
2222 void *ptr
= MapSL( p16
->lParam
);
2223 UnMapLS( p16
->lParam
);
2224 HeapFree( GetProcessHeap(), 0, ptr
);
2229 PCOPYDATASTRUCT16 pcds
= MapSL( p16
->lParam
);
2230 UnMapLS( p16
->lParam
);
2231 UnMapLS( pcds
->lpData
);
2232 HeapFree( GetProcessHeap(), 0, pcds
);
2235 case CB_GETDROPPEDCONTROLRECT
:
2236 case LB_GETITEMRECT
:
2239 RECT16
*rect
= MapSL(p16
->lParam
);
2240 UnMapLS( p16
->lParam
);
2241 p16
->lParam
= *(LPARAM
*)(rect
+ 1);
2242 r32
= (RECT
*)p16
->lParam
;
2243 r32
->left
= rect
->left
;
2244 r32
->top
= rect
->top
;
2245 r32
->right
= rect
->right
;
2246 r32
->bottom
= rect
->bottom
;
2247 HeapFree( GetProcessHeap(), 0, rect
);
2250 case LB_GETSELITEMS
:
2253 LPINT16 items
= MapSL(p16
->lParam
);
2254 UnMapLS( p16
->lParam
);
2255 p16
->lParam
= *((LPARAM
*)items
- 1);
2256 for (i
= 0; i
< p16
->wParam
; i
++) *((LPINT
)(p16
->lParam
) + i
) = items
[i
];
2257 HeapFree( GetProcessHeap(), 0, (LPARAM
*)items
- 1 );
2263 *((PUINT
)(wParam
)) = LOWORD(p16
->lResult
);
2265 *((PUINT
)(lParam
)) = HIWORD(p16
->lResult
); /* FIXME: substract 1? */
2268 case WM_MEASUREITEM
:
2270 MEASUREITEMSTRUCT16
*mis
= MapSL(p16
->lParam
);
2271 MEASUREITEMSTRUCT
*mis32
= *(MEASUREITEMSTRUCT
**)(mis
+ 1);
2272 mis32
->itemWidth
= mis
->itemWidth
;
2273 mis32
->itemHeight
= mis
->itemHeight
;
2274 UnMapLS( p16
->lParam
);
2275 HeapFree( GetProcessHeap(), 0, mis
);
2278 case WM_GETMINMAXINFO
:
2280 MINMAXINFO16
*mmi
= MapSL(p16
->lParam
);
2281 UnMapLS( p16
->lParam
);
2282 p16
->lParam
= *(LPARAM
*)(mmi
+ 1);
2283 MINMAXINFO16to32( mmi
, (MINMAXINFO
*)(p16
->lParam
) );
2284 HeapFree( GetProcessHeap(), 0, mmi
);
2288 case WM_ASKCBFORMATNAME
:
2290 LPSTR str
= MapSL(p16
->lParam
);
2291 UnMapLS( p16
->lParam
);
2292 p16
->lParam
= *((LPARAM
*)str
- 1);
2293 lstrcpynA( (LPSTR
)(p16
->lParam
), str
, p16
->wParam
);
2294 HeapFree( GetProcessHeap(), 0, (LPARAM
*)str
- 1 );
2299 MDICREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2300 UnMapLS( cs
->szTitle
);
2301 UnMapLS( cs
->szClass
);
2302 UnMapLS( p16
->lParam
);
2303 HeapFree( GetProcessHeap(), 0, cs
);
2306 case WM_MDIGETACTIVE
:
2307 if (lParam
) *(BOOL
*)lParam
= (BOOL16
)HIWORD(p16
->lResult
);
2308 p16
->lResult
= (LRESULT
)WIN_Handle32( LOWORD(p16
->lResult
) );
2312 NCCALCSIZE_PARAMS
*nc32
;
2313 NCCALCSIZE_PARAMS16
*nc
= MapSL(p16
->lParam
);
2314 UnMapLS( p16
->lParam
);
2315 p16
->lParam
= *(LPARAM
*)(nc
+ 1);
2316 nc32
= (NCCALCSIZE_PARAMS
*)(p16
->lParam
);
2317 nc32
->rgrc
[0].left
= nc
->rgrc
[0].left
;
2318 nc32
->rgrc
[0].top
= nc
->rgrc
[0].top
;
2319 nc32
->rgrc
[0].right
= nc
->rgrc
[0].right
;
2320 nc32
->rgrc
[0].bottom
= nc
->rgrc
[0].bottom
;
2323 WINDOWPOS16
*pos
= MapSL(nc
->lppos
);
2324 UnMapLS( nc
->lppos
);
2325 nc32
->rgrc
[1].left
= nc
->rgrc
[1].left
;
2326 nc32
->rgrc
[1].top
= nc
->rgrc
[1].top
;
2327 nc32
->rgrc
[1].right
= nc
->rgrc
[1].right
;
2328 nc32
->rgrc
[1].bottom
= nc
->rgrc
[1].bottom
;
2329 nc32
->rgrc
[2].left
= nc
->rgrc
[2].left
;
2330 nc32
->rgrc
[2].top
= nc
->rgrc
[2].top
;
2331 nc32
->rgrc
[2].right
= nc
->rgrc
[2].right
;
2332 nc32
->rgrc
[2].bottom
= nc
->rgrc
[2].bottom
;
2333 WINDOWPOS16to32( pos
, nc32
->lppos
);
2334 HeapFree( GetProcessHeap(), 0, pos
);
2336 HeapFree( GetProcessHeap(), 0, nc
);
2342 CREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2343 UnMapLS( p16
->lParam
);
2344 UnMapLS( cs
->lpszName
);
2345 UnMapLS( cs
->lpszClass
);
2346 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
2348 MDICREATESTRUCT16
*mdi_cs16
= (MDICREATESTRUCT16
*)MapSL(cs
->lpCreateParams
);
2349 UnMapLS( cs
->lpCreateParams
);
2350 UnMapLS( mdi_cs16
->szTitle
);
2351 UnMapLS( mdi_cs16
->szClass
);
2352 HeapFree(GetProcessHeap(), 0, mdi_cs16
);
2354 HeapFree( GetProcessHeap(), 0, cs
);
2357 case WM_WINDOWPOSCHANGING
:
2358 case WM_WINDOWPOSCHANGED
:
2360 WINDOWPOS16
*wp
= MapSL(p16
->lParam
);
2361 UnMapLS( p16
->lParam
);
2362 p16
->lParam
= *(LPARAM
*)(wp
+ 1);
2363 WINDOWPOS16to32( wp
, (WINDOWPOS
*)p16
->lParam
);
2364 HeapFree( GetProcessHeap(), 0, wp
);
2368 UnMapLS(p16
->lParam
);
2373 LPMSG16 msg16
= MapSL(p16
->lParam
);
2374 UnMapLS( p16
->lParam
);
2375 HeapFree( GetProcessHeap(), 0, msg16
);
2380 MDINEXTMENU
*next
= (MDINEXTMENU
*)lParam
;
2381 next
->hmenuNext
= HMENU_32( LOWORD(p16
->lResult
) );
2382 next
->hwndNext
= WIN_Handle32( HIWORD(p16
->lResult
) );
2390 /**********************************************************************
2391 * WINPROC_MapMsg32WTo16
2393 * Map a message from 32-bit Unicode to 16-bit.
2394 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
2396 INT
WINPROC_MapMsg32WTo16( HWND hwnd
, UINT msg32
, WPARAM wParam32
,
2397 UINT16
*pmsg16
, WPARAM16
*pwparam16
,
2403 *pmsg16
= LOWORD(msg32
);
2404 *pwparam16
= LOWORD(wParam32
);
2409 case LB_FINDSTRINGEXACT
:
2410 case LB_INSERTSTRING
:
2411 case LB_SELECTSTRING
:
2414 *plparam
= map_str_32W_to_16( (LPWSTR
)*plparam
);
2415 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
2420 case CB_FINDSTRINGEXACT
:
2421 case CB_INSERTSTRING
:
2422 case CB_SELECTSTRING
:
2424 *plparam
= map_str_32W_to_16( (LPWSTR
)*plparam
);
2425 *pmsg16
= (UINT16
)msg32
+ (CB_ADDSTRING16
- CB_ADDSTRING
);
2432 CREATESTRUCTW
*cs32
= (CREATESTRUCTW
*)*plparam
;
2434 if (!(cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(CREATESTRUCT16
) ))) return -1;
2435 CREATESTRUCT32Ato16( (CREATESTRUCTA
*)cs32
, cs
);
2436 cs
->lpszName
= map_str_32W_to_16( cs32
->lpszName
);
2437 cs
->lpszClass
= map_str_32W_to_16( cs32
->lpszClass
);
2439 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
2441 MDICREATESTRUCT16
*mdi_cs16
;
2442 MDICREATESTRUCTW
*mdi_cs
= (MDICREATESTRUCTW
*)cs32
->lpCreateParams
;
2443 mdi_cs16
= HeapAlloc(GetProcessHeap(), 0, sizeof(*mdi_cs16
));
2446 HeapFree(GetProcessHeap(), 0, cs
);
2449 MDICREATESTRUCT32Ato16((MDICREATESTRUCTA
*)mdi_cs
, mdi_cs16
);
2450 mdi_cs16
->szTitle
= map_str_32W_to_16(mdi_cs
->szTitle
);
2451 mdi_cs16
->szClass
= map_str_32W_to_16(mdi_cs
->szClass
);
2452 cs
->lpCreateParams
= MapLS(mdi_cs16
);
2454 *plparam
= MapLS(cs
);
2459 MDICREATESTRUCT16
*cs
;
2460 MDICREATESTRUCTW
*cs32
= (MDICREATESTRUCTW
*)*plparam
;
2462 if (!(cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(MDICREATESTRUCT16
) ))) return -1;
2463 MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA
*)cs32
, cs
);
2464 cs
->szTitle
= map_str_32W_to_16( cs32
->szTitle
);
2465 cs
->szClass
= map_str_32W_to_16( cs32
->szClass
);
2466 *plparam
= MapLS(cs
);
2470 case WM_WININICHANGE
:
2471 case WM_DEVMODECHANGE
:
2472 *plparam
= map_str_32W_to_16( (LPWSTR
)*plparam
);
2476 if ( WINPROC_TestLBForStr( hwnd
, msg32
))
2478 LPSTR str
= HeapAlloc( GetProcessHeap(), 0, 512 ); /* FIXME: fixed sized buffer */
2479 if (!str
) return -1;
2480 *pmsg16
= (msg32
== LB_GETTEXT
) ? LB_GETTEXT16
: CB_GETLBTEXT16
;
2481 *plparam
= (LPARAM
)MapLS(str
);
2486 wch
= LOWORD(wParam32
);
2487 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, (LPSTR
)&ch
, 1, NULL
, NULL
);
2489 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
) );
2492 wch
= LOWORD(wParam32
);
2493 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, (LPSTR
)&ch
, 1, NULL
, NULL
);
2495 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HMENU16
)*plparam
);
2500 case WM_SYSDEADCHAR
:
2502 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, (LPSTR
)&ch
, 1, NULL
, NULL
);
2510 if (WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, (LPSTR
)ch
, 2, NULL
, NULL
) == 2)
2511 *pwparam16
= (ch
[0] << 8) | ch
[1];
2517 default: /* No Unicode translation needed (?) */
2518 return WINPROC_MapMsg32ATo16( hwnd
, msg32
, wParam32
, pmsg16
,
2519 pwparam16
, plparam
);
2524 /**********************************************************************
2525 * WINPROC_UnmapMsg32WTo16
2527 * Unmap a message that was mapped from 32-bit Unicode to 16-bit.
2529 void WINPROC_UnmapMsg32WTo16( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
2536 case LB_FINDSTRINGEXACT
:
2537 case LB_INSERTSTRING
:
2538 case LB_SELECTSTRING
:
2543 case CB_FINDSTRINGEXACT
:
2544 case CB_INSERTSTRING
:
2545 case CB_SELECTSTRING
:
2548 case WM_WININICHANGE
:
2549 case WM_DEVMODECHANGE
:
2550 unmap_str_32W_to_16( p16
->lParam
);
2555 CREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2556 UnMapLS( p16
->lParam
);
2557 unmap_str_32W_to_16( cs
->lpszName
);
2558 unmap_str_32W_to_16( cs
->lpszClass
);
2560 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
2562 MDICREATESTRUCT16
*mdi_cs16
= (MDICREATESTRUCT16
*)MapSL(cs
->lpCreateParams
);
2563 UnMapLS( cs
->lpCreateParams
);
2564 unmap_str_32W_to_16(mdi_cs16
->szTitle
);
2565 unmap_str_32W_to_16(mdi_cs16
->szClass
);
2566 HeapFree(GetProcessHeap(), 0, mdi_cs16
);
2568 HeapFree( GetProcessHeap(), 0, cs
);
2573 MDICREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2574 UnMapLS( p16
->lParam
);
2575 unmap_str_32W_to_16( cs
->szTitle
);
2576 unmap_str_32W_to_16( cs
->szClass
);
2577 HeapFree( GetProcessHeap(), 0, cs
);
2581 case WM_ASKCBFORMATNAME
:
2583 LPSTR str
= MapSL(p16
->lParam
);
2584 UnMapLS( p16
->lParam
);
2585 p16
->lParam
= *((LPARAM
*)str
- 1);
2586 MultiByteToWideChar( CP_ACP
, 0, str
, -1, (LPWSTR
)p16
->lParam
, 0x7fffffff );
2587 p16
->lResult
= strlenW( (LPWSTR
)p16
->lParam
);
2588 HeapFree( GetProcessHeap(), 0, (LPARAM
*)str
- 1 );
2593 if ( WINPROC_TestLBForStr( hwnd
, msg
))
2595 LPSTR str
= MapSL(p16
->lParam
);
2596 UnMapLS( p16
->lParam
);
2597 p16
->lResult
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, (LPWSTR
)lParam
, 0x7fffffff ) - 1;
2598 HeapFree( GetProcessHeap(), 0, (LPARAM
*)str
);
2602 WINPROC_UnmapMsg32ATo16( hwnd
, msg
, wParam
, lParam
, p16
);
2608 /**********************************************************************
2609 * WINPROC_CallProc32ATo32W
2611 * Call a window procedure, translating args from Ansi to Unicode.
2613 static LRESULT
WINPROC_CallProc32ATo32W( WNDPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
,
2614 LPARAM lParam
, BOOL dialog
)
2619 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
2620 func
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
2622 if( (unmap
= WINPROC_MapMsg32ATo32W( hwnd
, msg
, &wParam
, &lParam
)) == -1) {
2623 ERR_(msg
)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n",
2624 SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
2627 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2632 LRESULT result
= GetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
);
2633 result
= WINPROC_UnmapMsg32ATo32W( hwnd
, msg
, wParam
, lParam
, result
, NULL
);
2634 SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, result
);
2636 else ret
= WINPROC_UnmapMsg32ATo32W( hwnd
, msg
, wParam
, lParam
, ret
, func
);
2642 static inline void *get_buffer( void *static_buffer
, size_t size
, size_t need
)
2644 if (size
>= need
) return static_buffer
;
2645 return HeapAlloc( GetProcessHeap(), 0, need
);
2648 static inline void free_buffer( void *static_buffer
, void *buffer
)
2650 if (buffer
!= static_buffer
) HeapFree( GetProcessHeap(), 0, buffer
);
2653 /**********************************************************************
2654 * WINPROC_CallProc32WTo32A
2656 * Call a window procedure, translating args from Unicode to Ansi.
2658 static LRESULT
WINPROC_CallProc32WTo32A( WNDPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
,
2659 LPARAM lParam
, BOOL dialog
)
2663 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
2664 func
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
2670 { /* csW->lpszName and csW->lpszClass are NOT supposed to be atoms
2673 char buffer
[1024], *cls
, *name
;
2674 CREATESTRUCTW
*csW
= (CREATESTRUCTW
*)lParam
;
2675 CREATESTRUCTA csA
= *(CREATESTRUCTA
*)csW
;
2676 MDICREATESTRUCTA mdi_cs
;
2677 DWORD name_lenA
, name_lenW
, class_lenA
, class_lenW
;
2679 class_lenW
= strlenW(csW
->lpszClass
) * sizeof(WCHAR
);
2680 RtlUnicodeToMultiByteSize(&class_lenA
, csW
->lpszClass
, class_lenW
);
2684 name_lenW
= strlenW(csW
->lpszName
) * sizeof(WCHAR
);
2685 RtlUnicodeToMultiByteSize(&name_lenA
, csW
->lpszName
, name_lenW
);
2688 name_lenW
= name_lenA
= 0;
2690 if (!(cls
= get_buffer( buffer
, sizeof(buffer
), class_lenA
+ name_lenA
+ 2 ))) break;
2692 RtlUnicodeToMultiByteN(cls
, class_lenA
, NULL
, csW
->lpszClass
, class_lenW
);
2693 cls
[class_lenA
] = 0;
2694 csA
.lpszClass
= cls
;
2698 name
= cls
+ class_lenA
+ 1;
2699 RtlUnicodeToMultiByteN(name
, name_lenA
, NULL
, csW
->lpszName
, name_lenW
);
2700 name
[name_lenA
] = 0;
2701 csA
.lpszName
= name
;
2704 if (GetWindowLongW(hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
2706 mdi_cs
= *(MDICREATESTRUCTA
*)csW
->lpCreateParams
;
2707 mdi_cs
.szTitle
= csA
.lpszName
;
2708 mdi_cs
.szClass
= csA
.lpszClass
;
2709 csA
.lpCreateParams
= &mdi_cs
;
2712 ret
= WINPROC_CallWndProc(func
, hwnd
, msg
, wParam
, (LPARAM
)&csA
);
2713 free_buffer( buffer
, cls
);
2718 case WM_ASKCBFORMATNAME
:
2720 char *ptr
, buffer
[512];
2721 DWORD len
= wParam
* 2;
2723 if (!(ptr
= get_buffer( buffer
, sizeof(buffer
), len
))) break;
2724 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, len
, (LPARAM
)ptr
);
2727 RtlMultiByteToUnicodeN( (LPWSTR
)lParam
, wParam
*sizeof(WCHAR
), &len
, ptr
, strlen(ptr
)+1 );
2728 ret
= len
/sizeof(WCHAR
) - 1; /* do not count terminating null */
2729 ((LPWSTR
)lParam
)[ret
] = 0;
2732 SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, ret
);
2736 free_buffer( buffer
, ptr
);
2741 case LB_INSERTSTRING
:
2743 case LB_FINDSTRINGEXACT
:
2744 case LB_SELECTSTRING
:
2746 case CB_INSERTSTRING
:
2748 case CB_FINDSTRINGEXACT
:
2749 case CB_SELECTSTRING
:
2750 if (!lParam
|| !WINPROC_TestLBForStr( hwnd
, msg
))
2752 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2757 case WM_WININICHANGE
:
2758 case WM_DEVMODECHANGE
:
2763 if (!lParam
) ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2766 char *ptr
, buffer
[512];
2767 LPCWSTR strW
= (LPCWSTR
)lParam
;
2768 DWORD lenA
, lenW
= (strlenW(strW
) + 1) * sizeof(WCHAR
);
2770 RtlUnicodeToMultiByteSize( &lenA
, strW
, lenW
);
2771 if ((ptr
= get_buffer( buffer
, sizeof(buffer
), lenA
)))
2773 RtlUnicodeToMultiByteN( ptr
, lenA
, NULL
, strW
, lenW
);
2774 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, (LPARAM
)ptr
);
2775 free_buffer( buffer
, ptr
);
2782 char *ptr
, buffer
[1024];
2783 DWORD title_lenA
= 0, title_lenW
= 0, class_lenA
= 0, class_lenW
= 0;
2784 MDICREATESTRUCTW
*csW
= (MDICREATESTRUCTW
*)lParam
;
2785 MDICREATESTRUCTA csA
;
2787 memcpy( &csA
, csW
, sizeof(csA
) );
2789 if (HIWORD(csW
->szTitle
))
2791 title_lenW
= (strlenW(csW
->szTitle
) + 1) * sizeof(WCHAR
);
2792 RtlUnicodeToMultiByteSize( &title_lenA
, csW
->szTitle
, title_lenW
);
2794 if (HIWORD(csW
->szClass
))
2796 class_lenW
= (strlenW(csW
->szClass
) + 1) * sizeof(WCHAR
);
2797 RtlUnicodeToMultiByteSize( &class_lenA
, csW
->szClass
, class_lenW
);
2800 if (!(ptr
= get_buffer( buffer
, sizeof(buffer
), title_lenA
+ class_lenA
))) break;
2804 RtlUnicodeToMultiByteN( ptr
, title_lenA
, NULL
, csW
->szTitle
, title_lenW
);
2809 RtlUnicodeToMultiByteN( ptr
+ title_lenA
, class_lenA
, NULL
, csW
->szClass
, class_lenW
);
2810 csA
.szClass
= ptr
+ title_lenA
;
2812 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, (LPARAM
)&csA
);
2813 free_buffer( buffer
, ptr
);
2819 if (lParam
&& WINPROC_TestLBForStr( hwnd
, msg
))
2821 char buffer
[512]; /* FIXME: fixed sized buffer */
2824 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, (LPARAM
)buffer
);
2825 result
= dialog
? GetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
) : ret
;
2829 RtlMultiByteToUnicodeN( (LPWSTR
)lParam
, ~0u, &len
, buffer
, strlen(buffer
) + 1 );
2830 result
= len
/ sizeof(WCHAR
) - 1;
2831 if (dialog
) SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, result
);
2835 else ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2840 char *ptr
, buffer
[512];
2841 WORD len
= *(WORD
*)lParam
;
2844 if (!(ptr
= get_buffer( buffer
, sizeof(buffer
), len
* 2 ))) break;
2845 *((WORD
*)ptr
) = len
* 2; /* store the length */
2846 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, (LPARAM
)ptr
);
2847 result
= dialog
? GetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
) : ret
;
2850 RtlMultiByteToUnicodeN( (LPWSTR
)lParam
, len
*sizeof(WCHAR
), &result
, buffer
, result
);
2851 result
/= sizeof(WCHAR
);
2852 if (result
< len
) ((LPWSTR
)lParam
)[result
] = 0;
2853 if (dialog
) SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, result
);
2856 free_buffer( buffer
, ptr
);
2865 case WM_SYSDEADCHAR
:
2866 case EM_SETPASSWORDCHAR
:
2868 WCHAR wch
= LOWORD(wParam
);
2870 RtlUnicodeToMultiByteN( (LPSTR
)&ch
, 1, NULL
, &wch
, sizeof(WCHAR
) );
2871 wParam
= MAKEWPARAM( ch
, HIWORD(wParam
) );
2872 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2878 WCHAR wch
= LOWORD(wParam
);
2882 RtlUnicodeToMultiByteN( (LPSTR
)ch
, 2, &len
, &wch
, sizeof(WCHAR
) );
2884 wParam
= MAKEWPARAM( (ch
[0] << 8) | ch
[1], HIWORD(wParam
) );
2886 wParam
= MAKEWPARAM( ch
[0], HIWORD(wParam
) );
2887 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2891 case WM_PAINTCLIPBOARD
:
2892 case WM_SIZECLIPBOARD
:
2893 FIXME_(msg
)( "message %s (%04x) needs translation, please report\n",
2894 SPY_GetMsgName(msg
, hwnd
), msg
);
2898 ret
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2906 /**********************************************************************
2907 * WINPROC_CallProc16To32A
2909 static LRESULT
WINPROC_CallProc16To32A( WNDPROC func
, HWND16 hwnd
, UINT16 msg
,
2910 WPARAM16 wParam
, LPARAM lParam
, BOOL dialog
)
2915 HWND hwnd32
= WIN_Handle32( hwnd
);
2917 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
2918 func
, hwnd32
, SPY_GetMsgName(msg
, hwnd32
), wParam
, lParam
);
2920 if (WINPROC_MapMsg16To32A( hwnd32
, msg
, wParam
, &msg32
, &wParam32
, &lParam
) == -1)
2922 ret
= WINPROC_CallWndProc( func
, hwnd32
, msg32
, wParam32
, lParam
);
2925 LRESULT result
= GetWindowLongPtrW( hwnd32
, DWLP_MSGRESULT
);
2926 result
= WINPROC_UnmapMsg16To32A( hwnd32
, msg32
, wParam32
, lParam
, result
);
2927 SetWindowLongPtrW( hwnd32
, DWLP_MSGRESULT
, result
);
2929 else ret
= WINPROC_UnmapMsg16To32A( hwnd32
, msg32
, wParam32
, lParam
, ret
);
2935 /**********************************************************************
2936 * WINPROC_CallProc16To32W
2938 static LRESULT
WINPROC_CallProc16To32W( WNDPROC func
, HWND16 hwnd
, UINT16 msg
,
2939 WPARAM16 wParam
, LPARAM lParam
, BOOL dialog
)
2944 HWND hwnd32
= WIN_Handle32( hwnd
);
2946 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
2947 func
, hwnd32
, SPY_GetMsgName(msg
, hwnd32
), wParam
, lParam
);
2949 if (WINPROC_MapMsg16To32W( hwnd32
, msg
, wParam
, &msg32
, &wParam32
, &lParam
) == -1)
2952 ret
= WINPROC_CallWndProc( func
, hwnd32
, msg32
, wParam32
, lParam
);
2955 LRESULT result
= GetWindowLongPtrW( hwnd32
, DWLP_MSGRESULT
);
2956 result
= WINPROC_UnmapMsg16To32W( hwnd32
, msg32
, wParam32
, lParam
, result
, NULL
);
2957 SetWindowLongPtrW( hwnd32
, DWLP_MSGRESULT
, result
);
2959 else ret
= WINPROC_UnmapMsg16To32W( hwnd32
, msg32
, wParam32
, lParam
, ret
, func
);
2965 /**********************************************************************
2966 * __wine_call_wndproc (USER.1010)
2968 LRESULT WINAPI
__wine_call_wndproc( HWND16 hwnd
, UINT16 msg
, WPARAM16 wParam
, LPARAM lParam
,
2971 if (proc
->procA
) return WINPROC_CallProc16To32A( proc
->procA
, hwnd
, msg
, wParam
, lParam
, FALSE
);
2972 else return WINPROC_CallProc16To32W( proc
->procW
, hwnd
, msg
, wParam
, lParam
, FALSE
);
2976 /**********************************************************************
2977 * WINPROC_CallProc32ATo16
2979 * Call a 16-bit window procedure, translating the 32-bit args.
2981 static LRESULT
WINPROC_CallProc32ATo16( WNDPROC16 func
, HWND hwnd
, UINT msg
,
2982 WPARAM wParam
, LPARAM lParam
, BOOL dialog
)
2988 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
2989 func
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
2991 mp16
.lParam
= lParam
;
2992 if (WINPROC_MapMsg32ATo16( hwnd
, msg
, wParam
, &msg16
, &mp16
.wParam
, &mp16
.lParam
) == -1)
2994 ret
= WINPROC_CallWndProc16( func
, HWND_16(hwnd
), msg16
, mp16
.wParam
, mp16
.lParam
);
2997 mp16
.lResult
= GetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
);
2998 WINPROC_UnmapMsg32ATo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
2999 SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, mp16
.lResult
);
3005 WINPROC_UnmapMsg32ATo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
3012 /**********************************************************************
3013 * WINPROC_CallProc32WTo16
3015 * Call a 16-bit window procedure, translating the 32-bit args.
3017 static LRESULT
WINPROC_CallProc32WTo16( WNDPROC16 func
, HWND hwnd
, UINT msg
,
3018 WPARAM wParam
, LPARAM lParam
, BOOL dialog
)
3024 TRACE_(msg
)("func %p (hwnd=%p,msg=%s,wp=%08x,lp=%08lx)\n",
3025 func
, hwnd
, SPY_GetMsgName(msg
, hwnd
), wParam
, lParam
);
3027 mp16
.lParam
= lParam
;
3028 if (WINPROC_MapMsg32WTo16( hwnd
, msg
, wParam
, &msg16
, &mp16
.wParam
, &mp16
.lParam
) == -1)
3030 ret
= WINPROC_CallWndProc16( func
, HWND_16(hwnd
), msg16
, mp16
.wParam
, mp16
.lParam
);
3033 mp16
.lResult
= GetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
);
3034 WINPROC_UnmapMsg32WTo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
3035 SetWindowLongPtrW( hwnd
, DWLP_MSGRESULT
, mp16
.lResult
);
3041 WINPROC_UnmapMsg32WTo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
3048 /**********************************************************************
3049 * CallWindowProc (USER.122)
3051 LRESULT WINAPI
CallWindowProc16( WNDPROC16 func
, HWND16 hwnd
, UINT16 msg
,
3052 WPARAM16 wParam
, LPARAM lParam
)
3056 if (!func
) return 0;
3058 if (!(proc
= handle16_to_proc( func
)))
3059 return WINPROC_CallWndProc16( func
, hwnd
, msg
, wParam
, lParam
);
3061 if (proc
->procA
) return WINPROC_CallProc16To32A( proc
->procA
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3062 if (proc
->procW
) return WINPROC_CallProc16To32W( proc
->procW
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3063 return WINPROC_CallWndProc16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
);
3067 /**********************************************************************
3068 * CallWindowProcA (USER32.@)
3070 * The CallWindowProc() function invokes the windows procedure _func_,
3071 * with _hwnd_ as the target window, the message specified by _msg_, and
3072 * the message parameters _wParam_ and _lParam_.
3074 * Some kinds of argument conversion may be done, I'm not sure what.
3076 * CallWindowProc() may be used for windows subclassing. Use
3077 * SetWindowLong() to set a new windows procedure for windows of the
3078 * subclass, and handle subclassed messages in the new windows
3079 * procedure. The new windows procedure may then use CallWindowProc()
3080 * with _func_ set to the parent class's windows procedure to dispatch
3081 * the message to the superclass.
3085 * The return value is message dependent.
3091 LRESULT WINAPI
CallWindowProcA(
3092 WNDPROC func
, /* [in] window procedure */
3093 HWND hwnd
, /* [in] target window */
3094 UINT msg
, /* [in] message */
3095 WPARAM wParam
, /* [in] message dependent parameter */
3096 LPARAM lParam
/* [in] message dependent parameter */
3100 if (!func
) return 0;
3102 if (!(proc
= handle_to_proc( func
)))
3103 return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
3105 if (proc
->procA
) return WINPROC_CallWndProc( proc
->procA
, hwnd
, msg
, wParam
, lParam
);
3106 if (proc
->procW
) return WINPROC_CallProc32ATo32W( proc
->procW
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3107 return WINPROC_CallProc32ATo16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3111 /**********************************************************************
3112 * CallWindowProcW (USER32.@)
3114 * See CallWindowProcA.
3116 LRESULT WINAPI
CallWindowProcW( WNDPROC func
, HWND hwnd
, UINT msg
,
3117 WPARAM wParam
, LPARAM lParam
)
3121 if (!func
) return 0;
3123 if (!(proc
= handle_to_proc( func
)))
3124 return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
3126 if (proc
->procW
) return WINPROC_CallWndProc( proc
->procW
, hwnd
, msg
, wParam
, lParam
);
3127 if (proc
->procA
) return WINPROC_CallProc32WTo32A( proc
->procA
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3128 return WINPROC_CallProc32WTo16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
, FALSE
);
3132 /**********************************************************************
3133 * WINPROC_CallDlgProc16
3135 INT_PTR
WINPROC_CallDlgProc16( DLGPROC16 func
, HWND16 hwnd
, UINT16 msg
, WPARAM16 wParam
, LPARAM lParam
)
3139 if (!func
) return 0;
3141 if (!(proc
= handle16_to_proc( (WNDPROC16
)func
)))
3142 return LOWORD( WINPROC_CallWndProc16( (WNDPROC16
)func
, hwnd
, msg
, wParam
, lParam
) );
3144 if (proc
->procA
) return WINPROC_CallProc16To32A( proc
->procA
, hwnd
, msg
, wParam
, lParam
, TRUE
);
3145 if (proc
->procW
) return WINPROC_CallProc16To32W( proc
->procW
, hwnd
, msg
, wParam
, lParam
, TRUE
);
3146 return LOWORD( WINPROC_CallWndProc16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
) );
3150 /**********************************************************************
3151 * WINPROC_CallDlgProcA
3153 INT_PTR
WINPROC_CallDlgProcA( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
3157 if (!func
) return 0;
3159 if (!(proc
= handle_to_proc( (WNDPROC
)func
)))
3160 return WINPROC_CallWndProc( (WNDPROC
)func
, hwnd
, msg
, wParam
, lParam
);
3162 if (proc
->procA
) return WINPROC_CallWndProc( proc
->procA
, hwnd
, msg
, wParam
, lParam
);
3163 if (proc
->procW
) return WINPROC_CallProc32ATo32W( proc
->procW
, hwnd
, msg
, wParam
, lParam
, TRUE
);
3164 return WINPROC_CallProc32ATo16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
, TRUE
);
3168 /**********************************************************************
3169 * WINPROC_CallDlgProcW
3171 INT_PTR
WINPROC_CallDlgProcW( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
3175 if (!func
) return 0;
3177 if (!(proc
= handle_to_proc( (WNDPROC
)func
)))
3178 return WINPROC_CallWndProc( (WNDPROC
)func
, hwnd
, msg
, wParam
, lParam
);
3180 if (proc
->procW
) return WINPROC_CallWndProc( proc
->procW
, hwnd
, msg
, wParam
, lParam
);
3181 if (proc
->procA
) return WINPROC_CallProc32WTo32A( proc
->procA
, hwnd
, msg
, wParam
, lParam
, TRUE
);
3182 return WINPROC_CallProc32WTo16( proc
->proc16
, hwnd
, msg
, wParam
, lParam
, TRUE
);