user: Added fast W->A mapping for WM_GETTEXT and WM_ASKCBFORNAME.
[wine] / dlls / user / driver.c
1 /*
2  * USER driver support
3  *
4  * Copyright 2000, 2005 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26
27 #include "user_private.h"
28 #include "wine/debug.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(user);
31
32 static const USER_DRIVER null_driver, lazy_load_driver;
33
34 const USER_DRIVER *USER_Driver = &lazy_load_driver;
35 static DWORD driver_load_error;
36
37 /* load the graphics driver */
38 static const USER_DRIVER *load_driver(void)
39 {
40     char buffer[MAX_PATH], libname[32], *name, *next;
41     HKEY hkey;
42     void *ptr;
43     HMODULE graphics_driver;
44     USER_DRIVER *driver, *prev;
45
46     strcpy( buffer, "x11" );  /* default value */
47     /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
48     if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
49     {
50         DWORD type, count = sizeof(buffer);
51         RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
52         RegCloseKey( hkey );
53     }
54
55     name = buffer;
56     while (name)
57     {
58         next = strchr( name, ',' );
59         if (next) *next++ = 0;
60
61         snprintf( libname, sizeof(libname), "wine%s.drv", name );
62         if ((graphics_driver = LoadLibraryA( libname )) != 0) break;
63         name = next;
64     }
65
66     if (!graphics_driver)
67         driver_load_error = GetLastError();
68
69     driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
70     memcpy( driver, &null_driver, sizeof(*driver) );
71
72     if (graphics_driver)
73     {
74 #define GET_USER_FUNC(name) \
75     do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0)
76
77         GET_USER_FUNC(ActivateKeyboardLayout);
78         GET_USER_FUNC(Beep);
79         GET_USER_FUNC(GetAsyncKeyState);
80         GET_USER_FUNC(GetKeyNameText);
81         GET_USER_FUNC(GetKeyboardLayout);
82         GET_USER_FUNC(GetKeyboardLayoutList);
83         GET_USER_FUNC(GetKeyboardLayoutName);
84         GET_USER_FUNC(LoadKeyboardLayout);
85         GET_USER_FUNC(MapVirtualKeyEx);
86         GET_USER_FUNC(SendInput);
87         GET_USER_FUNC(ToUnicodeEx);
88         GET_USER_FUNC(UnloadKeyboardLayout);
89         GET_USER_FUNC(VkKeyScanEx);
90         GET_USER_FUNC(SetCursor);
91         GET_USER_FUNC(GetCursorPos);
92         GET_USER_FUNC(SetCursorPos);
93         GET_USER_FUNC(GetScreenSaveActive);
94         GET_USER_FUNC(SetScreenSaveActive);
95         GET_USER_FUNC(AcquireClipboard);
96         GET_USER_FUNC(EmptyClipboard);
97         GET_USER_FUNC(SetClipboardData);
98         GET_USER_FUNC(GetClipboardData);
99         GET_USER_FUNC(CountClipboardFormats);
100         GET_USER_FUNC(EnumClipboardFormats);
101         GET_USER_FUNC(IsClipboardFormatAvailable);
102         GET_USER_FUNC(RegisterClipboardFormat);
103         GET_USER_FUNC(GetClipboardFormatName);
104         GET_USER_FUNC(EndClipboardUpdate);
105         GET_USER_FUNC(ResetSelectionOwner);
106         GET_USER_FUNC(ChangeDisplaySettingsEx);
107         GET_USER_FUNC(EnumDisplaySettingsEx);
108         GET_USER_FUNC(CreateDesktopWindow);
109         GET_USER_FUNC(CreateWindow);
110         GET_USER_FUNC(DestroyWindow);
111         GET_USER_FUNC(GetDCEx);
112         GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
113         GET_USER_FUNC(ReleaseDC);
114         GET_USER_FUNC(ScrollDC);
115         GET_USER_FUNC(SetFocus);
116         GET_USER_FUNC(SetParent);
117         GET_USER_FUNC(SetWindowPos);
118         GET_USER_FUNC(SetWindowRgn);
119         GET_USER_FUNC(SetWindowIcon);
120         GET_USER_FUNC(SetWindowStyle);
121         GET_USER_FUNC(SetWindowText);
122         GET_USER_FUNC(ShowWindow);
123         GET_USER_FUNC(SysCommandSizeMove);
124         GET_USER_FUNC(WindowFromDC);
125         GET_USER_FUNC(WindowMessage);
126 #undef GET_USER_FUNC
127     }
128
129     prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, (void *)&lazy_load_driver );
130     if (prev != &lazy_load_driver)
131     {
132         /* another thread beat us to it */
133         HeapFree( GetProcessHeap(), 0, driver );
134         FreeLibrary( graphics_driver );
135         driver = prev;
136     }
137     return driver;
138 }
139
140 /* unload the graphics driver on process exit */
141 void USER_unload_driver(void)
142 {
143     /* make sure we don't try to call the driver after it has been detached */
144     USER_Driver = &null_driver;
145 }
146
147
148 /**********************************************************************
149  * Null user driver
150  *
151  * These are fallbacks for entry points that are not implemented in the real driver.
152  */
153
154 static HKL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
155 {
156     return 0;
157 }
158
159 static void nulldrv_Beep(void)
160 {
161 }
162
163 static SHORT nulldrv_GetAsyncKeyState( INT key )
164 {
165     return 0;
166 }
167
168 static INT nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
169 {
170     return 0;
171 }
172
173 static HKL nulldrv_GetKeyboardLayout( DWORD layout )
174 {
175     return 0;
176 }
177
178 static UINT nulldrv_GetKeyboardLayoutList( INT count, HKL *layouts )
179 {
180     return 0;
181 }
182
183 static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name )
184 {
185     return FALSE;
186 }
187
188 static HKL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
189 {
190     return 0;
191 }
192
193 static UINT nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
194 {
195     return 0;
196 }
197
198 static UINT nulldrv_SendInput( UINT count, LPINPUT inputs, int size )
199 {
200     return 0;
201 }
202
203 static INT nulldrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
204                                 int size, UINT flags, HKL layout )
205 {
206     return 0;
207 }
208
209 static BOOL nulldrv_UnloadKeyboardLayout( HKL layout )
210 {
211     return 0;
212 }
213
214 static SHORT nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
215 {
216     return -1;
217 }
218
219 static void nulldrv_SetCursor( struct tagCURSORICONINFO *info )
220 {
221 }
222
223 static BOOL nulldrv_GetCursorPos( LPPOINT pt )
224 {
225     return FALSE;
226 }
227
228 static BOOL nulldrv_SetCursorPos( INT x, INT y )
229 {
230     return FALSE;
231 }
232
233 static BOOL nulldrv_GetScreenSaveActive(void)
234 {
235     return FALSE;
236 }
237
238 static void nulldrv_SetScreenSaveActive( BOOL on )
239 {
240 }
241
242 static void nulldrv_AcquireClipboard( HWND hwnd )
243 {
244 }
245
246 static BOOL nulldrv_CountClipboardFormats(void)
247 {
248     return 0;
249 }
250
251 static void nulldrv_EmptyClipboard( BOOL keepunowned )
252 {
253 }
254
255 static void nulldrv_EndClipboardUpdate(void)
256 {
257 }
258
259 static UINT nulldrv_EnumClipboardFormats( UINT format )
260 {
261     return 0;
262 }
263
264 static BOOL nulldrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
265 {
266     return FALSE;
267 }
268
269 static INT nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
270 {
271     return FALSE;
272 }
273
274 static BOOL nulldrv_IsClipboardFormatAvailable( UINT format )
275 {
276     return FALSE;
277 }
278
279 static UINT nulldrv_RegisterClipboardFormat( LPCWSTR name )
280 {
281     return 0;
282 }
283
284 static void nulldrv_ResetSelectionOwner( HWND hwnd, BOOL flag )
285 {
286 }
287
288 static BOOL nulldrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
289 {
290     return FALSE;
291 }
292
293 static LONG nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
294                                              DWORD flags, LPVOID lparam )
295 {
296     return DISP_CHANGE_FAILED;
297 }
298
299 static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
300 {
301     return FALSE;
302 }
303
304 static BOOL nulldrv_CreateDesktopWindow( HWND hwnd )
305 {
306     return TRUE;
307 }
308
309 static BOOL nulldrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
310 {
311     static int warned;
312     if (warned++)
313         return FALSE;
314
315     MESSAGE( "Application tried to create a window, but no driver could be loaded.\n");
316     switch (driver_load_error)
317     {
318     case ERROR_MOD_NOT_FOUND:
319         MESSAGE( "The X11 driver is missing.  Check your build!\n" );
320         break;
321     case ERROR_DLL_INIT_FAILED:
322         MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
323         break;
324     default:
325         MESSAGE( "Unknown error (%ld).\n", driver_load_error );
326     }
327
328     return FALSE;
329 }
330
331 static void nulldrv_DestroyWindow( HWND hwnd )
332 {
333 }
334
335 static HDC nulldrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
336 {
337     return 0;
338 }
339
340 static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
341                                                   DWORD mask, DWORD flags )
342 {
343     return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
344                                      timeout, flags & MWMO_ALERTABLE );
345 }
346
347 static INT nulldrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
348 {
349     return 0;
350 }
351
352 static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
353                               HRGN hrgn, LPRECT update )
354 {
355     return FALSE;
356 }
357
358 static void nulldrv_SetFocus( HWND hwnd )
359 {
360 }
361
362 static HWND nulldrv_SetParent( HWND hwnd, HWND parent )
363 {
364     return 0;
365 }
366
367 static BOOL nulldrv_SetWindowPos( WINDOWPOS *pos )
368 {
369     return FALSE;
370 }
371
372 static int nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
373 {
374     return 1;
375 }
376
377 static void nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
378 {
379 }
380
381 static void nulldrv_SetWindowStyle( HWND hwnd, DWORD old_style )
382 {
383 }
384
385 static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
386 {
387 }
388
389 static BOOL nulldrv_ShowWindow( HWND hwnd, INT cmd )
390 {
391     return FALSE;
392 }
393
394 static void nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
395 {
396 }
397
398 static HWND nulldrv_WindowFromDC( HDC hdc )
399 {
400     return 0;
401 }
402
403 static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
404 {
405     return 0;
406 }
407
408 static const USER_DRIVER null_driver =
409 {
410     /* keyboard functions */
411     nulldrv_ActivateKeyboardLayout,
412     nulldrv_Beep,
413     nulldrv_GetAsyncKeyState,
414     nulldrv_GetKeyNameText,
415     nulldrv_GetKeyboardLayout,
416     nulldrv_GetKeyboardLayoutList,
417     nulldrv_GetKeyboardLayoutName,
418     nulldrv_LoadKeyboardLayout,
419     nulldrv_MapVirtualKeyEx,
420     nulldrv_SendInput,
421     nulldrv_ToUnicodeEx,
422     nulldrv_UnloadKeyboardLayout,
423     nulldrv_VkKeyScanEx,
424     /* mouse functions */
425     nulldrv_SetCursor,
426     nulldrv_GetCursorPos,
427     nulldrv_SetCursorPos,
428     /* screen saver functions */
429     nulldrv_GetScreenSaveActive,
430     nulldrv_SetScreenSaveActive,
431     /* clipboard functions */
432     nulldrv_AcquireClipboard,
433     nulldrv_CountClipboardFormats,
434     nulldrv_EmptyClipboard,
435     nulldrv_EndClipboardUpdate,
436     nulldrv_EnumClipboardFormats,
437     nulldrv_GetClipboardData,
438     nulldrv_GetClipboardFormatName,
439     nulldrv_IsClipboardFormatAvailable,
440     nulldrv_RegisterClipboardFormat,
441     nulldrv_ResetSelectionOwner,
442     nulldrv_SetClipboardData,
443     /* display modes */
444     nulldrv_ChangeDisplaySettingsEx,
445     nulldrv_EnumDisplaySettingsEx,
446     /* windowing functions */
447     nulldrv_CreateDesktopWindow,
448     nulldrv_CreateWindow,
449     nulldrv_DestroyWindow,
450     nulldrv_GetDCEx,
451     nulldrv_MsgWaitForMultipleObjectsEx,
452     nulldrv_ReleaseDC,
453     nulldrv_ScrollDC,
454     nulldrv_SetFocus,
455     nulldrv_SetParent,
456     nulldrv_SetWindowPos,
457     nulldrv_SetWindowRgn,
458     nulldrv_SetWindowIcon,
459     nulldrv_SetWindowStyle,
460     nulldrv_SetWindowText,
461     nulldrv_ShowWindow,
462     nulldrv_SysCommandSizeMove,
463     nulldrv_WindowFromDC,
464     nulldrv_WindowMessage
465 };
466
467
468 /**********************************************************************
469  * Lazy loading user driver
470  *
471  * Initial driver used before another driver is loaded.
472  * Each entry point simply loads the real driver and chains to it.
473  */
474
475 static HKL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
476 {
477     return load_driver()->pActivateKeyboardLayout( layout, flags );
478 }
479
480 static void loaderdrv_Beep(void)
481 {
482     load_driver()->pBeep();
483 }
484
485 static SHORT loaderdrv_GetAsyncKeyState( INT key )
486 {
487     return load_driver()->pGetAsyncKeyState( key );
488 }
489
490 static INT loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
491 {
492     return load_driver()->pGetKeyNameText( lparam, buffer, size );
493 }
494
495 static HKL loaderdrv_GetKeyboardLayout( DWORD layout )
496 {
497     return load_driver()->pGetKeyboardLayout( layout );
498 }
499
500 static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts )
501 {
502     return load_driver()->pGetKeyboardLayoutList( count, layouts );
503 }
504
505 static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
506 {
507     return load_driver()->pGetKeyboardLayoutName( name );
508 }
509
510 static HKL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
511 {
512     return load_driver()->pLoadKeyboardLayout( name, flags );
513 }
514
515 static UINT loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
516 {
517     return load_driver()->pMapVirtualKeyEx( code, type, layout );
518 }
519
520 static UINT loaderdrv_SendInput( UINT count, LPINPUT inputs, int size )
521 {
522     return load_driver()->pSendInput( count, inputs, size );
523 }
524
525 static INT loaderdrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
526                                   int size, UINT flags, HKL layout )
527 {
528     return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
529 }
530
531 static BOOL loaderdrv_UnloadKeyboardLayout( HKL layout )
532 {
533     return load_driver()->pUnloadKeyboardLayout( layout );
534 }
535
536 static SHORT loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
537 {
538     return load_driver()->pVkKeyScanEx( ch, layout );
539 }
540
541 static void loaderdrv_SetCursor( struct tagCURSORICONINFO *info )
542 {
543     load_driver()->pSetCursor( info );
544 }
545
546 static BOOL loaderdrv_GetCursorPos( LPPOINT pt )
547 {
548     return load_driver()->pGetCursorPos( pt );
549 }
550
551 static BOOL loaderdrv_SetCursorPos( INT x, INT y )
552 {
553     return load_driver()->pSetCursorPos( x, y );
554 }
555
556 static BOOL loaderdrv_GetScreenSaveActive(void)
557 {
558     return load_driver()->pGetScreenSaveActive();
559 }
560
561 static void loaderdrv_SetScreenSaveActive( BOOL on )
562 {
563     load_driver()->pSetScreenSaveActive( on );
564 }
565
566 static void loaderdrv_AcquireClipboard( HWND hwnd )
567 {
568     load_driver()->pAcquireClipboard( hwnd );
569 }
570
571 static BOOL loaderdrv_CountClipboardFormats(void)
572 {
573     return load_driver()->pCountClipboardFormats();
574 }
575
576 static void loaderdrv_EmptyClipboard( BOOL keepunowned )
577 {
578     load_driver()->pEmptyClipboard( keepunowned );
579 }
580
581 static void loaderdrv_EndClipboardUpdate(void)
582 {
583     load_driver()->pEndClipboardUpdate();
584 }
585
586 static UINT loaderdrv_EnumClipboardFormats( UINT format )
587 {
588     return load_driver()->pEnumClipboardFormats( format );
589 }
590
591 static BOOL loaderdrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
592 {
593     return load_driver()->pGetClipboardData( format, h16, h32 );
594 }
595
596 static INT loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
597 {
598     return load_driver()->pGetClipboardFormatName( format, buffer, len );
599 }
600
601 static BOOL loaderdrv_IsClipboardFormatAvailable( UINT format )
602 {
603     return load_driver()->pIsClipboardFormatAvailable( format );
604 }
605
606 static UINT loaderdrv_RegisterClipboardFormat( LPCWSTR name )
607 {
608     return load_driver()->pRegisterClipboardFormat( name );
609 }
610
611 static void loaderdrv_ResetSelectionOwner( HWND hwnd, BOOL flag )
612 {
613     load_driver()->pResetSelectionOwner( hwnd, flag );
614 }
615
616 static BOOL loaderdrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
617 {
618     return load_driver()->pSetClipboardData( format, h16, h32, owner );
619 }
620
621 static LONG loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
622                                                DWORD flags, LPVOID lparam )
623 {
624     return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
625 }
626
627 static BOOL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
628 {
629     return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
630 }
631
632 static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd )
633 {
634     return load_driver()->pCreateDesktopWindow( hwnd );
635 }
636
637 static BOOL loaderdrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
638 {
639     return load_driver()->pCreateWindow( hwnd, cs, unicode );
640 }
641
642 static void loaderdrv_DestroyWindow( HWND hwnd )
643 {
644     load_driver()->pDestroyWindow( hwnd );
645 }
646
647 static HDC loaderdrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
648 {
649     return load_driver()->pGetDCEx( hwnd, hrgn, flags );
650 }
651
652 static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
653                                                     DWORD mask, DWORD flags )
654 {
655     return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
656 }
657
658 static INT loaderdrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
659 {
660     return load_driver()->pReleaseDC( hwnd, hdc, end_paint );
661 }
662
663 static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
664                                 HRGN hrgn, LPRECT update )
665 {
666     return load_driver()->pScrollDC( hdc, dx, dy, scroll, clip, hrgn, update );
667 }
668
669 static void loaderdrv_SetFocus( HWND hwnd )
670 {
671     load_driver()->pSetFocus( hwnd );
672 }
673
674 static HWND loaderdrv_SetParent( HWND hwnd, HWND parent )
675 {
676     return load_driver()->pSetParent( hwnd, parent );
677 }
678
679 static BOOL loaderdrv_SetWindowPos( WINDOWPOS *pos )
680 {
681     return load_driver()->pSetWindowPos( pos );
682 }
683
684 static int loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
685 {
686     return load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
687 }
688
689 static void loaderdrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
690 {
691     load_driver()->pSetWindowIcon( hwnd, type, icon );
692 }
693
694 static void loaderdrv_SetWindowStyle( HWND hwnd, DWORD old_style )
695 {
696     load_driver()->pSetWindowStyle( hwnd, old_style );
697 }
698
699 static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
700 {
701     load_driver()->pSetWindowText( hwnd, text );
702 }
703
704 static BOOL loaderdrv_ShowWindow( HWND hwnd, INT cmd )
705 {
706     return load_driver()->pShowWindow( hwnd, cmd );
707 }
708
709 static void loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
710 {
711     load_driver()->pSysCommandSizeMove( hwnd, wparam );
712 }
713
714 static HWND loaderdrv_WindowFromDC( HDC hdc )
715 {
716     return load_driver()->pWindowFromDC( hdc );
717 }
718
719 static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
720 {
721     return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
722 }
723
724 static const USER_DRIVER lazy_load_driver =
725 {
726     /* keyboard functions */
727     loaderdrv_ActivateKeyboardLayout,
728     loaderdrv_Beep,
729     loaderdrv_GetAsyncKeyState,
730     loaderdrv_GetKeyNameText,
731     loaderdrv_GetKeyboardLayout,
732     loaderdrv_GetKeyboardLayoutList,
733     loaderdrv_GetKeyboardLayoutName,
734     loaderdrv_LoadKeyboardLayout,
735     loaderdrv_MapVirtualKeyEx,
736     loaderdrv_SendInput,
737     loaderdrv_ToUnicodeEx,
738     loaderdrv_UnloadKeyboardLayout,
739     loaderdrv_VkKeyScanEx,
740     /* mouse functions */
741     loaderdrv_SetCursor,
742     loaderdrv_GetCursorPos,
743     loaderdrv_SetCursorPos,
744     /* screen saver functions */
745     loaderdrv_GetScreenSaveActive,
746     loaderdrv_SetScreenSaveActive,
747     /* clipboard functions */
748     loaderdrv_AcquireClipboard,
749     loaderdrv_CountClipboardFormats,
750     loaderdrv_EmptyClipboard,
751     loaderdrv_EndClipboardUpdate,
752     loaderdrv_EnumClipboardFormats,
753     loaderdrv_GetClipboardData,
754     loaderdrv_GetClipboardFormatName,
755     loaderdrv_IsClipboardFormatAvailable,
756     loaderdrv_RegisterClipboardFormat,
757     loaderdrv_ResetSelectionOwner,
758     loaderdrv_SetClipboardData,
759     /* display modes */
760     loaderdrv_ChangeDisplaySettingsEx,
761     loaderdrv_EnumDisplaySettingsEx,
762     /* windowing functions */
763     loaderdrv_CreateDesktopWindow,
764     loaderdrv_CreateWindow,
765     loaderdrv_DestroyWindow,
766     loaderdrv_GetDCEx,
767     loaderdrv_MsgWaitForMultipleObjectsEx,
768     loaderdrv_ReleaseDC,
769     loaderdrv_ScrollDC,
770     loaderdrv_SetFocus,
771     loaderdrv_SetParent,
772     loaderdrv_SetWindowPos,
773     loaderdrv_SetWindowRgn,
774     loaderdrv_SetWindowIcon,
775     loaderdrv_SetWindowStyle,
776     loaderdrv_SetWindowText,
777     loaderdrv_ShowWindow,
778     loaderdrv_SysCommandSizeMove,
779     loaderdrv_WindowFromDC,
780     loaderdrv_WindowMessage
781 };