2 * Window procedure callbacks
4 * Copyright 1995 Martin von Loewis
5 * Copyright 1996 Alexandre Julliard
14 #include "wine/winbase16.h"
15 #include "wine/winuser16.h"
16 #include "stackframe.h"
17 #include "builtin16.h"
23 #include "debugtools.h"
28 DECLARE_DEBUG_CHANNEL(msg
);
29 DECLARE_DEBUG_CHANNEL(relay
);
30 DECLARE_DEBUG_CHANNEL(win
);
32 /* Window procedure 16-to-32-bit thunk,
33 * see BuildSpec16File() in tools/build.c */
38 WORD pushw_bp
; /* pushw %bp */
39 BYTE pushl_func
; /* pushl $proc */
41 WORD pushw_ax
; /* pushw %ax */
42 BYTE pushl_relay
; /* pushl $relay */
43 void (*relay
)(); /* WINPROC_Thunk16To32A/W() */
44 BYTE lcall
; /* lcall cs:glue */
45 void (*glue
)(); /* __wine_call_from_16_long */
46 WORD cs
; /* __FLATCS */
47 WORD lret
; /* lret $10 */
49 } WINPROC_THUNK_FROM16
;
52 /* Window procedure 32-to-16-bit thunk,
53 * see BuildSpec32File() in tools/build.c */
57 BYTE popl_eax
; /* popl %eax (return address) */
58 BYTE pushl_func
; /* pushl $proc */
59 WNDPROC16 proc WINE_PACKED
;
60 BYTE pushl_eax
; /* pushl %eax */
61 BYTE jmp
; /* jmp relay (relative jump)*/
62 void (*relay
)() WINE_PACKED
; /* WINPROC_CallProc32ATo16() */
63 } WINPROC_THUNK_FROM32
;
65 /* Simple jmp to call 32-bit procedure directly */
68 BYTE jmp
; /* jmp proc (relative jump) */
69 WNDPROC proc WINE_PACKED
;
74 WINPROC_THUNK_FROM16 t_from16
;
75 WINPROC_THUNK_FROM32 t_from32
;
78 typedef struct tagWINDOWPROC
80 WINPROC_THUNK thunk
; /* Thunk */
81 WINPROC_JUMP jmp
; /* Jump */
82 struct tagWINDOWPROC
*next
; /* Next window proc */
83 UINT magic
; /* Magic number */
84 WINDOWPROCTYPE type
; /* Function type */
85 WINDOWPROCUSER user
; /* Function user */
88 #define WINPROC_MAGIC ('W' | ('P' << 8) | ('R' << 16) | ('C' << 24))
90 #define WINPROC_THUNKPROC(pproc) \
91 (((pproc)->type == WIN_PROC_16) ? \
92 (WNDPROC16)((pproc)->thunk.t_from32.proc) : \
93 (WNDPROC16)((pproc)->thunk.t_from16.proc))
95 static LRESULT WINAPI
WINPROC_CallProc32ATo16( WNDPROC16 func
, HWND hwnd
,
96 UINT msg
, WPARAM wParam
,
98 static LRESULT WINAPI
WINPROC_CallProc32WTo16( WNDPROC16 func
, HWND hwnd
,
99 UINT msg
, WPARAM wParam
,
101 static LRESULT WINAPI
WINPROC_Thunk16To32A( WNDPROC func
, LPBYTE args
);
102 static LRESULT WINAPI
WINPROC_Thunk16To32W( WNDPROC func
, LPBYTE args
);
104 static HANDLE WinProcHeap
;
107 /**********************************************************************
110 BOOL
WINPROC_Init(void)
112 WinProcHeap
= HeapCreate( HEAP_WINE_SEGPTR
| HEAP_WINE_CODESEG
, 0, 0 );
115 WARN_(relay
)("Unable to create winproc heap\n" );
123 /* Some window procedures modify register they shouldn't, or are not
124 * properly declared stdcall; so we need a small assembly wrapper to
126 extern LRESULT
WINPROC_wrapper( WNDPROC proc
, HWND hwnd
, UINT msg
,
127 WPARAM wParam
, LPARAM lParam
);
128 __ASM_GLOBAL_FUNC( WINPROC_wrapper
,
138 "movl 8(%ebp),%eax\n\t"
140 "leal -12(%ebp),%esp\n\t"
147 static inline LRESULT
WINPROC_wrapper( WNDPROC proc
, HWND hwnd
, UINT msg
,
148 WPARAM wParam
, LPARAM lParam
)
150 return proc( hwnd
, msg
, wParam
, lParam
);
152 #endif /* __i386__ */
154 /**********************************************************************
155 * WINPROC_CallWndProc32
157 * Call a 32-bit WndProc.
159 static LRESULT
WINPROC_CallWndProc( WNDPROC proc
, HWND hwnd
, UINT msg
,
160 WPARAM wParam
, LPARAM lParam
)
165 hwnd
= WIN_GetFullHandle( hwnd
);
167 DPRINTF( "%08lx:Call window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx)\n",
168 GetCurrentThreadId(), proc
, hwnd
, SPY_GetMsgName(msg
), wParam
, lParam
);
169 /* To avoid any deadlocks, all the locks on the windows structures
170 must be suspended before the control is passed to the application */
171 iWndsLocks
= WIN_SuspendWndsLock();
172 retvalue
= WINPROC_wrapper( proc
, hwnd
, msg
, wParam
, lParam
);
173 WIN_RestoreWndsLock(iWndsLocks
);
176 DPRINTF( "%08lx:Ret window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx) retval=%08lx\n",
177 GetCurrentThreadId(), proc
, hwnd
, SPY_GetMsgName(msg
), wParam
, lParam
, retvalue
);
181 /***********************************************************************
182 * WINPROC_CallWndProc16
184 * Call a 16-bit window procedure
186 static LRESULT WINAPI
WINPROC_CallWndProc16( WNDPROC16 proc
, HWND16 hwnd
,
187 UINT16 msg
, WPARAM16 wParam
,
193 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
195 TEB
*teb
= NtCurrentTeb();
198 /* Window procedures want ax = hInstance, ds = es = ss */
200 memset(&context
, '\0', sizeof(context
));
201 context
.SegDs
= context
.SegEs
= SELECTOROF(teb
->cur_stack
);
202 context
.Eax
= wndPtr
? wndPtr
->hInstance
: context
.SegDs
;
203 context
.SegCs
= SELECTOROF(proc
);
204 context
.Eip
= OFFSETOF(proc
);
205 context
.Ebp
= OFFSETOF(teb
->cur_stack
)
206 + (WORD
)&((STACK16FRAME
*)0)->bp
;
208 WIN_ReleaseWndPtr(wndPtr
);
212 /* Some programs (eg. the "Undocumented Windows" examples, JWP) only
213 work if structures passed in lParam are placed in the stack/data
214 segment. Programmers easily make the mistake of converting lParam
215 to a near rather than a far pointer, since Windows apparently
216 allows this. We copy the structures to the 16 bit stack; this is
217 ugly but makes these programs work. */
222 offset
= sizeof(CREATESTRUCT16
); break;
224 offset
= sizeof(DRAWITEMSTRUCT16
); break;
226 offset
= sizeof(COMPAREITEMSTRUCT16
); break;
230 void *s
= MapSL(lParam
);
231 lParam
= stack16_push( offset
);
232 memcpy( MapSL(lParam
), s
, offset
);
236 iWndsLocks
= WIN_SuspendWndsLock();
238 args
= (WORD
*)THREAD_STACK16(teb
) - 5;
239 args
[0] = LOWORD(lParam
);
240 args
[1] = HIWORD(lParam
);
245 wine_call_to_16_regs_short( &context
, 5 * sizeof(WORD
) );
246 ret
= MAKELONG( LOWORD(context
.Eax
), LOWORD(context
.Edx
) );
247 if (offset
) stack16_pop( offset
);
249 WIN_RestoreWndsLock(iWndsLocks
);
255 /**********************************************************************
258 * Return a pointer to the win proc.
260 static WINDOWPROC
*WINPROC_GetPtr( WNDPROC16 handle
)
265 /* ptr cannot be < 64K */
266 if (!HIWORD(handle
)) return NULL
;
268 /* Check for a linear pointer */
270 ptr
= (BYTE
*)handle
;
271 /* First check if it is the jmp address */
272 proc
= (WINDOWPROC
*)(ptr
- (int)&((WINDOWPROC
*)0)->jmp
);
273 if (HeapValidate( WinProcHeap
, 0, proc
) && (proc
->magic
== WINPROC_MAGIC
))
275 /* Now it must be the thunk address */
276 proc
= (WINDOWPROC
*)(ptr
- (int)&((WINDOWPROC
*)0)->thunk
);
277 if (HeapValidate( WinProcHeap
, 0, proc
) && (proc
->magic
== WINPROC_MAGIC
))
280 /* Check for a segmented pointer */
282 if (!IsBadReadPtr16( (SEGPTR
)handle
, sizeof(proc
->thunk
) ))
284 ptr
= MapSL( (SEGPTR
)handle
);
285 /* It must be the thunk address */
286 proc
= (WINDOWPROC
*)(ptr
- (int)&((WINDOWPROC
*)0)->thunk
);
287 if (HeapValidate( WinProcHeap
, 0, proc
) && (proc
->magic
== WINPROC_MAGIC
))
295 /**********************************************************************
296 * WINPROC_AllocWinProc
298 * Allocate a new window procedure.
300 static WINDOWPROC
*WINPROC_AllocWinProc( WNDPROC16 func
, WINDOWPROCTYPE type
,
301 WINDOWPROCUSER user
)
303 WINDOWPROC
*proc
, *oldproc
;
305 /* Allocate a window procedure */
307 if (!(proc
= HeapAlloc( WinProcHeap
, 0, sizeof(WINDOWPROC
) ))) return 0;
309 /* Check if the function is already a win proc */
311 if ((oldproc
= WINPROC_GetPtr( func
)))
320 proc
->thunk
.t_from32
.popl_eax
= 0x58; /* popl %eax */
321 proc
->thunk
.t_from32
.pushl_func
= 0x68; /* pushl $proc */
322 proc
->thunk
.t_from32
.proc
= func
;
323 proc
->thunk
.t_from32
.pushl_eax
= 0x50; /* pushl %eax */
324 proc
->thunk
.t_from32
.jmp
= 0xe9; /* jmp relay*/
325 proc
->thunk
.t_from32
.relay
= /* relative jump */
326 (void(*)())((DWORD
)WINPROC_CallProc32ATo16
-
327 (DWORD
)(&proc
->thunk
.t_from32
.relay
+ 1));
331 proc
->thunk
.t_from16
.pushw_bp
= 0x5566; /* pushw %bp */
332 proc
->thunk
.t_from16
.pushl_func
= 0x68; /* pushl $proc */
333 proc
->thunk
.t_from16
.proc
= (WNDPROC
)func
;
334 proc
->thunk
.t_from16
.pushw_ax
= 0x5066; /* pushw %ax */
335 proc
->thunk
.t_from16
.pushl_relay
= 0x68; /* pushl $relay */
336 proc
->thunk
.t_from16
.relay
= (type
== WIN_PROC_32A
) ?
337 (void(*)())WINPROC_Thunk16To32A
:
338 (void(*)())WINPROC_Thunk16To32W
;
339 proc
->thunk
.t_from16
.lcall
= 0x9a; /* lcall cs:glue */
340 proc
->thunk
.t_from16
.glue
= (void*)__wine_call_from_16_long
;
341 proc
->thunk
.t_from16
.cs
= __get_cs();
342 proc
->thunk
.t_from16
.lret
= 0xca66;
343 proc
->thunk
.t_from16
.nArgs
= 10;
344 proc
->jmp
.jmp
= 0xe9;
345 /* Fixup relative jump */
346 proc
->jmp
.proc
= (WNDPROC
)((DWORD
)func
-
347 (DWORD
)(&proc
->jmp
.proc
+ 1));
350 /* Should not happen */
353 proc
->magic
= WINPROC_MAGIC
;
358 TRACE_(win
)("(%08x,%d): returning %08x\n",
359 (UINT
)func
, type
, (UINT
)proc
);
364 /**********************************************************************
367 * Get a window procedure pointer that can be passed to the Windows program.
369 WNDPROC16
WINPROC_GetProc( HWINDOWPROC proc
, WINDOWPROCTYPE type
)
371 if (!proc
) return NULL
;
372 if (type
== WIN_PROC_16
) /* We want a 16:16 address */
374 if (((WINDOWPROC
*)proc
)->type
== WIN_PROC_16
)
375 return ((WINDOWPROC
*)proc
)->thunk
.t_from32
.proc
;
377 return (WNDPROC16
)HEAP_GetSegptr( WinProcHeap
, 0,
378 &((WINDOWPROC
*)proc
)->thunk
);
380 else /* We want a 32-bit address */
382 if (((WINDOWPROC
*)proc
)->type
== WIN_PROC_16
)
383 return (WNDPROC16
)&((WINDOWPROC
*)proc
)->thunk
;
384 else if (type
!= ((WINDOWPROC
*)proc
)->type
)
385 /* Have to return the jmp address if types don't match */
386 return (WNDPROC16
)&((WINDOWPROC
*)proc
)->jmp
;
388 /* Some Win16 programs want to get back the proc they set */
389 return (WNDPROC16
)((WINDOWPROC
*)proc
)->thunk
.t_from16
.proc
;
394 /**********************************************************************
397 * Set the window procedure for a window or class. There are
398 * three tree classes of winproc callbacks:
400 * 1) class -> wp - not subclassed
401 * class -> wp -> wp -> wp -> wp - SetClassLong()
403 * 2) window -' / - not subclassed
404 * window -> wp -> wp ' - SetWindowLong()
406 * 3) timer -> wp - SetTimer()
408 * Initially, winproc of the window points to the current winproc
409 * thunk of its class. Subclassing prepends a new thunk to the
410 * window winproc chain at the head of the list. Thus, window thunk
411 * list includes class thunks and the latter are preserved when the
412 * window is destroyed.
415 BOOL
WINPROC_SetProc( HWINDOWPROC
*pFirst
, WNDPROC16 func
,
416 WINDOWPROCTYPE type
, WINDOWPROCUSER user
)
418 BOOL bRecycle
= FALSE
;
419 WINDOWPROC
*proc
, **ppPrev
;
421 /* Check if function is already in the list */
423 ppPrev
= (WINDOWPROC
**)pFirst
;
424 proc
= WINPROC_GetPtr( func
);
431 if ((*ppPrev
)->user
!= user
)
433 /* terminal thunk is being restored */
435 WINPROC_FreeProc( *pFirst
, (*ppPrev
)->user
);
436 *(WINDOWPROC
**)pFirst
= *ppPrev
;
445 if (((*ppPrev
)->type
== type
) &&
446 (func
== WINPROC_THUNKPROC(*ppPrev
)))
453 /* WPF_CLASS thunk terminates window thunk list */
454 if ((*ppPrev
)->user
!= user
) break;
455 ppPrev
= &(*ppPrev
)->next
;
460 /* Extract this thunk from the list */
462 *ppPrev
= proc
->next
;
464 else /* Allocate a new one */
466 if (proc
) /* Was already a win proc */
469 func
= WINPROC_THUNKPROC(proc
);
471 proc
= WINPROC_AllocWinProc( func
, type
, user
);
472 if (!proc
) return FALSE
;
475 /* Add the win proc at the head of the list */
477 TRACE_(win
)("(%08x,%08x,%d): res=%08x\n",
478 (UINT
)*pFirst
, (UINT
)func
, type
, (UINT
)proc
);
479 proc
->next
= *(WINDOWPROC
**)pFirst
;
480 *(WINDOWPROC
**)pFirst
= proc
;
485 /**********************************************************************
488 * Free a list of win procs.
490 void WINPROC_FreeProc( HWINDOWPROC proc
, WINDOWPROCUSER user
)
494 WINDOWPROC
*next
= ((WINDOWPROC
*)proc
)->next
;
495 if (((WINDOWPROC
*)proc
)->user
!= user
) break;
496 TRACE_(win
)("freeing %08x\n", (UINT
)proc
);
497 HeapFree( WinProcHeap
, 0, proc
);
503 /**********************************************************************
504 * WINPROC_GetProcType
506 * Return the window procedure type.
508 WINDOWPROCTYPE
WINPROC_GetProcType( HWINDOWPROC proc
)
511 (((WINDOWPROC
*)proc
)->magic
!= WINPROC_MAGIC
))
512 return WIN_PROC_INVALID
;
513 return ((WINDOWPROC
*)proc
)->type
;
515 /**********************************************************************
516 * WINPROC_TestCBForStr
518 * Return TRUE if the lparam is a string
520 inline static BOOL
WINPROC_TestCBForStr( HWND hwnd
)
522 DWORD style
= GetWindowLongA( hwnd
, GWL_STYLE
);
523 return (!(style
& (CBS_OWNERDRAWFIXED
| CBS_OWNERDRAWVARIABLE
)) || (style
& CBS_HASSTRINGS
));
525 /**********************************************************************
526 * WINPROC_TestLBForStr
528 * Return TRUE if the lparam is a string
530 inline static BOOL
WINPROC_TestLBForStr( HWND hwnd
)
532 DWORD style
= GetWindowLongA( hwnd
, GWL_STYLE
);
533 return (!(style
& (LBS_OWNERDRAWFIXED
| LBS_OWNERDRAWVARIABLE
)) || (style
& LBS_HASSTRINGS
));
536 /**********************************************************************
537 * WINPROC_MapMsg32ATo32W
539 * Map a message from Ansi to Unicode.
540 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
543 * WM_GETTEXT/WM_SETTEXT and static control with SS_ICON style:
544 * the first four bytes are the handle of the icon
545 * when the WM_SETTEXT message has been used to set the icon
547 INT
WINPROC_MapMsg32ATo32W( HWND hwnd
, UINT msg
, WPARAM
*pwparam
, LPARAM
*plparam
)
552 case WM_ASKCBFORMATNAME
:
554 LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0,
555 *pwparam
* sizeof(WCHAR
) + sizeof(LPARAM
) );
557 *ptr
++ = *plparam
; /* Store previous lParam */
558 *plparam
= (LPARAM
)ptr
;
561 /* lparam is string (0-terminated) */
563 case WM_WININICHANGE
:
564 case WM_DEVMODECHANGE
:
567 case CB_FINDSTRINGEXACT
:
568 case CB_SELECTSTRING
:
572 case LB_FINDSTRINGEXACT
:
573 case LB_SELECTSTRING
:
575 if(!*plparam
) return 0;
576 *plparam
= (LPARAM
)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR
)*plparam
);
577 return (*plparam
? 1 : -1);
578 case WM_GETTEXTLENGTH
:
579 case CB_GETLBTEXTLEN
:
581 return 1; /* need to map result */
586 { CREATESTRUCTW cs
; /* new structure */
587 LPCWSTR lpszName
; /* allocated Name */
588 LPCWSTR lpszClass
; /* allocated Class */
591 struct s
*xs
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(struct s
));
593 xs
->cs
= *(CREATESTRUCTW
*)*plparam
;
594 if (HIWORD(xs
->cs
.lpszName
))
595 xs
->lpszName
= xs
->cs
.lpszName
= HEAP_strdupAtoW( GetProcessHeap(), 0,
596 (LPCSTR
)xs
->cs
.lpszName
);
597 if (HIWORD(xs
->cs
.lpszClass
))
598 xs
->lpszClass
= xs
->cs
.lpszClass
= HEAP_strdupAtoW( GetProcessHeap(), 0,
599 (LPCSTR
)xs
->cs
.lpszClass
);
600 *plparam
= (LPARAM
)xs
;
605 MDICREATESTRUCTW
*cs
=
606 (MDICREATESTRUCTW
*)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) );
608 *cs
= *(MDICREATESTRUCTW
*)*plparam
;
609 if (HIWORD(cs
->szClass
))
610 cs
->szClass
= HEAP_strdupAtoW( GetProcessHeap(), 0,
611 (LPCSTR
)cs
->szClass
);
612 if (HIWORD(cs
->szTitle
))
613 cs
->szTitle
= HEAP_strdupAtoW( GetProcessHeap(), 0,
614 (LPCSTR
)cs
->szTitle
);
615 *plparam
= (LPARAM
)cs
;
621 case LB_INSERTSTRING
:
622 if(!*plparam
) return 0;
623 if ( WINPROC_TestLBForStr( hwnd
))
624 *plparam
= (LPARAM
)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR
)*plparam
);
625 return (*plparam
? 1 : -1);
627 case LB_GETTEXT
: /* fixme: fixed sized buffer */
628 { if ( WINPROC_TestLBForStr( hwnd
))
629 { LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR
) + sizeof(LPARAM
) );
631 *ptr
++ = *plparam
; /* Store previous lParam */
632 *plparam
= (LPARAM
)ptr
;
639 case CB_INSERTSTRING
:
640 if(!*plparam
) return 0;
641 if ( WINPROC_TestCBForStr( hwnd
))
642 *plparam
= (LPARAM
)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR
)*plparam
);
643 return (*plparam
? 1 : -1);
645 case CB_GETLBTEXT
: /* fixme: fixed sized buffer */
646 { if ( WINPROC_TestCBForStr( hwnd
))
647 { LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR
) + sizeof(LPARAM
) );
649 *ptr
++ = *plparam
; /* Store previous lParam */
650 *plparam
= (LPARAM
)ptr
;
657 { WORD len
= (WORD
)*plparam
;
658 LPARAM
*ptr
= (LPARAM
*) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM
) + sizeof (WORD
) + len
*sizeof(WCHAR
) );
660 *ptr
++ = *plparam
; /* Store previous lParam */
661 *((WORD
*) ptr
) = len
; /* Store the length */
662 *plparam
= (LPARAM
)ptr
;
672 case EM_SETPASSWORDCHAR
:
674 char ch
= LOWORD(*pwparam
);
676 MultiByteToWideChar(CP_ACP
, 0, &ch
, 1, &wch
, 1);
677 *pwparam
= MAKEWPARAM( wch
, HIWORD(*pwparam
) );
681 case WM_PAINTCLIPBOARD
:
682 case WM_SIZECLIPBOARD
:
683 FIXME_(msg
)("message %s (0x%x) needs translation, please report\n", SPY_GetMsgName(msg
), msg
);
685 default: /* No translation needed */
691 /**********************************************************************
692 * WINPROC_UnmapMsg32ATo32W
694 * Unmap a message that was mapped from Ansi to Unicode.
696 LRESULT
WINPROC_UnmapMsg32ATo32W( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
702 case WM_ASKCBFORMATNAME
:
704 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
705 if (wParam
> 0 && !WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1,
706 (LPSTR
)*ptr
, wParam
, NULL
, NULL
))
707 ((LPSTR
)*ptr
)[wParam
-1] = 0;
708 HeapFree( GetProcessHeap(), 0, ptr
);
711 case WM_GETTEXTLENGTH
:
712 case CB_GETLBTEXTLEN
:
714 /* there may be one DBCS char for each Unicode char */
720 { CREATESTRUCTW cs
; /* new structure */
721 LPWSTR lpszName
; /* allocated Name */
722 LPWSTR lpszClass
; /* allocated Class */
724 struct s
*xs
= (struct s
*)lParam
;
725 if (xs
->lpszName
) HeapFree( GetProcessHeap(), 0, xs
->lpszName
);
726 if (xs
->lpszClass
) HeapFree( GetProcessHeap(), 0, xs
->lpszClass
);
727 HeapFree( GetProcessHeap(), 0, xs
);
733 MDICREATESTRUCTW
*cs
= (MDICREATESTRUCTW
*)lParam
;
734 if (HIWORD(cs
->szTitle
))
735 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szTitle
);
736 if (HIWORD(cs
->szClass
))
737 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szClass
);
738 HeapFree( GetProcessHeap(), 0, cs
);
743 case WM_WININICHANGE
:
744 case WM_DEVMODECHANGE
:
747 case CB_FINDSTRINGEXACT
:
748 case CB_SELECTSTRING
:
752 case LB_FINDSTRINGEXACT
:
753 case LB_SELECTSTRING
:
755 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
760 case LB_INSERTSTRING
:
761 if ( WINPROC_TestLBForStr( hwnd
))
762 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
766 { if ( WINPROC_TestLBForStr( hwnd
))
767 { LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
768 WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1, (LPSTR
)*ptr
, 0x7fffffff, NULL
, NULL
);
769 HeapFree( GetProcessHeap(), 0, ptr
);
776 case CB_INSERTSTRING
:
777 if ( WINPROC_TestCBForStr( hwnd
))
778 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
782 { if ( WINPROC_TestCBForStr( hwnd
))
783 { LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
784 WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1, (LPSTR
)*ptr
, 0x7fffffff, NULL
, NULL
);
785 HeapFree( GetProcessHeap(), 0, ptr
);
792 { LPARAM
* ptr
= (LPARAM
*)lParam
- 1; /* get the old lParam */
793 WORD len
= *(WORD
*) lParam
;
794 if (len
> 0 && !WideCharToMultiByte( CP_ACP
, 0, (LPWSTR
)lParam
, -1,
795 (LPSTR
)*ptr
, len
, NULL
, NULL
))
796 ((LPSTR
)*ptr
)[len
-1] = 0;
797 HeapFree( GetProcessHeap(), 0, ptr
);
805 /**********************************************************************
806 * WINPROC_MapMsg32WTo32A
808 * Map a message from Unicode to Ansi.
809 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
811 INT
WINPROC_MapMsg32WTo32A( HWND hwnd
, UINT msg
, WPARAM
*pwparam
, LPARAM
*plparam
)
816 case WM_ASKCBFORMATNAME
:
818 LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0,
819 *pwparam
+ sizeof(LPARAM
) );
821 *ptr
++ = *plparam
; /* Store previous lParam */
822 *plparam
= (LPARAM
)ptr
;
827 case WM_WININICHANGE
:
828 case WM_DEVMODECHANGE
:
831 case CB_FINDSTRINGEXACT
:
832 case CB_SELECTSTRING
:
836 case LB_FINDSTRINGEXACT
:
837 case LB_SELECTSTRING
:
839 if(!*plparam
) return 0;
840 *plparam
= (LPARAM
)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR
)*plparam
);
841 return (*plparam
? 1 : -1);
846 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)HeapAlloc( GetProcessHeap(), 0,
849 *cs
= *(CREATESTRUCTA
*)*plparam
;
850 if (HIWORD(cs
->lpszName
))
851 cs
->lpszName
= HEAP_strdupWtoA( GetProcessHeap(), 0,
852 (LPCWSTR
)cs
->lpszName
);
853 if (HIWORD(cs
->lpszClass
))
854 cs
->lpszClass
= HEAP_strdupWtoA( GetProcessHeap(), 0,
855 (LPCWSTR
)cs
->lpszClass
);
856 *plparam
= (LPARAM
)cs
;
861 MDICREATESTRUCTA
*cs
=
862 (MDICREATESTRUCTA
*)HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) );
864 *cs
= *(MDICREATESTRUCTA
*)*plparam
;
865 if (HIWORD(cs
->szTitle
))
866 cs
->szTitle
= HEAP_strdupWtoA( GetProcessHeap(), 0,
867 (LPCWSTR
)cs
->szTitle
);
868 if (HIWORD(cs
->szClass
))
869 cs
->szClass
= HEAP_strdupWtoA( GetProcessHeap(), 0,
870 (LPCWSTR
)cs
->szClass
);
871 *plparam
= (LPARAM
)cs
;
877 case LB_INSERTSTRING
:
878 if(!*plparam
) return 0;
879 if ( WINPROC_TestLBForStr( hwnd
))
880 *plparam
= (LPARAM
)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR
)*plparam
);
881 return (*plparam
? 1 : -1);
883 case LB_GETTEXT
: /* fixme: fixed sized buffer */
884 { if ( WINPROC_TestLBForStr( hwnd
))
885 { LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM
) );
887 *ptr
++ = *plparam
; /* Store previous lParam */
888 *plparam
= (LPARAM
)ptr
;
895 case CB_INSERTSTRING
:
896 if(!*plparam
) return 0;
897 if ( WINPROC_TestCBForStr( hwnd
))
898 *plparam
= (LPARAM
)HEAP_strdupWtoA( GetProcessHeap(), 0, (LPCWSTR
)*plparam
);
899 return (*plparam
? 1 : -1);
901 case CB_GETLBTEXT
: /* fixme: fixed sized buffer */
902 { if ( WINPROC_TestCBForStr( hwnd
))
903 { LPARAM
*ptr
= (LPARAM
*)HeapAlloc( GetProcessHeap(), 0, 256 + sizeof(LPARAM
) );
905 *ptr
++ = *plparam
; /* Store previous lParam */
906 *plparam
= (LPARAM
)ptr
;
913 { WORD len
= (WORD
)*plparam
;
914 LPARAM
*ptr
= (LPARAM
*) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM
) + sizeof (WORD
) + len
*sizeof(CHAR
) );
916 *ptr
++ = *plparam
; /* Store previous lParam */
917 *((WORD
*) ptr
) = len
; /* Store the length */
918 *plparam
= (LPARAM
)ptr
;
928 case EM_SETPASSWORDCHAR
:
930 WCHAR wch
= LOWORD(*pwparam
);
932 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, &ch
, 1, NULL
, NULL
);
933 *pwparam
= MAKEWPARAM( ch
, HIWORD(*pwparam
) );
937 case WM_PAINTCLIPBOARD
:
938 case WM_SIZECLIPBOARD
:
939 FIXME_(msg
)("message %s (%04x) needs translation, please report\n",SPY_GetMsgName(msg
),msg
);
941 default: /* No translation needed */
947 /**********************************************************************
948 * WINPROC_UnmapMsg32WTo32A
950 * Unmap a message that was mapped from Unicode to Ansi.
952 void WINPROC_UnmapMsg32WTo32A( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
957 case WM_ASKCBFORMATNAME
:
959 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
962 if (!MultiByteToWideChar( CP_ACP
, 0, (LPSTR
)lParam
, -1, (LPWSTR
)*ptr
, wParam
))
963 ((LPWSTR
)*ptr
)[wParam
-1] = 0;
965 HeapFree( GetProcessHeap(), 0, ptr
);
970 case WM_WININICHANGE
:
971 case WM_DEVMODECHANGE
:
974 case CB_FINDSTRINGEXACT
:
975 case CB_SELECTSTRING
:
979 case LB_FINDSTRINGEXACT
:
980 case LB_SELECTSTRING
:
982 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
988 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)lParam
;
989 if (HIWORD(cs
->lpszName
))
990 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->lpszName
);
991 if (HIWORD(cs
->lpszClass
))
992 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->lpszClass
);
993 HeapFree( GetProcessHeap(), 0, cs
);
999 MDICREATESTRUCTA
*cs
= (MDICREATESTRUCTA
*)lParam
;
1000 if (HIWORD(cs
->szTitle
))
1001 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szTitle
);
1002 if (HIWORD(cs
->szClass
))
1003 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szClass
);
1004 HeapFree( GetProcessHeap(), 0, cs
);
1010 case LB_INSERTSTRING
:
1011 if ( WINPROC_TestLBForStr( hwnd
))
1012 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
1016 if ( WINPROC_TestLBForStr( hwnd
))
1018 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
1019 MultiByteToWideChar( CP_ACP
, 0, (LPSTR
)lParam
, -1, (LPWSTR
)*ptr
, 0x7fffffff );
1020 HeapFree( GetProcessHeap(), 0, ptr
);
1026 case CB_INSERTSTRING
:
1027 if ( WINPROC_TestCBForStr( hwnd
))
1028 HeapFree( GetProcessHeap(), 0, (void *)lParam
);
1032 if ( WINPROC_TestCBForStr( hwnd
))
1034 LPARAM
*ptr
= (LPARAM
*)lParam
- 1;
1035 MultiByteToWideChar( CP_ACP
, 0, (LPSTR
)lParam
, -1, (LPWSTR
)*ptr
, 0x7fffffff );
1036 HeapFree( GetProcessHeap(), 0, ptr
);
1040 /* Multiline edit */
1042 { LPARAM
* ptr
= (LPARAM
*)lParam
- 1; /* get the old lparam */
1043 WORD len
= *(WORD
*)ptr
;
1046 if (!MultiByteToWideChar( CP_ACP
, 0, (LPSTR
)lParam
, -1, (LPWSTR
)*ptr
, len
))
1047 ((LPWSTR
)*ptr
)[len
-1] = 0;
1049 HeapFree( GetProcessHeap(), 0, ptr
);
1056 /**********************************************************************
1057 * WINPROC_MapMsg16To32A
1059 * Map a message from 16- to 32-bit Ansi.
1060 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
1062 INT
WINPROC_MapMsg16To32A( UINT16 msg16
, WPARAM16 wParam16
, UINT
*pmsg32
,
1063 WPARAM
*pwparam32
, LPARAM
*plparam
)
1065 *pmsg32
= (UINT
)msg16
;
1066 *pwparam32
= (WPARAM
)wParam16
;
1073 *pwparam32
= MAKEWPARAM( wParam16
, HIWORD(*plparam
) );
1074 *plparam
= (LPARAM
)(HWND
)LOWORD(*plparam
);
1078 *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
1079 *plparam
= (LPARAM
)(HWND
)HIWORD(*plparam
);
1082 if ( HIWORD(*plparam
) > CTLCOLOR_STATIC
) return -1;
1083 *pmsg32
= WM_CTLCOLORMSGBOX
+ HIWORD(*plparam
);
1084 *pwparam32
= (WPARAM
)(HDC
)wParam16
;
1085 *plparam
= (LPARAM
)(HWND
)LOWORD(*plparam
);
1087 case WM_COMPAREITEM
:
1089 COMPAREITEMSTRUCT16
* cis16
= MapSL(*plparam
);
1090 COMPAREITEMSTRUCT
*cis
= (COMPAREITEMSTRUCT
*)
1091 HeapAlloc(GetProcessHeap(), 0, sizeof(*cis
));
1092 if (!cis
) return -1;
1093 cis
->CtlType
= cis16
->CtlType
;
1094 cis
->CtlID
= cis16
->CtlID
;
1095 cis
->hwndItem
= cis16
->hwndItem
;
1096 cis
->itemID1
= cis16
->itemID1
;
1097 cis
->itemData1
= cis16
->itemData1
;
1098 cis
->itemID2
= cis16
->itemID2
;
1099 cis
->itemData2
= cis16
->itemData2
;
1100 cis
->dwLocaleId
= 0; /* FIXME */
1101 *plparam
= (LPARAM
)cis
;
1106 DELETEITEMSTRUCT16
* dis16
= MapSL(*plparam
);
1107 DELETEITEMSTRUCT
*dis
= (DELETEITEMSTRUCT
*)
1108 HeapAlloc(GetProcessHeap(), 0, sizeof(*dis
));
1109 if (!dis
) return -1;
1110 dis
->CtlType
= dis16
->CtlType
;
1111 dis
->CtlID
= dis16
->CtlID
;
1112 dis
->hwndItem
= dis16
->hwndItem
;
1113 dis
->itemData
= dis16
->itemData
;
1114 *plparam
= (LPARAM
)dis
;
1117 case WM_MEASUREITEM
:
1119 MEASUREITEMSTRUCT16
* mis16
= MapSL(*plparam
);
1120 MEASUREITEMSTRUCT
*mis
= (MEASUREITEMSTRUCT
*)
1121 HeapAlloc(GetProcessHeap(), 0,
1122 sizeof(*mis
) + sizeof(LPARAM
));
1123 if (!mis
) return -1;
1124 mis
->CtlType
= mis16
->CtlType
;
1125 mis
->CtlID
= mis16
->CtlID
;
1126 mis
->itemID
= mis16
->itemID
;
1127 mis
->itemWidth
= mis16
->itemWidth
;
1128 mis
->itemHeight
= mis16
->itemHeight
;
1129 mis
->itemData
= mis16
->itemData
;
1130 *(LPARAM
*)(mis
+ 1) = *plparam
; /* Store the previous lParam */
1131 *plparam
= (LPARAM
)mis
;
1136 DRAWITEMSTRUCT16
* dis16
= MapSL(*plparam
);
1137 DRAWITEMSTRUCT
*dis
= (DRAWITEMSTRUCT
*)HeapAlloc(GetProcessHeap(), 0,
1139 if (!dis
) return -1;
1140 dis
->CtlType
= dis16
->CtlType
;
1141 dis
->CtlID
= dis16
->CtlID
;
1142 dis
->itemID
= dis16
->itemID
;
1143 dis
->itemAction
= dis16
->itemAction
;
1144 dis
->itemState
= dis16
->itemState
;
1145 dis
->hwndItem
= dis16
->hwndItem
;
1146 dis
->hDC
= dis16
->hDC
;
1147 dis
->itemData
= dis16
->itemData
;
1148 CONV_RECT16TO32( &dis16
->rcItem
, &dis
->rcItem
);
1149 *plparam
= (LPARAM
)dis
;
1152 case WM_GETMINMAXINFO
:
1154 MINMAXINFO
*mmi
= (MINMAXINFO
*)HeapAlloc( GetProcessHeap(), 0,
1155 sizeof(*mmi
) + sizeof(LPARAM
));
1156 if (!mmi
) return -1;
1157 STRUCT32_MINMAXINFO16to32( MapSL(*plparam
), mmi
);
1158 *(LPARAM
*)(mmi
+ 1) = *plparam
; /* Store the previous lParam */
1159 *plparam
= (LPARAM
)mmi
;
1164 case WM_WININICHANGE
:
1165 case WM_DEVMODECHANGE
:
1166 case WM_ASKCBFORMATNAME
:
1167 *plparam
= (LPARAM
)MapSL(*plparam
);
1171 MDICREATESTRUCT16
*cs16
= MapSL(*plparam
);
1172 MDICREATESTRUCTA
*cs
= HeapAlloc( GetProcessHeap(), 0, sizeof(*cs
) + sizeof(LPARAM
) );
1174 STRUCT32_MDICREATESTRUCT16to32A( cs16
, cs
);
1175 cs
->szTitle
= MapSL(cs16
->szTitle
);
1176 cs
->szClass
= MapSL(cs16
->szClass
);
1177 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1178 *plparam
= (LPARAM
)cs
;
1181 case WM_MDIGETACTIVE
:
1182 *plparam
= (LPARAM
)HeapAlloc( GetProcessHeap(), 0, sizeof(BOOL
) );
1183 *(BOOL
*)(*plparam
) = 0;
1187 *pmsg32
=WM_MDIREFRESHMENU
;
1188 *pwparam32
= (WPARAM
)(HMENU
)LOWORD(*plparam
);
1189 *plparam
= (LPARAM
)(HMENU
)HIWORD(*plparam
);
1192 *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
1193 *plparam
= (LPARAM
)(HMENU
)HIWORD(*plparam
);
1196 if((LOWORD(*plparam
) & MF_POPUP
) && (LOWORD(*plparam
) != 0xFFFF))
1198 HMENU hmenu
=(HMENU
)HIWORD(*plparam
);
1199 UINT Pos
=MENU_FindSubMenu( &hmenu
, wParam16
);
1200 if(Pos
==0xFFFF) Pos
=0; /* NO_SELECTED_ITEM */
1201 *pwparam32
= MAKEWPARAM( Pos
, LOWORD(*plparam
) );
1203 else *pwparam32
= MAKEWPARAM( wParam16
, LOWORD(*plparam
) );
1204 *plparam
= (LPARAM
)(HMENU
)HIWORD(*plparam
);
1206 case WM_MDIACTIVATE
:
1209 *pwparam32
= (WPARAM
)(HWND
)HIWORD(*plparam
);
1210 *plparam
= (LPARAM
)(HWND
)LOWORD(*plparam
);
1212 else /* message sent to MDI client */
1213 *pwparam32
= wParam16
;
1217 NCCALCSIZE_PARAMS16
*nc16
;
1218 NCCALCSIZE_PARAMS
*nc
;
1220 nc
= (NCCALCSIZE_PARAMS
*)HeapAlloc( GetProcessHeap(), 0,
1221 sizeof(*nc
) + sizeof(LPARAM
) );
1223 nc16
= MapSL(*plparam
);
1224 CONV_RECT16TO32( &nc16
->rgrc
[0], &nc
->rgrc
[0] );
1227 nc
->lppos
= (WINDOWPOS
*)HeapAlloc( GetProcessHeap(), 0,
1228 sizeof(*nc
->lppos
) );
1229 CONV_RECT16TO32( &nc16
->rgrc
[1], &nc
->rgrc
[1] );
1230 CONV_RECT16TO32( &nc16
->rgrc
[2], &nc
->rgrc
[2] );
1231 if (nc
->lppos
) STRUCT32_WINDOWPOS16to32( MapSL(nc16
->lppos
), nc
->lppos
);
1233 *(LPARAM
*)(nc
+ 1) = *plparam
; /* Store the previous lParam */
1234 *plparam
= (LPARAM
)nc
;
1240 CREATESTRUCT16
*cs16
= MapSL(*plparam
);
1241 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)HeapAlloc( GetProcessHeap(), 0,
1242 sizeof(*cs
) + sizeof(LPARAM
) );
1244 STRUCT32_CREATESTRUCT16to32A( cs16
, cs
);
1245 cs
->lpszName
= MapSL(cs16
->lpszName
);
1246 cs
->lpszClass
= MapSL(cs16
->lpszClass
);
1247 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1248 *plparam
= (LPARAM
)cs
;
1251 case WM_PARENTNOTIFY
:
1252 if ((wParam16
== WM_CREATE
) || (wParam16
== WM_DESTROY
))
1254 *pwparam32
= MAKEWPARAM( wParam16
, HIWORD(*plparam
) );
1255 *plparam
= (LPARAM
)(HWND
)LOWORD(*plparam
);
1258 case WM_WINDOWPOSCHANGING
:
1259 case WM_WINDOWPOSCHANGED
:
1261 WINDOWPOS
*wp
= (WINDOWPOS
*)HeapAlloc( GetProcessHeap(), 0,
1262 sizeof(*wp
) + sizeof(LPARAM
) );
1264 STRUCT32_WINDOWPOS16to32( MapSL(*plparam
), wp
);
1265 *(LPARAM
*)(wp
+ 1) = *plparam
; /* Store the previous lParam */
1266 *plparam
= (LPARAM
)wp
;
1272 LPMSG16 msg16
= MapSL(*plparam
);
1273 LPMSG msg32
= (LPMSG
)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG
) );
1275 if (!msg32
) return -1;
1276 msg32
->hwnd
= msg16
->hwnd
;
1277 msg32
->lParam
= msg16
->lParam
;
1278 msg32
->time
= msg16
->time
;
1279 CONV_POINT16TO32(&msg16
->pt
,&msg32
->pt
);
1280 /* this is right, right? */
1281 if (WINPROC_MapMsg16To32A(msg16
->message
,msg16
->wParam
,
1282 &msg32
->message
,&msg32
->wParam
,
1283 &msg32
->lParam
)<0) {
1284 HeapFree( GetProcessHeap(), 0, msg32
);
1287 *plparam
= (LPARAM
)msg32
;
1292 *plparam
= (LPARAM
)MapSL(*plparam
);
1294 case WM_ACTIVATEAPP
:
1296 { /* We need this when SetActiveWindow sends a Sendmessage16() to
1297 a 32bit window. Might be superflous with 32bit interprocess
1300 HTASK16 htask
= (HTASK16
) *plparam
;
1301 DWORD idThread
= (DWORD
)TASK_GetPtr(htask
)->teb
->tid
;
1302 *plparam
= (LPARAM
) idThread
;
1307 MDINEXTMENU
*next
= HeapAlloc( GetProcessHeap(), 0, sizeof(*next
) );
1308 if (!next
) return -1;
1309 next
->hmenuIn
= *plparam
;
1310 next
->hmenuNext
= 0;
1312 *plparam
= (LPARAM
)next
;
1315 case WM_PAINTCLIPBOARD
:
1316 case WM_SIZECLIPBOARD
:
1317 FIXME_(msg
)("message %04x needs translation\n",msg16
);
1320 default: /* No translation needed */
1326 /**********************************************************************
1327 * WINPROC_UnmapMsg16To32A
1329 * Unmap a message that was mapped from 16- to 32-bit Ansi.
1331 LRESULT
WINPROC_UnmapMsg16To32A( HWND16 hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
1336 case WM_COMPAREITEM
:
1339 HeapFree( GetProcessHeap(), 0, (LPVOID
)lParam
);
1341 case WM_MEASUREITEM
:
1343 MEASUREITEMSTRUCT16
*mis16
;
1344 MEASUREITEMSTRUCT
*mis
= (MEASUREITEMSTRUCT
*)lParam
;
1345 lParam
= *(LPARAM
*)(mis
+ 1);
1346 mis16
= MapSL(lParam
);
1347 mis16
->itemWidth
= (UINT16
)mis
->itemWidth
;
1348 mis16
->itemHeight
= (UINT16
)mis
->itemHeight
;
1349 HeapFree( GetProcessHeap(), 0, mis
);
1352 case WM_GETMINMAXINFO
:
1354 MINMAXINFO
*mmi
= (MINMAXINFO
*)lParam
;
1355 lParam
= *(LPARAM
*)(mmi
+ 1);
1356 STRUCT32_MINMAXINFO32to16( mmi
, MapSL(lParam
));
1357 HeapFree( GetProcessHeap(), 0, mmi
);
1362 MDICREATESTRUCTA
*cs
= (MDICREATESTRUCTA
*)lParam
;
1363 lParam
= *(LPARAM
*)(cs
+ 1);
1364 STRUCT32_MDICREATESTRUCT32Ato16( cs
, MapSL(lParam
) );
1365 HeapFree( GetProcessHeap(), 0, cs
);
1368 case WM_MDIGETACTIVE
:
1369 result
= MAKELONG( LOWORD(result
), (BOOL16
)(*(BOOL
*)lParam
) );
1370 HeapFree( GetProcessHeap(), 0, (BOOL
*)lParam
);
1374 NCCALCSIZE_PARAMS16
*nc16
;
1375 NCCALCSIZE_PARAMS
*nc
= (NCCALCSIZE_PARAMS
*)lParam
;
1376 lParam
= *(LPARAM
*)(nc
+ 1);
1377 nc16
= MapSL(lParam
);
1378 CONV_RECT32TO16( &nc
->rgrc
[0], &nc16
->rgrc
[0] );
1381 CONV_RECT32TO16( &nc
->rgrc
[1], &nc16
->rgrc
[1] );
1382 CONV_RECT32TO16( &nc
->rgrc
[2], &nc16
->rgrc
[2] );
1385 STRUCT32_WINDOWPOS32to16( nc
->lppos
, MapSL(nc16
->lppos
));
1386 HeapFree( GetProcessHeap(), 0, nc
->lppos
);
1389 HeapFree( GetProcessHeap(), 0, nc
);
1395 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)lParam
;
1396 lParam
= *(LPARAM
*)(cs
+ 1);
1397 STRUCT32_CREATESTRUCT32Ato16( cs
, MapSL(lParam
) );
1398 HeapFree( GetProcessHeap(), 0, cs
);
1401 case WM_WINDOWPOSCHANGING
:
1402 case WM_WINDOWPOSCHANGED
:
1404 WINDOWPOS
*wp
= (WINDOWPOS
*)lParam
;
1405 lParam
= *(LPARAM
*)(wp
+ 1);
1406 STRUCT32_WINDOWPOS32to16(wp
, MapSL(lParam
));
1407 HeapFree( GetProcessHeap(), 0, wp
);
1413 LPMSG msg32
= (LPMSG
)lParam
;
1415 WINPROC_UnmapMsg16To32A( hwnd
, msg32
->message
, msg32
->wParam
, msg32
->lParam
,
1417 HeapFree( GetProcessHeap(), 0, msg32
);
1422 MDINEXTMENU
*next
= (MDINEXTMENU
*)lParam
;
1423 result
= MAKELONG( next
->hmenuNext
, next
->hwndNext
);
1424 HeapFree( GetProcessHeap(), 0, next
);
1432 /**********************************************************************
1433 * WINPROC_MapMsg16To32W
1435 * Map a message from 16- to 32-bit Unicode.
1436 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
1438 INT
WINPROC_MapMsg16To32W( HWND16 hwnd
, UINT16 msg16
, WPARAM16 wParam16
, UINT
*pmsg32
,
1439 WPARAM
*pwparam32
, LPARAM
*plparam
)
1444 *pmsg32
=(UINT
)msg16
;
1445 *pwparam32
= (WPARAM
)wParam16
;
1450 case WM_WININICHANGE
:
1451 case WM_DEVMODECHANGE
:
1452 case WM_ASKCBFORMATNAME
:
1453 *plparam
= (LPARAM
)MapSL(*plparam
);
1454 return WINPROC_MapMsg32ATo32W( hwnd
, *pmsg32
, pwparam32
, plparam
);
1455 case WM_GETTEXTLENGTH
:
1456 case CB_GETLBTEXTLEN
:
1458 return 1; /* need to map result */
1462 CREATESTRUCT16
*cs16
= MapSL(*plparam
);
1463 CREATESTRUCTW
*cs
= (CREATESTRUCTW
*)HeapAlloc( GetProcessHeap(), 0,
1464 sizeof(*cs
) + sizeof(LPARAM
) );
1466 STRUCT32_CREATESTRUCT16to32A( cs16
, (CREATESTRUCTA
*)cs
);
1467 cs
->lpszName
= MapSL(cs16
->lpszName
);
1468 cs
->lpszClass
= MapSL(cs16
->lpszClass
);
1469 if (HIWORD(cs
->lpszName
))
1470 cs
->lpszName
= HEAP_strdupAtoW( GetProcessHeap(), 0,
1471 (LPCSTR
)cs
->lpszName
);
1472 if (HIWORD(cs
->lpszClass
))
1473 cs
->lpszClass
= HEAP_strdupAtoW( GetProcessHeap(), 0,
1474 (LPCSTR
)cs
->lpszClass
);
1475 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1476 *plparam
= (LPARAM
)cs
;
1481 MDICREATESTRUCT16
*cs16
= MapSL(*plparam
);
1482 MDICREATESTRUCTW
*cs
=
1483 (MDICREATESTRUCTW
*)HeapAlloc( GetProcessHeap(), 0,
1484 sizeof(*cs
) + sizeof(LPARAM
) );
1486 STRUCT32_MDICREATESTRUCT16to32A( cs16
, (MDICREATESTRUCTA
*)cs
);
1487 cs
->szTitle
= MapSL(cs16
->szTitle
);
1488 cs
->szClass
= MapSL(cs16
->szClass
);
1489 if (HIWORD(cs
->szTitle
))
1490 cs
->szTitle
= HEAP_strdupAtoW( GetProcessHeap(), 0,
1491 (LPCSTR
)cs
->szTitle
);
1492 if (HIWORD(cs
->szClass
))
1493 cs
->szClass
= HEAP_strdupAtoW( GetProcessHeap(), 0,
1494 (LPCSTR
)cs
->szClass
);
1495 *(LPARAM
*)(cs
+ 1) = *plparam
; /* Store the previous lParam */
1496 *plparam
= (LPARAM
)cs
;
1502 LPMSG16 msg16
= MapSL(*plparam
);
1503 LPMSG msg32
= (LPMSG
)HeapAlloc( GetProcessHeap(), 0, sizeof(MSG
) );
1505 if (!msg32
) return -1;
1506 msg32
->hwnd
= msg16
->hwnd
;
1507 msg32
->lParam
= msg16
->lParam
;
1508 msg32
->time
= msg16
->time
;
1509 CONV_POINT16TO32(&msg16
->pt
,&msg32
->pt
);
1510 /* this is right, right? */
1511 if (WINPROC_MapMsg16To32W(hwnd
, msg16
->message
,msg16
->wParam
,
1512 &msg32
->message
,&msg32
->wParam
,
1513 &msg32
->lParam
)<0) {
1514 HeapFree( GetProcessHeap(), 0, msg32
);
1517 *plparam
= (LPARAM
)msg32
;
1524 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1525 *pwparam32
= MAKEWPARAM( wch
, HIWORD(*plparam
) );
1526 *plparam
= (LPARAM
)(HWND
)LOWORD(*plparam
);
1530 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1531 *pwparam32
= MAKEWPARAM( wch
, LOWORD(*plparam
) );
1532 *plparam
= (LPARAM
)(HMENU
)HIWORD(*plparam
);
1537 case WM_SYSDEADCHAR
:
1539 MultiByteToWideChar( CP_ACP
, 0, &ch
, 1, &wch
, 1);
1543 default: /* No Unicode translation needed */
1544 return WINPROC_MapMsg16To32A( msg16
, wParam16
, pmsg32
,
1545 pwparam32
, plparam
);
1550 /**********************************************************************
1551 * WINPROC_UnmapMsg16To32W
1553 * Unmap a message that was mapped from 16- to 32-bit Unicode.
1555 LRESULT
WINPROC_UnmapMsg16To32W( HWND16 hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
1562 case WM_GETTEXTLENGTH
:
1563 case CB_GETLBTEXTLEN
:
1565 case WM_ASKCBFORMATNAME
:
1566 return WINPROC_UnmapMsg32ATo32W( hwnd
, msg
, wParam
, lParam
, result
);
1570 CREATESTRUCTW
*cs
= (CREATESTRUCTW
*)lParam
;
1571 lParam
= *(LPARAM
*)(cs
+ 1);
1572 STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA
*)cs
, MapSL(lParam
) );
1573 if (HIWORD(cs
->lpszName
))
1574 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->lpszName
);
1575 if (HIWORD(cs
->lpszClass
))
1576 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->lpszClass
);
1577 HeapFree( GetProcessHeap(), 0, cs
);
1582 MDICREATESTRUCTW
*cs
= (MDICREATESTRUCTW
*)lParam
;
1583 lParam
= *(LPARAM
*)(cs
+ 1);
1584 STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA
*)cs
, MapSL(lParam
) );
1585 if (HIWORD(cs
->szTitle
))
1586 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szTitle
);
1587 if (HIWORD(cs
->szClass
))
1588 HeapFree( GetProcessHeap(), 0, (LPVOID
)cs
->szClass
);
1589 HeapFree( GetProcessHeap(), 0, cs
);
1595 LPMSG msg32
= (LPMSG
)lParam
;
1597 WINPROC_UnmapMsg16To32W( hwnd
, msg32
->message
, msg32
->wParam
, msg32
->lParam
,
1599 HeapFree( GetProcessHeap(), 0, msg32
);
1603 return WINPROC_UnmapMsg16To32A( hwnd
, msg
, wParam
, lParam
, result
);
1609 /**********************************************************************
1610 * WINPROC_MapMsg32ATo16
1612 * Map a message from 32-bit Ansi to 16-bit.
1613 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
1615 INT
WINPROC_MapMsg32ATo16( HWND hwnd
, UINT msg32
, WPARAM wParam32
,
1616 UINT16
*pmsg16
, WPARAM16
*pwparam16
,
1619 *pmsg16
= (UINT16
)msg32
;
1620 *pwparam16
= (WPARAM16
)LOWORD(wParam32
);
1628 *pmsg16
= (UINT16
)msg32
+ (BM_GETCHECK16
- BM_GETCHECK
);
1637 case EM_SCROLLCARET
:
1640 case EM_GETLINECOUNT
:
1652 case EM_LINEFROMCHAR
:
1653 case EM_SETTABSTOPS
:
1654 case EM_SETPASSWORDCHAR
:
1655 case EM_EMPTYUNDOBUFFER
:
1656 case EM_GETFIRSTVISIBLELINE
:
1657 case EM_SETREADONLY
:
1658 case EM_SETWORDBREAKPROC
:
1659 case EM_GETWORDBREAKPROC
:
1660 case EM_GETPASSWORDCHAR
:
1661 *pmsg16
= (UINT16
)msg32
+ (EM_GETSEL16
- EM_GETSEL
);
1666 case LB_DELETESTRING
:
1667 case LB_GETANCHORINDEX
:
1668 case LB_GETCARETINDEX
:
1671 case LB_GETHORIZONTALEXTENT
:
1672 case LB_GETITEMDATA
:
1673 case LB_GETITEMHEIGHT
:
1675 case LB_GETSELCOUNT
:
1677 case LB_GETTOPINDEX
:
1678 case LB_RESETCONTENT
:
1679 case LB_SELITEMRANGE
:
1680 case LB_SELITEMRANGEEX
:
1681 case LB_SETANCHORINDEX
:
1682 case LB_SETCARETINDEX
:
1683 case LB_SETCOLUMNWIDTH
:
1685 case LB_SETHORIZONTALEXTENT
:
1686 case LB_SETITEMDATA
:
1687 case LB_SETITEMHEIGHT
:
1689 case LB_SETTOPINDEX
:
1690 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
1692 case CB_DELETESTRING
:
1694 case CB_GETLBTEXTLEN
:
1696 case CB_RESETCONTENT
:
1700 case CB_SHOWDROPDOWN
:
1701 case CB_SETITEMDATA
:
1702 case CB_SETITEMHEIGHT
:
1703 case CB_GETITEMHEIGHT
:
1704 case CB_SETEXTENDEDUI
:
1705 case CB_GETEXTENDEDUI
:
1706 case CB_GETDROPPEDSTATE
:
1707 *pmsg16
= (UINT16
)msg32
+ (CB_GETEDITSEL16
- CB_GETEDITSEL
);
1710 *pmsg16
= CB_GETEDITSEL16
;
1715 case LB_FINDSTRINGEXACT
:
1716 case LB_INSERTSTRING
:
1717 case LB_SELECTSTRING
:
1721 LPSTR str
= SEGPTR_STRDUP( (LPSTR
)*plparam
);
1722 if (!str
) return -1;
1723 *plparam
= (LPARAM
)SEGPTR_GET(str
);
1725 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
1730 case CB_FINDSTRINGEXACT
:
1731 case CB_INSERTSTRING
:
1732 case CB_SELECTSTRING
:
1735 LPSTR str
= SEGPTR_STRDUP( (LPSTR
)*plparam
);
1736 if (!str
) return -1;
1737 *plparam
= (LPARAM
)SEGPTR_GET(str
);
1739 *pmsg16
= (UINT16
)msg32
+ (CB_GETEDITSEL16
- CB_GETEDITSEL
);
1742 case LB_GETITEMRECT
:
1745 rect
= (RECT16
*)SEGPTR_ALLOC( sizeof(RECT16
) + sizeof(LPARAM
) );
1746 if (!rect
) return -1;
1747 *(LPARAM
*)(rect
+ 1) = *plparam
; /* Store the previous lParam */
1748 *plparam
= (LPARAM
)SEGPTR_GET(rect
);
1750 *pmsg16
= LB_GETITEMRECT16
;
1752 case LB_GETSELITEMS
:
1755 *pwparam16
= (WPARAM16
)min( wParam32
, 0x7f80 ); /* Must be < 64K */
1756 if (!(items
= SEGPTR_ALLOC( *pwparam16
* sizeof(INT16
)
1757 + sizeof(LPARAM
)))) return -1;
1758 *((LPARAM
*)items
)++ = *plparam
; /* Store the previous lParam */
1759 *plparam
= (LPARAM
)SEGPTR_GET(items
);
1761 *pmsg16
= LB_GETSELITEMS16
;
1763 case LB_SETTABSTOPS
:
1768 *pwparam16
= (WPARAM16
)min( wParam32
, 0x7f80 ); /* Must be < 64K */
1769 if (!(stops
= SEGPTR_ALLOC( *pwparam16
* sizeof(INT16
)
1770 + sizeof(LPARAM
)))) return -1;
1771 for (i
= 0; i
< *pwparam16
; i
++) stops
[i
] = *((LPINT
)*plparam
+i
);
1772 *plparam
= (LPARAM
)SEGPTR_GET(stops
);
1775 *pmsg16
= LB_SETTABSTOPS16
;
1778 case CB_GETDROPPEDCONTROLRECT
:
1781 rect
= (RECT16
*)SEGPTR_ALLOC( sizeof(RECT16
) + sizeof(LPARAM
) );
1782 if (!rect
) return -1;
1783 *(LPARAM
*)(rect
+ 1) = *plparam
; /* Store the previous lParam */
1784 *plparam
= (LPARAM
)SEGPTR_GET(rect
);
1786 *pmsg16
= CB_GETDROPPEDCONTROLRECT16
;
1790 *plparam
= (LPARAM
)MapLS( (LPVOID
)(*plparam
) );
1791 *pmsg16
= LB_GETTEXT16
;
1795 *plparam
= (LPARAM
)MapLS( (LPVOID
)(*plparam
) );
1796 *pmsg16
= CB_GETLBTEXT16
;
1801 *plparam
= MAKELONG( (INT16
)(INT
)wParam32
, (INT16
)*plparam
);
1802 *pmsg16
= EM_SETSEL16
;
1809 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
) );
1813 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HWND16
)*plparam
);
1815 case WM_CTLCOLORMSGBOX
:
1816 case WM_CTLCOLOREDIT
:
1817 case WM_CTLCOLORLISTBOX
:
1818 case WM_CTLCOLORBTN
:
1819 case WM_CTLCOLORDLG
:
1820 case WM_CTLCOLORSCROLLBAR
:
1821 case WM_CTLCOLORSTATIC
:
1822 *pmsg16
= WM_CTLCOLOR
;
1823 *plparam
= MAKELPARAM( (HWND16
)*plparam
,
1824 (WORD
)msg32
- WM_CTLCOLORMSGBOX
);
1826 case WM_COMPAREITEM
:
1828 COMPAREITEMSTRUCT
*cis32
= (COMPAREITEMSTRUCT
*)*plparam
;
1829 COMPAREITEMSTRUCT16
*cis
= SEGPTR_NEW(COMPAREITEMSTRUCT16
);
1830 if (!cis
) return -1;
1831 cis
->CtlType
= (UINT16
)cis32
->CtlType
;
1832 cis
->CtlID
= (UINT16
)cis32
->CtlID
;
1833 cis
->hwndItem
= (HWND16
)cis32
->hwndItem
;
1834 cis
->itemID1
= (UINT16
)cis32
->itemID1
;
1835 cis
->itemData1
= cis32
->itemData1
;
1836 cis
->itemID2
= (UINT16
)cis32
->itemID2
;
1837 cis
->itemData2
= cis32
->itemData2
;
1838 *plparam
= (LPARAM
)SEGPTR_GET(cis
);
1843 DELETEITEMSTRUCT
*dis32
= (DELETEITEMSTRUCT
*)*plparam
;
1844 DELETEITEMSTRUCT16
*dis
= SEGPTR_NEW(DELETEITEMSTRUCT16
);
1845 if (!dis
) return -1;
1846 dis
->CtlType
= (UINT16
)dis32
->CtlType
;
1847 dis
->CtlID
= (UINT16
)dis32
->CtlID
;
1848 dis
->itemID
= (UINT16
)dis32
->itemID
;
1849 dis
->hwndItem
= (HWND16
)dis32
->hwndItem
;
1850 dis
->itemData
= dis32
->itemData
;
1851 *plparam
= (LPARAM
)SEGPTR_GET(dis
);
1856 DRAWITEMSTRUCT
*dis32
= (DRAWITEMSTRUCT
*)*plparam
;
1857 DRAWITEMSTRUCT16
*dis
= SEGPTR_NEW(DRAWITEMSTRUCT16
);
1858 if (!dis
) return -1;
1859 dis
->CtlType
= (UINT16
)dis32
->CtlType
;
1860 dis
->CtlID
= (UINT16
)dis32
->CtlID
;
1861 dis
->itemID
= (UINT16
)dis32
->itemID
;
1862 dis
->itemAction
= (UINT16
)dis32
->itemAction
;
1863 dis
->itemState
= (UINT16
)dis32
->itemState
;
1864 dis
->hwndItem
= (HWND16
)dis32
->hwndItem
;
1865 dis
->hDC
= (HDC16
)dis32
->hDC
;
1866 dis
->itemData
= dis32
->itemData
;
1867 CONV_RECT32TO16( &dis32
->rcItem
, &dis
->rcItem
);
1868 *plparam
= (LPARAM
)SEGPTR_GET(dis
);
1871 case WM_MEASUREITEM
:
1873 MEASUREITEMSTRUCT
*mis32
= (MEASUREITEMSTRUCT
*)*plparam
;
1874 MEASUREITEMSTRUCT16
*mis
= (MEASUREITEMSTRUCT16
*)
1875 SEGPTR_ALLOC(sizeof(*mis
)+sizeof(LPARAM
));
1876 if (!mis
) return -1;
1877 mis
->CtlType
= (UINT16
)mis32
->CtlType
;
1878 mis
->CtlID
= (UINT16
)mis32
->CtlID
;
1879 mis
->itemID
= (UINT16
)mis32
->itemID
;
1880 mis
->itemWidth
= (UINT16
)mis32
->itemWidth
;
1881 mis
->itemHeight
= (UINT16
)mis32
->itemHeight
;
1882 mis
->itemData
= mis32
->itemData
;
1883 *(LPARAM
*)(mis
+ 1) = *plparam
; /* Store the previous lParam */
1884 *plparam
= (LPARAM
)SEGPTR_GET(mis
);
1887 case WM_GETMINMAXINFO
:
1889 MINMAXINFO16
*mmi
= (MINMAXINFO16
*)SEGPTR_ALLOC( sizeof(*mmi
) +
1891 if (!mmi
) return -1;
1892 STRUCT32_MINMAXINFO32to16( (MINMAXINFO
*)*plparam
, mmi
);
1893 *(LPARAM
*)(mmi
+ 1) = *plparam
; /* Store the previous lParam */
1894 *plparam
= (LPARAM
)SEGPTR_GET(mmi
);
1898 case WM_ASKCBFORMATNAME
:
1901 *pwparam16
= (WPARAM16
)min( wParam32
, 0xff80 ); /* Must be < 64K */
1902 if (!(str
= SEGPTR_ALLOC(*pwparam16
+ sizeof(LPARAM
)))) return -1;
1903 *((LPARAM
*)str
)++ = *plparam
; /* Store the previous lParam */
1904 *plparam
= (LPARAM
)SEGPTR_GET(str
);
1909 MDICREATESTRUCT16
*cs
;
1910 MDICREATESTRUCTA
*cs32
= (MDICREATESTRUCTA
*)*plparam
;
1913 if (!(cs
= SEGPTR_NEW(MDICREATESTRUCT16
))) return -1;
1914 STRUCT32_MDICREATESTRUCT32Ato16( cs32
, cs
);
1915 name
= SEGPTR_STRDUP( cs32
->szTitle
);
1916 cls
= SEGPTR_STRDUP( cs32
->szClass
);
1917 cs
->szTitle
= SEGPTR_GET(name
);
1918 cs
->szClass
= SEGPTR_GET(cls
);
1919 *plparam
= (LPARAM
)SEGPTR_GET(cs
);
1922 case WM_MDIGETACTIVE
:
1925 *plparam
= MAKELPARAM( (HMENU16
)LOWORD(wParam32
),
1926 (HMENU16
)LOWORD(*plparam
) );
1927 *pwparam16
= (*plparam
== 0);
1930 if(HIWORD(wParam32
) & MF_POPUP
)
1933 if (((UINT
)HIWORD(wParam32
) != 0xFFFF) || (*plparam
))
1935 if((hmenu
= GetSubMenu((HMENU16
)*plparam
, *pwparam16
)))
1941 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HMENU16
)*plparam
);
1943 case WM_MDIACTIVATE
:
1944 if (GetWindowLongA( hwnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
)
1946 *pwparam16
= ((HWND
)*plparam
== hwnd
);
1947 *plparam
= MAKELPARAM( (HWND16
)LOWORD(*plparam
),
1948 (HWND16
)LOWORD(wParam32
) );
1952 *pwparam16
= (HWND
)wParam32
;
1958 NCCALCSIZE_PARAMS
*nc32
= (NCCALCSIZE_PARAMS
*)*plparam
;
1959 NCCALCSIZE_PARAMS16
*nc
= (NCCALCSIZE_PARAMS16
*)SEGPTR_ALLOC( sizeof(*nc
) + sizeof(LPARAM
) );
1962 CONV_RECT32TO16( &nc32
->rgrc
[0], &nc
->rgrc
[0] );
1966 CONV_RECT32TO16( &nc32
->rgrc
[1], &nc
->rgrc
[1] );
1967 CONV_RECT32TO16( &nc32
->rgrc
[2], &nc
->rgrc
[2] );
1968 if (!(wp
= SEGPTR_NEW(WINDOWPOS16
)))
1973 STRUCT32_WINDOWPOS32to16( nc32
->lppos
, wp
);
1974 nc
->lppos
= SEGPTR_GET(wp
);
1976 *(LPARAM
*)(nc
+ 1) = *plparam
; /* Store the previous lParam */
1977 *plparam
= (LPARAM
)SEGPTR_GET(nc
);
1984 CREATESTRUCTA
*cs32
= (CREATESTRUCTA
*)*plparam
;
1987 if (!(cs
= SEGPTR_NEW(CREATESTRUCT16
))) return -1;
1988 STRUCT32_CREATESTRUCT32Ato16( cs32
, cs
);
1989 name
= SEGPTR_STRDUP( cs32
->lpszName
);
1990 cls
= SEGPTR_STRDUP( cs32
->lpszClass
);
1991 cs
->lpszName
= SEGPTR_GET(name
);
1992 cs
->lpszClass
= SEGPTR_GET(cls
);
1993 *plparam
= (LPARAM
)SEGPTR_GET(cs
);
1996 case WM_PARENTNOTIFY
:
1997 if ((LOWORD(wParam32
)==WM_CREATE
) || (LOWORD(wParam32
)==WM_DESTROY
))
1998 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
));
1999 /* else nothing to do */
2002 *plparam
= MapLS( (NMHDR
*)*plparam
); /* NMHDR is already 32-bit */
2005 case WM_WININICHANGE
:
2006 case WM_DEVMODECHANGE
:
2008 LPSTR str
= SEGPTR_STRDUP( (LPSTR
)*plparam
);
2009 if (!str
) return -1;
2010 *plparam
= (LPARAM
)SEGPTR_GET(str
);
2013 case WM_WINDOWPOSCHANGING
:
2014 case WM_WINDOWPOSCHANGED
:
2016 WINDOWPOS16
*wp
= (WINDOWPOS16
*)SEGPTR_ALLOC( sizeof(*wp
) +
2019 STRUCT32_WINDOWPOS32to16( (WINDOWPOS
*)*plparam
, wp
);
2020 *(LPARAM
*)(wp
+ 1) = *plparam
; /* Store the previous lParam */
2021 *plparam
= (LPARAM
)SEGPTR_GET(wp
);
2026 LPMSG msg32
= (LPMSG
) *plparam
;
2027 LPMSG16 msg16
= (LPMSG16
) SEGPTR_NEW( MSG16
);
2029 if (!msg16
) return -1;
2030 msg16
->hwnd
= msg32
->hwnd
;
2031 msg16
->lParam
= msg32
->lParam
;
2032 msg16
->time
= msg32
->time
;
2033 CONV_POINT32TO16(&msg32
->pt
,&msg16
->pt
);
2034 /* this is right, right? */
2035 if (WINPROC_MapMsg32ATo16(msg32
->hwnd
,msg32
->message
,msg32
->wParam
,
2036 &msg16
->message
,&msg16
->wParam
, &msg16
->lParam
)<0) {
2037 SEGPTR_FREE( msg16
);
2040 *plparam
= (LPARAM
)SEGPTR_GET(msg16
);
2045 case WM_ACTIVATEAPP
:
2046 if (*plparam
) *plparam
= (LPARAM
)THREAD_IdToTEB((DWORD
) *plparam
)->htask16
;
2050 MDINEXTMENU
*next
= (MDINEXTMENU
*)*plparam
;
2051 *plparam
= next
->hmenuIn
;
2054 case WM_PAINTCLIPBOARD
:
2055 case WM_SIZECLIPBOARD
:
2056 FIXME_(msg
)("message %04x needs translation\n", msg32
);
2058 /* following messages should not be sent to 16-bit apps */
2061 case WM_CAPTURECHANGED
:
2062 case WM_STYLECHANGING
:
2063 case WM_STYLECHANGED
:
2065 default: /* No translation needed */
2071 /**********************************************************************
2072 * WINPROC_UnmapMsg32ATo16
2074 * Unmap a message that was mapped from 32-bit Ansi to 16-bit.
2076 void WINPROC_UnmapMsg32ATo16( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
2085 case LB_FINDSTRINGEXACT
:
2086 case LB_INSERTSTRING
:
2087 case LB_SELECTSTRING
:
2088 case LB_SETTABSTOPS
:
2091 case CB_FINDSTRINGEXACT
:
2092 case CB_INSERTSTRING
:
2093 case CB_SELECTSTRING
:
2095 case WM_COMPAREITEM
:
2099 case WM_WININICHANGE
:
2100 case WM_DEVMODECHANGE
:
2101 SEGPTR_FREE( MapSL(p16
->lParam
) );
2104 case CB_GETDROPPEDCONTROLRECT
:
2105 case LB_GETITEMRECT
:
2107 RECT16
*rect
= MapSL(p16
->lParam
);
2108 p16
->lParam
= *(LPARAM
*)(rect
+ 1);
2109 CONV_RECT16TO32( rect
, (RECT
*)(p16
->lParam
));
2110 SEGPTR_FREE( rect
);
2113 case LB_GETSELITEMS
:
2116 LPINT16 items
= MapSL(lParam
);
2117 p16
->lParam
= *((LPARAM
*)items
- 1);
2118 for (i
= 0; i
< p16
->wParam
; i
++) *((LPINT
)(p16
->lParam
) + i
) = items
[i
];
2119 SEGPTR_FREE( (LPARAM
*)items
- 1 );
2125 *((LPUINT
)(wParam
)) = LOWORD(p16
->lResult
);
2127 *((LPUINT
)(lParam
)) = HIWORD(p16
->lResult
); /* FIXME: substract 1? */
2132 UnMapLS( (SEGPTR
)(p16
->lParam
) );
2135 case WM_MEASUREITEM
:
2137 MEASUREITEMSTRUCT16
*mis
= MapSL(p16
->lParam
);
2138 MEASUREITEMSTRUCT
*mis32
= *(MEASUREITEMSTRUCT
**)(mis
+ 1);
2139 mis32
->itemWidth
= mis
->itemWidth
;
2140 mis32
->itemHeight
= mis
->itemHeight
;
2144 case WM_GETMINMAXINFO
:
2146 MINMAXINFO16
*mmi
= MapSL(p16
->lParam
);
2147 p16
->lParam
= *(LPARAM
*)(mmi
+ 1);
2148 STRUCT32_MINMAXINFO16to32( mmi
, (MINMAXINFO
*)(p16
->lParam
) );
2153 case WM_ASKCBFORMATNAME
:
2155 LPSTR str
= MapSL(p16
->lParam
);
2156 p16
->lParam
= *((LPARAM
*)str
- 1);
2157 lstrcpynA( (LPSTR
)(p16
->lParam
), str
, p16
->wParam
);
2158 SEGPTR_FREE( (LPARAM
*)str
- 1 );
2163 MDICREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2164 SEGPTR_FREE( MapSL(cs
->szTitle
) );
2165 SEGPTR_FREE( MapSL(cs
->szClass
) );
2169 case WM_MDIGETACTIVE
:
2170 if (lParam
) *(BOOL
*)lParam
= (BOOL16
)HIWORD(p16
->lResult
);
2171 p16
->lResult
= (HWND
)LOWORD(p16
->lResult
);
2175 NCCALCSIZE_PARAMS
*nc32
;
2176 NCCALCSIZE_PARAMS16
*nc
= MapSL(p16
->lParam
);
2177 p16
->lParam
= *(LPARAM
*)(nc
+ 1);
2178 nc32
= (NCCALCSIZE_PARAMS
*)(p16
->lParam
);
2179 CONV_RECT16TO32( &nc
->rgrc
[0], &nc32
->rgrc
[0] );
2182 CONV_RECT16TO32( &nc
->rgrc
[1], &nc32
->rgrc
[1] );
2183 CONV_RECT16TO32( &nc
->rgrc
[2], &nc32
->rgrc
[2] );
2184 STRUCT32_WINDOWPOS16to32( MapSL(nc
->lppos
), nc32
->lppos
);
2185 SEGPTR_FREE( MapSL(nc
->lppos
) );
2193 CREATESTRUCT16
*cs
= MapSL(p16
->lParam
);
2194 SEGPTR_FREE( MapSL(cs
->lpszName
) );
2195 SEGPTR_FREE( MapSL(cs
->lpszClass
) );
2199 case WM_WINDOWPOSCHANGING
:
2200 case WM_WINDOWPOSCHANGED
:
2202 WINDOWPOS16
*wp
= MapSL(p16
->lParam
);
2203 p16
->lParam
= *(LPARAM
*)(wp
+ 1);
2204 STRUCT32_WINDOWPOS16to32( wp
, (WINDOWPOS
*)p16
->lParam
);
2209 UnMapLS(p16
->lParam
);
2214 LPMSG16 msg16
= MapSL(p16
->lParam
);
2216 msgp16
.wParam
=msg16
->wParam
;
2217 msgp16
.lParam
=msg16
->lParam
;
2218 WINPROC_UnmapMsg32ATo16(((LPMSG
)lParam
)->hwnd
, ((LPMSG
)lParam
)->message
,
2219 ((LPMSG
)lParam
)->wParam
, ((LPMSG
)lParam
)->lParam
,
2226 MDINEXTMENU
*next
= (MDINEXTMENU
*)lParam
;
2227 next
->hmenuNext
= LOWORD(p16
->lResult
);
2228 next
->hwndNext
= HIWORD(p16
->lResult
);
2236 /**********************************************************************
2237 * WINPROC_MapMsg32WTo16
2239 * Map a message from 32-bit Unicode to 16-bit.
2240 * Return value is -1 on error, 0 if OK, 1 if an UnmapMsg call is needed.
2242 INT
WINPROC_MapMsg32WTo16( HWND hwnd
, UINT msg32
, WPARAM wParam32
,
2243 UINT16
*pmsg16
, WPARAM16
*pwparam16
,
2249 *pmsg16
= LOWORD(msg32
);
2250 *pwparam16
= LOWORD(wParam32
);
2255 case LB_FINDSTRINGEXACT
:
2256 case LB_INSERTSTRING
:
2257 case LB_SELECTSTRING
:
2261 LPSTR str
= SEGPTR_STRDUP_WtoA( (LPWSTR
)*plparam
);
2262 if (!str
) return -1;
2263 *plparam
= (LPARAM
)SEGPTR_GET(str
);
2265 *pmsg16
= (UINT16
)msg32
+ (LB_ADDSTRING16
- LB_ADDSTRING
);
2270 case CB_FINDSTRINGEXACT
:
2271 case CB_INSERTSTRING
:
2272 case CB_SELECTSTRING
:
2275 LPSTR str
= SEGPTR_STRDUP_WtoA( (LPWSTR
)*plparam
);
2276 if (!str
) return -1;
2277 *plparam
= (LPARAM
)SEGPTR_GET(str
);
2279 *pmsg16
= (UINT16
)msg32
+ (CB_ADDSTRING16
- CB_ADDSTRING
);
2286 CREATESTRUCTW
*cs32
= (CREATESTRUCTW
*)*plparam
;
2289 if (!(cs
= SEGPTR_NEW(CREATESTRUCT16
))) return -1;
2290 STRUCT32_CREATESTRUCT32Ato16( (CREATESTRUCTA
*)cs32
, cs
);
2291 name
= SEGPTR_STRDUP_WtoA( cs32
->lpszName
);
2292 cls
= SEGPTR_STRDUP_WtoA( cs32
->lpszClass
);
2293 cs
->lpszName
= SEGPTR_GET(name
);
2294 cs
->lpszClass
= SEGPTR_GET(cls
);
2295 *plparam
= (LPARAM
)SEGPTR_GET(cs
);
2300 MDICREATESTRUCT16
*cs
;
2301 MDICREATESTRUCTW
*cs32
= (MDICREATESTRUCTW
*)*plparam
;
2304 if (!(cs
= SEGPTR_NEW(MDICREATESTRUCT16
))) return -1;
2305 STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCTA
*)cs32
, cs
);
2306 name
= SEGPTR_STRDUP_WtoA( cs32
->szTitle
);
2307 cls
= SEGPTR_STRDUP_WtoA( cs32
->szClass
);
2308 cs
->szTitle
= SEGPTR_GET(name
);
2309 cs
->szClass
= SEGPTR_GET(cls
);
2310 *plparam
= (LPARAM
)SEGPTR_GET(cs
);
2315 LPSTR str
= SEGPTR_STRDUP_WtoA( (LPWSTR
)*plparam
);
2316 if (!str
) return -1;
2317 *plparam
= (LPARAM
)SEGPTR_GET(str
);
2322 if ( WINPROC_TestLBForStr( hwnd
))
2324 LPSTR str
= (LPSTR
) SEGPTR_ALLOC( 256 ); /* fixme: fixed sized buffer */
2325 if (!str
) return -1;
2326 *pmsg16
= (msg32
== LB_GETTEXT
)? LB_GETTEXT16
: CB_GETLBTEXT16
;
2327 *plparam
= (LPARAM
)SEGPTR_GET(str
);
2332 wch
= LOWORD(wParam32
);
2333 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, &ch
, 1, NULL
, NULL
);
2335 *plparam
= MAKELPARAM( (HWND16
)*plparam
, HIWORD(wParam32
) );
2338 wch
= LOWORD(wParam32
);
2339 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, &ch
, 1, NULL
, NULL
);
2341 *plparam
= MAKELPARAM( HIWORD(wParam32
), (HMENU16
)*plparam
);
2346 case WM_SYSDEADCHAR
:
2348 WideCharToMultiByte( CP_ACP
, 0, &wch
, 1, &ch
, 1, NULL
, NULL
);
2352 default: /* No Unicode translation needed (?) */
2353 return WINPROC_MapMsg32ATo16( hwnd
, msg32
, wParam32
, pmsg16
,
2354 pwparam16
, plparam
);
2359 /**********************************************************************
2360 * WINPROC_UnmapMsg32WTo16
2362 * Unmap a message that was mapped from 32-bit Unicode to 16-bit.
2364 void WINPROC_UnmapMsg32WTo16( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
2370 case WM_ASKCBFORMATNAME
:
2372 LPSTR str
= MapSL(p16
->lParam
);
2373 p16
->lParam
= *((LPARAM
*)str
- 1);
2374 MultiByteToWideChar( CP_ACP
, 0, str
, -1, (LPWSTR
)p16
->lParam
, 0x7fffffff );
2375 SEGPTR_FREE( (LPARAM
*)str
- 1 );
2380 if ( WINPROC_TestLBForStr( hwnd
))
2382 LPSTR str
= MapSL(p16
->lParam
);
2383 MultiByteToWideChar( CP_ACP
, 0, str
, -1, (LPWSTR
)lParam
, 0x7fffffff );
2384 SEGPTR_FREE( (LPARAM
*) str
);
2388 WINPROC_UnmapMsg32ATo16( hwnd
, msg
, wParam
, lParam
, p16
);
2394 /**********************************************************************
2395 * WINPROC_CallProc32ATo32W
2397 * Call a window procedure, translating args from Ansi to Unicode.
2399 static LRESULT
WINPROC_CallProc32ATo32W( WNDPROC func
, HWND hwnd
,
2400 UINT msg
, WPARAM wParam
,
2406 if( (unmap
= WINPROC_MapMsg32ATo32W( hwnd
, msg
, &wParam
, &lParam
)) == -1) {
2407 ERR_(msg
)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n",
2408 SPY_GetMsgName(msg
), wParam
, lParam
);
2411 result
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2412 if (unmap
) result
= WINPROC_UnmapMsg32ATo32W( hwnd
, msg
, wParam
, lParam
, result
);
2417 /**********************************************************************
2418 * WINPROC_CallProc32WTo32A
2420 * Call a window procedure, translating args from Unicode to Ansi.
2422 static LRESULT
WINPROC_CallProc32WTo32A( WNDPROC func
, HWND hwnd
,
2423 UINT msg
, WPARAM wParam
,
2429 if ((unmap
= WINPROC_MapMsg32WTo32A( hwnd
, msg
, &wParam
, &lParam
)) == -1) {
2430 ERR_(msg
)("Message translation failed. (msg=%s,wp=%08x,lp=%08lx)\n",
2431 SPY_GetMsgName(msg
), wParam
, lParam
);
2434 result
= WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2435 if( unmap
) WINPROC_UnmapMsg32WTo32A( hwnd
, msg
, wParam
, lParam
);
2440 /**********************************************************************
2441 * WINPROC_CallProc16To32A
2443 * Call a 32-bit window procedure, translating the 16-bit args.
2445 static LRESULT
WINPROC_CallProc16To32A( WNDPROC func
, HWND16 hwnd
,
2446 UINT16 msg
, WPARAM16 wParam
,
2453 if (WINPROC_MapMsg16To32A( msg
, wParam
, &msg32
, &wParam32
, &lParam
) == -1)
2455 result
= WINPROC_CallWndProc( func
, hwnd
, msg32
, wParam32
, lParam
);
2456 return WINPROC_UnmapMsg16To32A( hwnd
, msg32
, wParam32
, lParam
, result
);
2459 /**********************************************************************
2460 * WINPROC_Thunk16To32A
2462 static LRESULT WINAPI
WINPROC_Thunk16To32A( WNDPROC func
, LPBYTE args
)
2464 HWND16 hwnd
= *(HWND16
*)( args
+8 );
2465 UINT16 msg
= *(HWND16
*)( args
+6 );
2466 WPARAM16 wParam
= *(HWND16
*)( args
+4 );
2467 LPARAM lParam
= *(LPARAM
*)( args
+0 );
2469 return WINPROC_CallProc16To32A( func
, hwnd
, msg
, wParam
, lParam
);
2473 /**********************************************************************
2474 * WINPROC_CallProc16To32W
2476 * Call a 32-bit window procedure, translating the 16-bit args.
2478 static LRESULT
WINPROC_CallProc16To32W( WNDPROC func
, HWND16 hwnd
,
2479 UINT16 msg
, WPARAM16 wParam
,
2486 if (WINPROC_MapMsg16To32W( hwnd
, msg
, wParam
, &msg32
, &wParam32
, &lParam
) == -1)
2489 result
= WINPROC_CallWndProc( func
, hwnd
, msg32
, wParam32
, lParam
);
2491 return WINPROC_UnmapMsg16To32W( hwnd
, msg32
, wParam32
, lParam
, result
);
2494 /**********************************************************************
2495 * WINPROC_Thunk16To32W
2497 static LRESULT WINAPI
WINPROC_Thunk16To32W( WNDPROC func
, LPBYTE args
)
2499 HWND16 hwnd
= *(HWND16
*)( args
+8 );
2500 UINT16 msg
= *(HWND16
*)( args
+6 );
2501 WPARAM16 wParam
= *(HWND16
*)( args
+4 );
2502 LPARAM lParam
= *(LPARAM
*)( args
+0 );
2504 return WINPROC_CallProc16To32W( func
, hwnd
, msg
, wParam
, lParam
);
2507 /**********************************************************************
2508 * WINPROC_CallProc32ATo16
2510 * Call a 16-bit window procedure, translating the 32-bit args.
2512 static LRESULT WINAPI
WINPROC_CallProc32ATo16( WNDPROC16 func
, HWND hwnd
,
2513 UINT msg
, WPARAM wParam
,
2519 mp16
.lParam
= lParam
;
2520 if (WINPROC_MapMsg32ATo16( hwnd
, msg
, wParam
,
2521 &msg16
, &mp16
.wParam
, &mp16
.lParam
) == -1)
2523 mp16
.lResult
= WINPROC_CallWndProc16( func
, hwnd
, msg16
,
2524 mp16
.wParam
, mp16
.lParam
);
2525 WINPROC_UnmapMsg32ATo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
2526 return mp16
.lResult
;
2530 /**********************************************************************
2531 * WINPROC_CallProc32WTo16
2533 * Call a 16-bit window procedure, translating the 32-bit args.
2535 static LRESULT WINAPI
WINPROC_CallProc32WTo16( WNDPROC16 func
, HWND hwnd
,
2536 UINT msg
, WPARAM wParam
,
2542 mp16
.lParam
= lParam
;
2543 if (WINPROC_MapMsg32WTo16( hwnd
, msg
, wParam
, &msg16
, &mp16
.wParam
,
2544 &mp16
.lParam
) == -1)
2546 mp16
.lResult
= WINPROC_CallWndProc16( func
, hwnd
, msg16
,
2547 mp16
.wParam
, mp16
.lParam
);
2548 WINPROC_UnmapMsg32WTo16( hwnd
, msg
, wParam
, lParam
, &mp16
);
2549 return mp16
.lResult
;
2553 /**********************************************************************
2554 * CallWindowProc (USER.122)
2555 * CallWindowProc16 (USER32.@)
2557 LRESULT WINAPI
CallWindowProc16( WNDPROC16 func
, HWND16 hwnd
, UINT16 msg
,
2558 WPARAM16 wParam
, LPARAM lParam
)
2560 WINDOWPROC
*proc
= WINPROC_GetPtr( func
);
2563 return WINPROC_CallWndProc16( func
, hwnd
, msg
, wParam
, lParam
);
2566 func
= WINPROC_GetProc( (HWINDOWPROC
)proc
, WIN_PROC_16
);
2567 return WINPROC_CallWndProc16( func
, hwnd
, msg
, wParam
, lParam
);
2573 if (!proc
->thunk
.t_from32
.proc
) return 0;
2574 return WINPROC_CallWndProc16( proc
->thunk
.t_from32
.proc
,
2575 hwnd
, msg
, wParam
, lParam
);
2577 if (!proc
->thunk
.t_from16
.proc
) return 0;
2578 return WINPROC_CallProc16To32A( proc
->thunk
.t_from16
.proc
,
2579 hwnd
, msg
, wParam
, lParam
);
2581 if (!proc
->thunk
.t_from16
.proc
) return 0;
2582 return WINPROC_CallProc16To32W( proc
->thunk
.t_from16
.proc
,
2583 hwnd
, msg
, wParam
, lParam
);
2585 WARN_(relay
)("Invalid proc %p\n", proc
);
2591 /**********************************************************************
2592 * CallWindowProcA (USER32.@)
2594 * The CallWindowProc() function invokes the windows procedure _func_,
2595 * with _hwnd_ as the target window, the message specified by _msg_, and
2596 * the message parameters _wParam_ and _lParam_.
2598 * Some kinds of argument conversion may be done, I'm not sure what.
2600 * CallWindowProc() may be used for windows subclassing. Use
2601 * SetWindowLong() to set a new windows procedure for windows of the
2602 * subclass, and handle subclassed messages in the new windows
2603 * procedure. The new windows procedure may then use CallWindowProc()
2604 * with _func_ set to the parent class's windows procedure to dispatch
2605 * the message to the superclass.
2609 * The return value is message dependent.
2615 LRESULT WINAPI
CallWindowProcA(
2616 WNDPROC func
, /* [in] window procedure */
2617 HWND hwnd
, /* [in] target window */
2618 UINT msg
, /* [in] message */
2619 WPARAM wParam
, /* [in] message dependent parameter */
2620 LPARAM lParam
/* [in] message dependent parameter */
2622 WINDOWPROC
*proc
= WINPROC_GetPtr( (WNDPROC16
)func
);
2624 if (!proc
) return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2627 func
= WINPROC_GetProc( (HWINDOWPROC
)proc
, WIN_PROC_32A
);
2628 return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2634 if (!proc
->thunk
.t_from32
.proc
) return 0;
2635 return WINPROC_CallProc32ATo16( proc
->thunk
.t_from32
.proc
,
2636 hwnd
, msg
, wParam
, lParam
);
2638 if (!proc
->thunk
.t_from16
.proc
) return 0;
2639 return WINPROC_CallWndProc( proc
->thunk
.t_from16
.proc
,
2640 hwnd
, msg
, wParam
, lParam
);
2642 if (!proc
->thunk
.t_from16
.proc
) return 0;
2643 return WINPROC_CallProc32ATo32W( proc
->thunk
.t_from16
.proc
,
2644 hwnd
, msg
, wParam
, lParam
);
2646 WARN_(relay
)("Invalid proc %p\n", proc
);
2652 /**********************************************************************
2653 * CallWindowProcW (USER32.@)
2655 LRESULT WINAPI
CallWindowProcW( WNDPROC func
, HWND hwnd
, UINT msg
,
2656 WPARAM wParam
, LPARAM lParam
)
2658 WINDOWPROC
*proc
= WINPROC_GetPtr( (WNDPROC16
)func
);
2660 if (!proc
) return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2663 func
= WINPROC_GetProc( (HWINDOWPROC
)proc
, WIN_PROC_32W
);
2664 return WINPROC_CallWndProc( func
, hwnd
, msg
, wParam
, lParam
);
2670 if (!proc
->thunk
.t_from32
.proc
) return 0;
2671 return WINPROC_CallProc32WTo16( proc
->thunk
.t_from32
.proc
,
2672 hwnd
, msg
, wParam
, lParam
);
2674 if (!proc
->thunk
.t_from16
.proc
) return 0;
2675 return WINPROC_CallProc32WTo32A( proc
->thunk
.t_from16
.proc
,
2676 hwnd
, msg
, wParam
, lParam
);
2678 if (!proc
->thunk
.t_from16
.proc
) return 0;
2679 return WINPROC_CallWndProc( proc
->thunk
.t_from16
.proc
,
2680 hwnd
, msg
, wParam
, lParam
);
2682 WARN_(relay
)("Invalid proc %p\n", proc
);