ntoskrnl.exe: Implement ExAcquireFastMutex and ExReleaseFastMutex.
[wine.git] / dlls / user32 / winproc.c
blob6de650cd1e59a9cf009cb9681a93ea3c26de4b55
1 /*
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <assert.h>
26 #include <stdarg.h>
27 #include <string.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "controls.h"
33 #include "win.h"
34 #include "user_private.h"
35 #include "wine/unicode.h"
36 #include "wine/asm.h"
37 #include "wine/debug.h"
39 WINE_DECLARE_DEBUG_CHANNEL(msg);
40 WINE_DECLARE_DEBUG_CHANNEL(relay);
41 WINE_DEFAULT_DEBUG_CHANNEL(win);
43 typedef struct tagWINDOWPROC
45 WNDPROC procA; /* ASCII window proc */
46 WNDPROC procW; /* Unicode window proc */
47 } WINDOWPROC;
49 #define MAX_WINPROCS 4096
50 #define MAX_WINPROC_RECURSION 64
51 #define WINPROC_PROC16 ((WINDOWPROC *)1) /* placeholder for 16-bit window procs */
53 static LRESULT WINAPI ButtonWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
54 static LRESULT WINAPI ButtonWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
55 static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
56 static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
57 LRESULT WINAPI EditWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
58 static LRESULT WINAPI EditWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
59 static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
60 static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
61 static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
62 static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
63 static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
64 static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
65 static LRESULT WINAPI StaticWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
66 static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
68 static WINDOWPROC winproc_array[MAX_WINPROCS] =
70 { ButtonWndProcA, ButtonWndProcW }, /* WINPROC_BUTTON */
71 { ComboWndProcA, ComboWndProcW }, /* WINPROC_COMBO */
72 { DefWindowProcA, DefWindowProcW }, /* WINPROC_DEFWND */
73 { DefDlgProcA, DefDlgProcW }, /* WINPROC_DIALOG */
74 { EditWndProcA, EditWndProcW }, /* WINPROC_EDIT */
75 { ListBoxWndProcA, ListBoxWndProcW }, /* WINPROC_LISTBOX */
76 { MDIClientWndProcA, MDIClientWndProcW }, /* WINPROC_MDICLIENT */
77 { ScrollBarWndProcA, ScrollBarWndProcW }, /* WINPROC_SCROLLBAR */
78 { StaticWndProcA, StaticWndProcW }, /* WINPROC_STATIC */
79 { ImeWndProcA, ImeWndProcW }, /* WINPROC_IME */
80 { NULL, DesktopWndProc }, /* WINPROC_DESKTOP */
81 { NULL, IconTitleWndProc }, /* WINPROC_ICONTITLE */
82 { NULL, PopupMenuWndProc }, /* WINPROC_MENU */
83 { NULL, MessageWndProc }, /* WINPROC_MESSAGE */
86 static UINT winproc_used = NB_BUILTIN_WINPROCS;
88 static CRITICAL_SECTION winproc_cs;
89 static CRITICAL_SECTION_DEBUG critsect_debug =
91 0, 0, &winproc_cs,
92 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
93 0, 0, { (DWORD_PTR)(__FILE__ ": winproc_cs") }
95 static CRITICAL_SECTION winproc_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
97 static inline void *get_buffer( void *static_buffer, size_t size, size_t need )
99 if (size >= need) return static_buffer;
100 return HeapAlloc( GetProcessHeap(), 0, need );
103 static inline void free_buffer( void *static_buffer, void *buffer )
105 if (buffer != static_buffer) HeapFree( GetProcessHeap(), 0, buffer );
108 /* find an existing winproc for a given function and type */
109 /* FIXME: probably should do something more clever than a linear search */
110 static inline WINDOWPROC *find_winproc( WNDPROC func, BOOL unicode )
112 unsigned int i;
114 for (i = 0; i < NB_BUILTIN_AW_WINPROCS; i++)
116 /* match either proc, some apps confuse A and W */
117 if (winproc_array[i].procA != func && winproc_array[i].procW != func) continue;
118 return &winproc_array[i];
120 for (i = NB_BUILTIN_AW_WINPROCS; i < winproc_used; i++)
122 if (!unicode && winproc_array[i].procA != func) continue;
123 if (unicode && winproc_array[i].procW != func) continue;
124 return &winproc_array[i];
126 return NULL;
129 /* return the window proc for a given handle, or NULL for an invalid handle,
130 * or WINPROC_PROC16 for a handle to a 16-bit proc. */
131 static inline WINDOWPROC *handle_to_proc( WNDPROC handle )
133 UINT index = LOWORD(handle);
134 if ((ULONG_PTR)handle >> 16 != WINPROC_HANDLE) return NULL;
135 if (index >= MAX_WINPROCS) return WINPROC_PROC16;
136 if (index >= winproc_used) return NULL;
137 return &winproc_array[index];
140 /* create a handle for a given window proc */
141 static inline WNDPROC proc_to_handle( WINDOWPROC *proc )
143 return (WNDPROC)(ULONG_PTR)((proc - winproc_array) | (WINPROC_HANDLE << 16));
146 /* allocate and initialize a new winproc */
147 static inline WINDOWPROC *alloc_winproc( WNDPROC func, BOOL unicode )
149 WINDOWPROC *proc;
151 /* check if the function is already a win proc */
152 if (!func) return NULL;
153 if ((proc = handle_to_proc( func ))) return proc;
155 EnterCriticalSection( &winproc_cs );
157 /* check if we already have a winproc for that function */
158 if (!(proc = find_winproc( func, unicode )))
160 if (winproc_used < MAX_WINPROCS)
162 proc = &winproc_array[winproc_used++];
163 if (unicode) proc->procW = func;
164 else proc->procA = func;
165 TRACE( "allocated %p for %c %p (%d/%d used)\n",
166 proc_to_handle(proc), unicode ? 'W' : 'A', func,
167 winproc_used, MAX_WINPROCS );
169 else WARN( "too many winprocs, cannot allocate one for %p\n", func );
171 else TRACE( "reusing %p for %p\n", proc_to_handle(proc), func );
173 LeaveCriticalSection( &winproc_cs );
174 return proc;
177 #ifdef __i386__
178 /* Some window procedures modify register they shouldn't, or are not
179 * properly declared stdcall; so we need a small assembly wrapper to
180 * call them. */
181 extern LRESULT WINPROC_wrapper( WNDPROC proc, HWND hwnd, UINT msg,
182 WPARAM wParam, LPARAM lParam );
183 __ASM_GLOBAL_FUNC( WINPROC_wrapper,
184 "pushl %ebp\n\t"
185 __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
186 __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
187 "movl %esp,%ebp\n\t"
188 __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
189 "pushl %edi\n\t"
190 __ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
191 "pushl %esi\n\t"
192 __ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
193 "pushl %ebx\n\t"
194 __ASM_CFI(".cfi_rel_offset %ebx,-12\n\t")
195 /* TreePad X Enterprise assumes that edi is < 0x80000000 in WM_TIMER messages */
196 "xorl %edi,%edi\n\t"
197 "subl $12,%esp\n\t"
198 "pushl 24(%ebp)\n\t"
199 "pushl 20(%ebp)\n\t"
200 "pushl 16(%ebp)\n\t"
201 "pushl 12(%ebp)\n\t"
202 "movl 8(%ebp),%eax\n\t"
203 "call *%eax\n\t"
204 "leal -12(%ebp),%esp\n\t"
205 "popl %ebx\n\t"
206 __ASM_CFI(".cfi_same_value %ebx\n\t")
207 "popl %esi\n\t"
208 __ASM_CFI(".cfi_same_value %esi\n\t")
209 "popl %edi\n\t"
210 __ASM_CFI(".cfi_same_value %edi\n\t")
211 "leave\n\t"
212 __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
213 __ASM_CFI(".cfi_same_value %ebp\n\t")
214 "ret" )
215 #else
216 static inline LRESULT WINPROC_wrapper( WNDPROC proc, HWND hwnd, UINT msg,
217 WPARAM wParam, LPARAM lParam )
219 return proc( hwnd, msg, wParam, lParam );
221 #endif /* __i386__ */
223 static WPARAM map_wparam_char_WtoA( WPARAM wParam, DWORD len )
225 WCHAR wch = wParam;
226 BYTE ch[2];
227 DWORD cp = get_input_codepage();
229 len = WideCharToMultiByte( cp, 0, &wch, 1, (LPSTR)ch, len, NULL, NULL );
230 if (len == 2)
231 return MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(wParam) );
232 else
233 return MAKEWPARAM( ch[0], HIWORD(wParam) );
236 /* call a 32-bit window procedure */
237 static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg )
239 DPI_AWARENESS_CONTEXT context;
240 WNDPROC proc = arg;
242 USER_CheckNotLock();
244 hwnd = WIN_GetFullHandle( hwnd );
245 TRACE_(relay)( "\1Call window proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)\n",
246 proc, hwnd, SPY_GetMsgName(msg, hwnd), wp, lp );
248 context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
249 *result = WINPROC_wrapper( proc, hwnd, msg, wp, lp );
250 SetThreadDpiAwarenessContext( context );
252 TRACE_(relay)( "\1Ret window proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx) retval=%08lx\n",
253 proc, hwnd, SPY_GetMsgName(msg, hwnd), wp, lp, *result );
254 return *result;
257 /* call a 32-bit dialog procedure */
258 static LRESULT call_dialog_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg )
260 DPI_AWARENESS_CONTEXT context;
261 WNDPROC proc = arg;
262 LRESULT ret;
264 USER_CheckNotLock();
266 hwnd = WIN_GetFullHandle( hwnd );
267 TRACE_(relay)( "\1Call dialog proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)\n",
268 proc, hwnd, SPY_GetMsgName(msg, hwnd), wp, lp );
270 context = SetThreadDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ));
271 ret = WINPROC_wrapper( proc, hwnd, msg, wp, lp );
272 *result = GetWindowLongPtrW( hwnd, DWLP_MSGRESULT );
273 SetThreadDpiAwarenessContext( context );
275 TRACE_(relay)( "\1Ret dialog proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx) retval=%08lx result=%08lx\n",
276 proc, hwnd, SPY_GetMsgName(msg, hwnd), wp, lp, ret, *result );
277 return ret;
281 /**********************************************************************
282 * WINPROC_GetProc
284 * Get a window procedure pointer that can be passed to the Windows program.
286 WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode )
288 WINDOWPROC *ptr = handle_to_proc( proc );
290 if (!ptr || ptr == WINPROC_PROC16) return proc;
291 if (unicode)
293 if (ptr->procW) return ptr->procW;
294 return proc;
296 else
298 if (ptr->procA) return ptr->procA;
299 return proc;
304 /**********************************************************************
305 * WINPROC_AllocProc
307 * Allocate a window procedure for a window or class.
309 * Note that allocated winprocs are never freed; the idea is that even if an app creates a
310 * lot of windows, it will usually only have a limited number of window procedures, so the
311 * array won't grow too large, and this way we avoid the need to track allocations per window.
313 WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode )
315 WINDOWPROC *proc;
317 if (!(proc = alloc_winproc( func, unicode ))) return func;
318 if (proc == WINPROC_PROC16) return func;
319 return proc_to_handle( proc );
323 /**********************************************************************
324 * WINPROC_IsUnicode
326 * Return the window procedure type, or the default value if not a winproc handle.
328 BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val )
330 WINDOWPROC *ptr = handle_to_proc( proc );
332 if (!ptr) return def_val;
333 if (ptr == WINPROC_PROC16) return FALSE; /* 16-bit is always A */
334 if (ptr->procA && ptr->procW) return def_val; /* can be both */
335 return (ptr->procW != NULL);
339 /**********************************************************************
340 * WINPROC_TestLBForStr
342 * Return TRUE if the lparam is a string
344 static inline BOOL WINPROC_TestLBForStr( HWND hwnd, UINT msg )
346 DWORD style = GetWindowLongA( hwnd, GWL_STYLE );
347 if (msg <= CB_MSGMAX)
348 return (!(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || (style & CBS_HASSTRINGS));
349 else
350 return (!(style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || (style & LBS_HASSTRINGS));
355 /**********************************************************************
356 * WINPROC_CallProcAtoW
358 * Call a window procedure, translating args from Ansi to Unicode.
360 LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam,
361 LPARAM lParam, LRESULT *result, void *arg, enum wm_char_mapping mapping )
363 LRESULT ret = 0;
365 TRACE_(msg)("(hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)\n",
366 hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam);
368 switch(msg)
370 case WM_NCCREATE:
371 case WM_CREATE:
373 WCHAR *ptr, buffer[512];
374 CREATESTRUCTA *csA = (CREATESTRUCTA *)lParam;
375 CREATESTRUCTW csW = *(CREATESTRUCTW *)csA;
376 MDICREATESTRUCTW mdi_cs;
377 DWORD name_lenA = 0, name_lenW = 0, class_lenA = 0, class_lenW = 0;
379 if (!IS_INTRESOURCE(csA->lpszClass))
381 class_lenA = strlen(csA->lpszClass) + 1;
382 RtlMultiByteToUnicodeSize( &class_lenW, csA->lpszClass, class_lenA );
384 if (!IS_INTRESOURCE(csA->lpszName))
386 name_lenA = strlen(csA->lpszName) + 1;
387 RtlMultiByteToUnicodeSize( &name_lenW, csA->lpszName, name_lenA );
390 if (!(ptr = get_buffer( buffer, sizeof(buffer), class_lenW + name_lenW ))) break;
392 if (class_lenW)
394 csW.lpszClass = ptr;
395 RtlMultiByteToUnicodeN( ptr, class_lenW, NULL, csA->lpszClass, class_lenA );
397 if (name_lenW)
399 csW.lpszName = ptr + class_lenW/sizeof(WCHAR);
400 RtlMultiByteToUnicodeN( ptr + class_lenW/sizeof(WCHAR), name_lenW, NULL,
401 csA->lpszName, name_lenA );
404 if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
406 mdi_cs = *(MDICREATESTRUCTW *)csA->lpCreateParams;
407 mdi_cs.szTitle = csW.lpszName;
408 mdi_cs.szClass = csW.lpszClass;
409 csW.lpCreateParams = &mdi_cs;
412 ret = callback( hwnd, msg, wParam, (LPARAM)&csW, result, arg );
413 free_buffer( buffer, ptr );
415 break;
417 case WM_MDICREATE:
419 WCHAR *ptr, buffer[512];
420 DWORD title_lenA = 0, title_lenW = 0, class_lenA = 0, class_lenW = 0;
421 MDICREATESTRUCTA *csA = (MDICREATESTRUCTA *)lParam;
422 MDICREATESTRUCTW csW;
424 memcpy( &csW, csA, sizeof(csW) );
426 if (!IS_INTRESOURCE(csA->szTitle))
428 title_lenA = strlen(csA->szTitle) + 1;
429 RtlMultiByteToUnicodeSize( &title_lenW, csA->szTitle, title_lenA );
431 if (!IS_INTRESOURCE(csA->szClass))
433 class_lenA = strlen(csA->szClass) + 1;
434 RtlMultiByteToUnicodeSize( &class_lenW, csA->szClass, class_lenA );
437 if (!(ptr = get_buffer( buffer, sizeof(buffer), title_lenW + class_lenW ))) break;
439 if (title_lenW)
441 csW.szTitle = ptr;
442 RtlMultiByteToUnicodeN( ptr, title_lenW, NULL, csA->szTitle, title_lenA );
444 if (class_lenW)
446 csW.szClass = ptr + title_lenW/sizeof(WCHAR);
447 RtlMultiByteToUnicodeN( ptr + title_lenW/sizeof(WCHAR), class_lenW, NULL,
448 csA->szClass, class_lenA );
450 ret = callback( hwnd, msg, wParam, (LPARAM)&csW, result, arg );
451 free_buffer( buffer, ptr );
453 break;
455 case WM_GETTEXT:
456 case WM_ASKCBFORMATNAME:
458 WCHAR *ptr, buffer[512];
459 LPSTR str = (LPSTR)lParam;
460 DWORD len = wParam * sizeof(WCHAR);
462 if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
463 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
464 if (wParam)
466 len = 0;
467 if (*result)
468 RtlUnicodeToMultiByteN( str, wParam - 1, &len, ptr, ret * sizeof(WCHAR) );
469 str[len] = 0;
470 *result = len;
472 free_buffer( buffer, ptr );
474 break;
476 case LB_ADDSTRING:
477 case LB_INSERTSTRING:
478 case LB_FINDSTRING:
479 case LB_FINDSTRINGEXACT:
480 case LB_SELECTSTRING:
481 case CB_ADDSTRING:
482 case CB_INSERTSTRING:
483 case CB_FINDSTRING:
484 case CB_FINDSTRINGEXACT:
485 case CB_SELECTSTRING:
486 if (!lParam || !WINPROC_TestLBForStr( hwnd, msg ))
488 ret = callback( hwnd, msg, wParam, lParam, result, arg );
489 break;
491 /* fall through */
492 case WM_SETTEXT:
493 case WM_WININICHANGE:
494 case WM_DEVMODECHANGE:
495 case CB_DIR:
496 case LB_DIR:
497 case LB_ADDFILE:
498 case EM_REPLACESEL:
499 if (!lParam) ret = callback( hwnd, msg, wParam, lParam, result, arg );
500 else
502 WCHAR *ptr, buffer[512];
503 LPCSTR strA = (LPCSTR)lParam;
504 DWORD lenW, lenA = strlen(strA) + 1;
506 RtlMultiByteToUnicodeSize( &lenW, strA, lenA );
507 if ((ptr = get_buffer( buffer, sizeof(buffer), lenW )))
509 RtlMultiByteToUnicodeN( ptr, lenW, NULL, strA, lenA );
510 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
511 free_buffer( buffer, ptr );
514 break;
516 case LB_GETTEXT:
517 case CB_GETLBTEXT:
518 if (lParam && WINPROC_TestLBForStr( hwnd, msg ))
520 WCHAR buffer[512]; /* FIXME: fixed sized buffer */
522 ret = callback( hwnd, msg, wParam, (LPARAM)buffer, result, arg );
523 if (*result >= 0)
525 DWORD len;
526 RtlUnicodeToMultiByteN( (LPSTR)lParam, ~0u, &len,
527 buffer, (strlenW(buffer) + 1) * sizeof(WCHAR) );
528 *result = len - 1;
531 else ret = callback( hwnd, msg, wParam, lParam, result, arg );
532 break;
534 case EM_GETLINE:
536 WCHAR *ptr, buffer[512];
537 WORD len = *(WORD *)lParam;
539 if (!(ptr = get_buffer( buffer, sizeof(buffer), len * sizeof(WCHAR) ))) break;
540 *((WORD *)ptr) = len; /* store the length */
541 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
542 if (*result)
544 DWORD reslen;
545 RtlUnicodeToMultiByteN( (LPSTR)lParam, len, &reslen, ptr, *result * sizeof(WCHAR) );
546 if (reslen < len) ((LPSTR)lParam)[reslen] = 0;
547 *result = reslen;
549 free_buffer( buffer, ptr );
551 break;
553 case WM_GETDLGCODE:
554 if (lParam)
556 MSG newmsg = *(MSG *)lParam;
557 if (map_wparam_AtoW( newmsg.message, &newmsg.wParam, WMCHAR_MAP_NOMAPPING ))
558 ret = callback( hwnd, msg, wParam, (LPARAM)&newmsg, result, arg );
560 else ret = callback( hwnd, msg, wParam, lParam, result, arg );
561 break;
563 case WM_CHARTOITEM:
564 case WM_MENUCHAR:
565 case WM_CHAR:
566 case WM_DEADCHAR:
567 case WM_SYSCHAR:
568 case WM_SYSDEADCHAR:
569 case EM_SETPASSWORDCHAR:
570 case WM_IME_CHAR:
571 if (map_wparam_AtoW( msg, &wParam, mapping ))
572 ret = callback( hwnd, msg, wParam, lParam, result, arg );
573 break;
575 case WM_GETTEXTLENGTH:
576 case CB_GETLBTEXTLEN:
577 case LB_GETTEXTLEN:
578 ret = callback( hwnd, msg, wParam, lParam, result, arg );
579 if (*result >= 0)
581 WCHAR *ptr, buffer[512];
582 LRESULT tmp;
583 DWORD len = *result + 1;
584 /* Determine respective GETTEXT message */
585 UINT msgGetText = (msg == WM_GETTEXTLENGTH) ? WM_GETTEXT :
586 ((msg == CB_GETLBTEXTLEN) ? CB_GETLBTEXT : LB_GETTEXT);
587 /* wParam differs between the messages */
588 WPARAM wp = (msg == WM_GETTEXTLENGTH) ? len : wParam;
590 if (!(ptr = get_buffer( buffer, sizeof(buffer), len * sizeof(WCHAR) ))) break;
592 if (callback == call_window_proc) /* FIXME: hack */
593 callback( hwnd, msgGetText, wp, (LPARAM)ptr, &tmp, arg );
594 else
595 tmp = SendMessageW( hwnd, msgGetText, wp, (LPARAM)ptr );
596 RtlUnicodeToMultiByteSize( &len, ptr, tmp * sizeof(WCHAR) );
597 *result = len;
598 free_buffer( buffer, ptr );
600 break;
602 case WM_PAINTCLIPBOARD:
603 case WM_SIZECLIPBOARD:
604 FIXME_(msg)( "message %s (0x%x) needs translation, please report\n",
605 SPY_GetMsgName(msg, hwnd), msg );
606 break;
608 default:
609 ret = callback( hwnd, msg, wParam, lParam, result, arg );
610 break;
612 return ret;
616 /**********************************************************************
617 * WINPROC_CallProcWtoA
619 * Call a window procedure, translating args from Unicode to Ansi.
621 static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UINT msg, WPARAM wParam,
622 LPARAM lParam, LRESULT *result, void *arg )
624 LRESULT ret = 0;
626 TRACE_(msg)("(hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)\n",
627 hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam);
629 switch(msg)
631 case WM_NCCREATE:
632 case WM_CREATE:
634 char buffer[1024], *cls;
635 CREATESTRUCTW *csW = (CREATESTRUCTW *)lParam;
636 CREATESTRUCTA csA = *(CREATESTRUCTA *)csW;
637 MDICREATESTRUCTA mdi_cs;
638 DWORD name_lenA = 0, name_lenW = 0, class_lenA = 0, class_lenW = 0;
640 if (!IS_INTRESOURCE(csW->lpszClass))
642 class_lenW = (strlenW(csW->lpszClass) + 1) * sizeof(WCHAR);
643 RtlUnicodeToMultiByteSize(&class_lenA, csW->lpszClass, class_lenW);
645 if (!IS_INTRESOURCE(csW->lpszName))
647 name_lenW = (strlenW(csW->lpszName) + 1) * sizeof(WCHAR);
648 RtlUnicodeToMultiByteSize(&name_lenA, csW->lpszName, name_lenW);
651 if (!(cls = get_buffer( buffer, sizeof(buffer), class_lenA + name_lenA ))) break;
653 if (class_lenA)
655 RtlUnicodeToMultiByteN(cls, class_lenA, NULL, csW->lpszClass, class_lenW);
656 csA.lpszClass = cls;
658 if (name_lenA)
660 char *name = cls + class_lenA;
661 RtlUnicodeToMultiByteN(name, name_lenA, NULL, csW->lpszName, name_lenW);
662 csA.lpszName = name;
665 if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
667 mdi_cs = *(MDICREATESTRUCTA *)csW->lpCreateParams;
668 mdi_cs.szTitle = csA.lpszName;
669 mdi_cs.szClass = csA.lpszClass;
670 csA.lpCreateParams = &mdi_cs;
673 ret = callback( hwnd, msg, wParam, (LPARAM)&csA, result, arg );
674 free_buffer( buffer, cls );
676 break;
678 case WM_GETTEXT:
679 case WM_ASKCBFORMATNAME:
681 char *ptr, buffer[512];
682 DWORD len = wParam * 2;
684 if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
685 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
686 if (len)
688 if (*result)
690 RtlMultiByteToUnicodeN( (LPWSTR)lParam, wParam*sizeof(WCHAR), &len, ptr, ret + 1 );
691 *result = len/sizeof(WCHAR) - 1; /* do not count terminating null */
693 ((LPWSTR)lParam)[*result] = 0;
695 free_buffer( buffer, ptr );
697 break;
699 case LB_ADDSTRING:
700 case LB_INSERTSTRING:
701 case LB_FINDSTRING:
702 case LB_FINDSTRINGEXACT:
703 case LB_SELECTSTRING:
704 case CB_ADDSTRING:
705 case CB_INSERTSTRING:
706 case CB_FINDSTRING:
707 case CB_FINDSTRINGEXACT:
708 case CB_SELECTSTRING:
709 if (!lParam || !WINPROC_TestLBForStr( hwnd, msg ))
711 ret = callback( hwnd, msg, wParam, lParam, result, arg );
712 break;
714 /* fall through */
715 case WM_SETTEXT:
716 case WM_WININICHANGE:
717 case WM_DEVMODECHANGE:
718 case CB_DIR:
719 case LB_DIR:
720 case LB_ADDFILE:
721 case EM_REPLACESEL:
722 if (!lParam) ret = callback( hwnd, msg, wParam, lParam, result, arg );
723 else
725 char *ptr, buffer[512];
726 LPCWSTR strW = (LPCWSTR)lParam;
727 DWORD lenA, lenW = (strlenW(strW) + 1) * sizeof(WCHAR);
729 RtlUnicodeToMultiByteSize( &lenA, strW, lenW );
730 if ((ptr = get_buffer( buffer, sizeof(buffer), lenA )))
732 RtlUnicodeToMultiByteN( ptr, lenA, NULL, strW, lenW );
733 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
734 free_buffer( buffer, ptr );
737 break;
739 case WM_MDICREATE:
741 char *ptr, buffer[1024];
742 DWORD title_lenA = 0, title_lenW = 0, class_lenA = 0, class_lenW = 0;
743 MDICREATESTRUCTW *csW = (MDICREATESTRUCTW *)lParam;
744 MDICREATESTRUCTA csA;
746 memcpy( &csA, csW, sizeof(csA) );
748 if (!IS_INTRESOURCE(csW->szTitle))
750 title_lenW = (strlenW(csW->szTitle) + 1) * sizeof(WCHAR);
751 RtlUnicodeToMultiByteSize( &title_lenA, csW->szTitle, title_lenW );
753 if (!IS_INTRESOURCE(csW->szClass))
755 class_lenW = (strlenW(csW->szClass) + 1) * sizeof(WCHAR);
756 RtlUnicodeToMultiByteSize( &class_lenA, csW->szClass, class_lenW );
759 if (!(ptr = get_buffer( buffer, sizeof(buffer), title_lenA + class_lenA ))) break;
761 if (title_lenA)
763 RtlUnicodeToMultiByteN( ptr, title_lenA, NULL, csW->szTitle, title_lenW );
764 csA.szTitle = ptr;
766 if (class_lenA)
768 RtlUnicodeToMultiByteN( ptr + title_lenA, class_lenA, NULL, csW->szClass, class_lenW );
769 csA.szClass = ptr + title_lenA;
771 ret = callback( hwnd, msg, wParam, (LPARAM)&csA, result, arg );
772 free_buffer( buffer, ptr );
774 break;
776 case LB_GETTEXT:
777 case CB_GETLBTEXT:
778 if (lParam && WINPROC_TestLBForStr( hwnd, msg ))
780 char buffer[512]; /* FIXME: fixed sized buffer */
782 ret = callback( hwnd, msg, wParam, (LPARAM)buffer, result, arg );
783 if (*result >= 0)
785 DWORD len;
786 RtlMultiByteToUnicodeN( (LPWSTR)lParam, ~0u, &len, buffer, strlen(buffer) + 1 );
787 *result = len / sizeof(WCHAR) - 1;
790 else ret = callback( hwnd, msg, wParam, lParam, result, arg );
791 break;
793 case EM_GETLINE:
795 char *ptr, buffer[512];
796 WORD len = *(WORD *)lParam;
798 if (!(ptr = get_buffer( buffer, sizeof(buffer), len * 2 ))) break;
799 *((WORD *)ptr) = len * 2; /* store the length */
800 ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
801 if (*result)
803 DWORD reslen;
804 RtlMultiByteToUnicodeN( (LPWSTR)lParam, len*sizeof(WCHAR), &reslen, ptr, *result );
805 *result = reslen / sizeof(WCHAR);
806 if (*result < len) ((LPWSTR)lParam)[*result] = 0;
808 free_buffer( buffer, ptr );
810 break;
812 case WM_GETDLGCODE:
813 if (lParam)
815 MSG newmsg = *(MSG *)lParam;
816 switch(newmsg.message)
818 case WM_CHAR:
819 case WM_DEADCHAR:
820 case WM_SYSCHAR:
821 case WM_SYSDEADCHAR:
822 newmsg.wParam = map_wparam_char_WtoA( newmsg.wParam, 1 );
823 break;
824 case WM_IME_CHAR:
825 newmsg.wParam = map_wparam_char_WtoA( newmsg.wParam, 2 );
826 break;
828 ret = callback( hwnd, msg, wParam, (LPARAM)&newmsg, result, arg );
830 else ret = callback( hwnd, msg, wParam, lParam, result, arg );
831 break;
833 case WM_CHAR:
835 WCHAR wch = wParam;
836 char ch[2];
837 DWORD cp = get_input_codepage();
838 DWORD len = WideCharToMultiByte( cp, 0, &wch, 1, ch, 2, NULL, NULL );
839 ret = callback( hwnd, msg, (BYTE)ch[0], lParam, result, arg );
840 if (len == 2) ret = callback( hwnd, msg, (BYTE)ch[1], lParam, result, arg );
842 break;
844 case WM_CHARTOITEM:
845 case WM_MENUCHAR:
846 case WM_DEADCHAR:
847 case WM_SYSCHAR:
848 case WM_SYSDEADCHAR:
849 case EM_SETPASSWORDCHAR:
850 ret = callback( hwnd, msg, map_wparam_char_WtoA(wParam,1), lParam, result, arg );
851 break;
853 case WM_IME_CHAR:
854 ret = callback( hwnd, msg, map_wparam_char_WtoA(wParam,2), lParam, result, arg );
855 break;
857 case WM_PAINTCLIPBOARD:
858 case WM_SIZECLIPBOARD:
859 FIXME_(msg)( "message %s (%04x) needs translation, please report\n",
860 SPY_GetMsgName(msg, hwnd), msg );
861 break;
863 default:
864 ret = callback( hwnd, msg, wParam, lParam, result, arg );
865 break;
868 return ret;
872 /**********************************************************************
873 * WINPROC_call_window
875 * Call the window procedure of the specified window.
877 BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
878 LRESULT *result, BOOL unicode, enum wm_char_mapping mapping )
880 struct user_thread_info *thread_info = get_user_thread_info();
881 BOOL unicode_win, is_dialog;
882 WND *wndPtr;
883 WNDPROC func;
884 WINDOWPROC *proc;
886 if (!(wndPtr = WIN_GetPtr( hwnd ))) return FALSE;
887 if (wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
888 if (wndPtr->tid != GetCurrentThreadId())
890 WIN_ReleasePtr( wndPtr );
891 return FALSE;
893 func = wndPtr->winproc;
894 proc = handle_to_proc( wndPtr->winproc );
895 unicode_win = wndPtr->flags & WIN_ISUNICODE;
896 is_dialog = wndPtr->dlgInfo != NULL;
897 WIN_ReleasePtr( wndPtr );
899 if (thread_info->recursion_count > MAX_WINPROC_RECURSION) return FALSE;
900 thread_info->recursion_count++;
902 if (unicode)
904 if (proc == WINPROC_PROC16)
905 WINPROC_CallProcWtoA( wow_handlers.call_window_proc, hwnd, msg, wParam, lParam, result, func );
906 else if (is_dialog)
908 if (unicode_win)
910 if (proc && proc->procW)
911 call_window_proc( hwnd, msg, wParam, lParam, result, proc->procW );
912 else
913 call_window_proc( hwnd, msg, wParam, lParam, result, func );
915 else
917 if (proc && proc->procA)
918 WINPROC_CallProcWtoA( call_window_proc, hwnd, msg, wParam, lParam, result, proc->procA );
919 else
920 WINPROC_CallProcWtoA( call_window_proc, hwnd, msg, wParam, lParam, result, func );
923 else if (proc && proc->procW)
924 call_window_proc( hwnd, msg, wParam, lParam, result, proc->procW );
925 else if (proc)
926 WINPROC_CallProcWtoA( call_window_proc, hwnd, msg, wParam, lParam, result, proc->procA );
927 else if (unicode_win)
928 call_window_proc( hwnd, msg, wParam, lParam, result, func );
929 else
930 WINPROC_CallProcWtoA( call_window_proc, hwnd, msg, wParam, lParam, result, func );
932 else
934 if (proc == WINPROC_PROC16)
935 wow_handlers.call_window_proc( hwnd, msg, wParam, lParam, result, func );
936 else if (is_dialog)
938 if (unicode_win)
940 if (proc && proc->procW)
941 WINPROC_CallProcAtoW( call_window_proc, hwnd, msg, wParam, lParam, result, proc->procW, mapping );
942 else
943 WINPROC_CallProcAtoW( call_window_proc, hwnd, msg, wParam, lParam, result, func, mapping );
945 else
947 if (proc && proc->procA)
948 call_window_proc( hwnd, msg, wParam, lParam, result, proc->procA );
949 else
950 call_window_proc( hwnd, msg, wParam, lParam, result, func );
953 else if (proc && proc->procA)
954 call_window_proc( hwnd, msg, wParam, lParam, result, proc->procA );
955 else if (proc)
956 WINPROC_CallProcAtoW( call_window_proc, hwnd, msg, wParam, lParam, result, proc->procW, mapping );
957 else if (unicode_win)
958 WINPROC_CallProcAtoW( call_window_proc, hwnd, msg, wParam, lParam, result, func, mapping );
959 else
960 call_window_proc( hwnd, msg, wParam, lParam, result, func );
962 thread_info->recursion_count--;
963 return TRUE;
967 /**********************************************************************
968 * CallWindowProcA (USER32.@)
970 * The CallWindowProc() function invokes the windows procedure _func_,
971 * with _hwnd_ as the target window, the message specified by _msg_, and
972 * the message parameters _wParam_ and _lParam_.
974 * Some kinds of argument conversion may be done, I'm not sure what.
976 * CallWindowProc() may be used for windows subclassing. Use
977 * SetWindowLong() to set a new windows procedure for windows of the
978 * subclass, and handle subclassed messages in the new windows
979 * procedure. The new windows procedure may then use CallWindowProc()
980 * with _func_ set to the parent class's windows procedure to dispatch
981 * the message to the superclass.
983 * RETURNS
985 * The return value is message dependent.
987 * CONFORMANCE
989 * ECMA-234, Win32
991 LRESULT WINAPI CallWindowProcA(
992 WNDPROC func, /* [in] window procedure */
993 HWND hwnd, /* [in] target window */
994 UINT msg, /* [in] message */
995 WPARAM wParam, /* [in] message dependent parameter */
996 LPARAM lParam /* [in] message dependent parameter */
998 WINDOWPROC *proc;
999 LRESULT result;
1001 if (!func) return 0;
1003 if (!(proc = handle_to_proc( func )))
1004 call_window_proc( hwnd, msg, wParam, lParam, &result, func );
1005 else if (proc == WINPROC_PROC16)
1006 wow_handlers.call_window_proc( hwnd, msg, wParam, lParam, &result, func );
1007 else if (proc->procA)
1008 call_window_proc( hwnd, msg, wParam, lParam, &result, proc->procA );
1009 else
1010 WINPROC_CallProcAtoW( call_window_proc, hwnd, msg, wParam, lParam, &result,
1011 proc->procW, WMCHAR_MAP_CALLWINDOWPROC );
1012 return result;
1016 /**********************************************************************
1017 * CallWindowProcW (USER32.@)
1019 * See CallWindowProcA.
1021 LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg,
1022 WPARAM wParam, LPARAM lParam )
1024 WINDOWPROC *proc;
1025 LRESULT result;
1027 if (!func) return 0;
1029 if (!(proc = handle_to_proc( func )))
1030 call_window_proc( hwnd, msg, wParam, lParam, &result, func );
1031 else if (proc == WINPROC_PROC16)
1032 WINPROC_CallProcWtoA( wow_handlers.call_window_proc, hwnd, msg, wParam, lParam, &result, func );
1033 else if (proc->procW)
1034 call_window_proc( hwnd, msg, wParam, lParam, &result, proc->procW );
1035 else
1036 WINPROC_CallProcWtoA( call_window_proc, hwnd, msg, wParam, lParam, &result, proc->procA );
1037 return result;
1041 /**********************************************************************
1042 * WINPROC_CallDlgProcA
1044 INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1046 WINDOWPROC *proc;
1047 LRESULT result;
1048 INT_PTR ret;
1050 if (!func) return 0;
1052 if (!(proc = handle_to_proc( func )))
1053 ret = call_dialog_proc( hwnd, msg, wParam, lParam, &result, func );
1054 else if (proc == WINPROC_PROC16)
1056 ret = wow_handlers.call_dialog_proc( hwnd, msg, wParam, lParam, &result, func );
1057 SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, result );
1059 else
1060 ret = call_dialog_proc( hwnd, msg, wParam, lParam, &result, proc->procW ? proc->procW : proc->procA );
1062 return ret;
1066 /**********************************************************************
1067 * WINPROC_CallDlgProcW
1069 INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1071 WINDOWPROC *proc;
1072 LRESULT result;
1073 INT_PTR ret;
1075 if (!func) return 0;
1077 if (!(proc = handle_to_proc( func )))
1078 ret = call_dialog_proc( hwnd, msg, wParam, lParam, &result, func );
1079 else if (proc == WINPROC_PROC16)
1081 ret = WINPROC_CallProcWtoA( wow_handlers.call_dialog_proc, hwnd, msg, wParam, lParam, &result, func );
1082 SetWindowLongPtrW( hwnd, DWLP_MSGRESULT, result );
1084 else
1085 ret = call_dialog_proc( hwnd, msg, wParam, lParam, &result, proc->procW ? proc->procW : proc->procA );
1087 return ret;
1091 /***********************************************************************
1092 * Window procedures for builtin classes
1095 static LRESULT WINAPI ButtonWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1097 return wow_handlers.button_proc( hwnd, msg, wParam, lParam, FALSE );
1100 static LRESULT WINAPI ButtonWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1102 return wow_handlers.button_proc( hwnd, msg, wParam, lParam, TRUE );
1105 static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
1107 return wow_handlers.combo_proc( hwnd, message, wParam, lParam, FALSE );
1110 static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
1112 return wow_handlers.combo_proc( hwnd, message, wParam, lParam, TRUE );
1115 LRESULT WINAPI EditWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1117 return wow_handlers.edit_proc( hwnd, msg, wParam, lParam, FALSE );
1120 static LRESULT WINAPI EditWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1122 return wow_handlers.edit_proc( hwnd, msg, wParam, lParam, TRUE );
1125 static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1127 return wow_handlers.listbox_proc( hwnd, msg, wParam, lParam, FALSE );
1130 static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1132 return wow_handlers.listbox_proc( hwnd, msg, wParam, lParam, TRUE );
1135 static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1137 return wow_handlers.mdiclient_proc( hwnd, msg, wParam, lParam, FALSE );
1140 static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1142 return wow_handlers.mdiclient_proc( hwnd, msg, wParam, lParam, TRUE );
1145 static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1147 return wow_handlers.scrollbar_proc( hwnd, msg, wParam, lParam, FALSE );
1150 static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1152 return wow_handlers.scrollbar_proc( hwnd, msg, wParam, lParam, TRUE );
1155 static LRESULT WINAPI StaticWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1157 return wow_handlers.static_proc( hwnd, msg, wParam, lParam, FALSE );
1160 static LRESULT WINAPI StaticWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1162 return wow_handlers.static_proc( hwnd, msg, wParam, lParam, TRUE );
1165 static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags )
1167 DWORD ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
1168 if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution();
1169 if ((mask & QS_INPUT) == QS_INPUT) get_user_thread_info()->message_count = 0;
1170 return ret;
1173 /**********************************************************************
1174 * UserRegisterWowHandlers (USER32.@)
1176 * NOTE: no attempt has been made to be compatible here,
1177 * the Windows function is most likely completely different.
1179 void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wow_handlers32 *orig )
1181 orig->button_proc = ButtonWndProc_common;
1182 orig->combo_proc = ComboWndProc_common;
1183 orig->edit_proc = EditWndProc_common;
1184 orig->listbox_proc = ListBoxWndProc_common;
1185 orig->mdiclient_proc = MDIClientWndProc_common;
1186 orig->scrollbar_proc = ScrollBarWndProc_common;
1187 orig->static_proc = StaticWndProc_common;
1188 orig->wait_message = wait_message;
1189 orig->create_window = WIN_CreateWindowEx;
1190 orig->get_win_handle = WIN_GetFullHandle;
1191 orig->alloc_winproc = WINPROC_AllocProc;
1192 orig->get_dialog_info = DIALOG_get_info;
1193 orig->dialog_box_loop = DIALOG_DoDialogBox;
1194 orig->get_icon_param = get_icon_param;
1195 orig->set_icon_param = set_icon_param;
1197 wow_handlers = *new;
1200 struct wow_handlers16 wow_handlers =
1202 ButtonWndProc_common,
1203 ComboWndProc_common,
1204 EditWndProc_common,
1205 ListBoxWndProc_common,
1206 MDIClientWndProc_common,
1207 ScrollBarWndProc_common,
1208 StaticWndProc_common,
1209 wait_message,
1210 WIN_CreateWindowEx,
1211 NULL, /* call_window_proc */
1212 NULL, /* call_dialog_proc */
1213 NULL, /* free_icon_param */