rpcrt4: Fix a typo in rpcrt4_conn_tcp_read.
[wine] / dlls / user32 / 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "wine/debug.h"
27
28 #include "user_private.h"
29
30 static const USER_DRIVER null_driver, lazy_load_driver;
31
32 const USER_DRIVER *USER_Driver = &lazy_load_driver;
33 static DWORD driver_load_error;
34
35 /* load the graphics driver */
36 static const USER_DRIVER *load_driver(void)
37 {
38     char buffer[MAX_PATH], libname[32], *name, *next;
39     HKEY hkey;
40     void *ptr;
41     HMODULE graphics_driver;
42     USER_DRIVER *driver, *prev;
43
44     strcpy( buffer, "x11" );  /* default value */
45     /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
46     if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
47     {
48         DWORD type, count = sizeof(buffer);
49         RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
50         RegCloseKey( hkey );
51     }
52
53     name = buffer;
54     while (name)
55     {
56         next = strchr( name, ',' );
57         if (next) *next++ = 0;
58
59         snprintf( libname, sizeof(libname), "wine%s.drv", name );
60         if ((graphics_driver = LoadLibraryA( libname )) != 0) break;
61         name = next;
62     }
63
64     if (!graphics_driver)
65         driver_load_error = GetLastError();
66
67     driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
68     memcpy( driver, &null_driver, sizeof(*driver) );
69
70     if (graphics_driver)
71     {
72 #define GET_USER_FUNC(name) \
73     do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0)
74
75         GET_USER_FUNC(ActivateKeyboardLayout);
76         GET_USER_FUNC(Beep);
77         GET_USER_FUNC(GetAsyncKeyState);
78         GET_USER_FUNC(GetKeyNameText);
79         GET_USER_FUNC(GetKeyboardLayout);
80         GET_USER_FUNC(GetKeyboardLayoutList);
81         GET_USER_FUNC(GetKeyboardLayoutName);
82         GET_USER_FUNC(LoadKeyboardLayout);
83         GET_USER_FUNC(MapVirtualKeyEx);
84         GET_USER_FUNC(SendInput);
85         GET_USER_FUNC(ToUnicodeEx);
86         GET_USER_FUNC(UnloadKeyboardLayout);
87         GET_USER_FUNC(VkKeyScanEx);
88         GET_USER_FUNC(SetCursor);
89         GET_USER_FUNC(GetCursorPos);
90         GET_USER_FUNC(SetCursorPos);
91         GET_USER_FUNC(ClipCursor);
92         GET_USER_FUNC(GetScreenSaveActive);
93         GET_USER_FUNC(SetScreenSaveActive);
94         GET_USER_FUNC(AcquireClipboard);
95         GET_USER_FUNC(EmptyClipboard);
96         GET_USER_FUNC(SetClipboardData);
97         GET_USER_FUNC(GetClipboardData);
98         GET_USER_FUNC(CountClipboardFormats);
99         GET_USER_FUNC(EnumClipboardFormats);
100         GET_USER_FUNC(IsClipboardFormatAvailable);
101         GET_USER_FUNC(RegisterClipboardFormat);
102         GET_USER_FUNC(GetClipboardFormatName);
103         GET_USER_FUNC(EndClipboardUpdate);
104         GET_USER_FUNC(ChangeDisplaySettingsEx);
105         GET_USER_FUNC(EnumDisplayMonitors);
106         GET_USER_FUNC(EnumDisplaySettingsEx);
107         GET_USER_FUNC(GetMonitorInfo);
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_ClipCursor( LPCRECT clip )
234 {
235     return FALSE;
236 }
237
238 static BOOL nulldrv_GetScreenSaveActive(void)
239 {
240     return FALSE;
241 }
242
243 static void nulldrv_SetScreenSaveActive( BOOL on )
244 {
245 }
246
247 static INT nulldrv_AcquireClipboard( HWND hwnd )
248 {
249     return 0;
250 }
251
252 static BOOL nulldrv_CountClipboardFormats(void)
253 {
254     return 0;
255 }
256
257 static void nulldrv_EmptyClipboard( BOOL keepunowned )
258 {
259 }
260
261 static void nulldrv_EndClipboardUpdate(void)
262 {
263 }
264
265 static UINT nulldrv_EnumClipboardFormats( UINT format )
266 {
267     return 0;
268 }
269
270 static BOOL nulldrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
271 {
272     return FALSE;
273 }
274
275 static INT nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
276 {
277     return FALSE;
278 }
279
280 static BOOL nulldrv_IsClipboardFormatAvailable( UINT format )
281 {
282     return FALSE;
283 }
284
285 static UINT nulldrv_RegisterClipboardFormat( LPCWSTR name )
286 {
287     return 0;
288 }
289
290 static BOOL nulldrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
291 {
292     return FALSE;
293 }
294
295 static LONG nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
296                                              DWORD flags, LPVOID lparam )
297 {
298     return DISP_CHANGE_FAILED;
299 }
300
301 static BOOL nulldrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
302 {
303     return FALSE;
304 }
305
306 static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
307 {
308     return FALSE;
309 }
310
311 static BOOL nulldrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
312 {
313     return FALSE;
314 }
315
316 static BOOL nulldrv_CreateDesktopWindow( HWND hwnd )
317 {
318     return TRUE;
319 }
320
321 static BOOL nulldrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
322 {
323     static int warned;
324     if (warned++)
325         return FALSE;
326
327     MESSAGE( "Application tried to create a window, but no driver could be loaded.\n");
328     switch (driver_load_error)
329     {
330     case ERROR_MOD_NOT_FOUND:
331         MESSAGE( "The X11 driver is missing.  Check your build!\n" );
332         break;
333     case ERROR_DLL_INIT_FAILED:
334         MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
335         break;
336     default:
337         MESSAGE( "Unknown error (%d).\n", driver_load_error );
338     }
339
340     return FALSE;
341 }
342
343 static void nulldrv_DestroyWindow( HWND hwnd )
344 {
345 }
346
347 static HDC nulldrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
348 {
349     return 0;
350 }
351
352 static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
353                                                   DWORD mask, DWORD flags )
354 {
355     return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
356                                      timeout, flags & MWMO_ALERTABLE );
357 }
358
359 static INT nulldrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
360 {
361     return 0;
362 }
363
364 static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
365                               HRGN hrgn, LPRECT update )
366 {
367     return FALSE;
368 }
369
370 static void nulldrv_SetFocus( HWND hwnd )
371 {
372 }
373
374 static void nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
375 {
376 }
377
378 static BOOL nulldrv_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
379                                   const RECT *rectClient, UINT swp_flags, const RECT *valid_rects )
380 {
381     return FALSE;
382 }
383
384 static int nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
385 {
386     return 1;
387 }
388
389 static void nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
390 {
391 }
392
393 static void nulldrv_SetWindowStyle( HWND hwnd, DWORD old_style )
394 {
395 }
396
397 static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
398 {
399 }
400
401 static BOOL nulldrv_ShowWindow( HWND hwnd, INT cmd )
402 {
403     return FALSE;
404 }
405
406 static void nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
407 {
408 }
409
410 static HWND nulldrv_WindowFromDC( HDC hdc )
411 {
412     return 0;
413 }
414
415 static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
416 {
417     return 0;
418 }
419
420 static const USER_DRIVER null_driver =
421 {
422     /* keyboard functions */
423     nulldrv_ActivateKeyboardLayout,
424     nulldrv_Beep,
425     nulldrv_GetAsyncKeyState,
426     nulldrv_GetKeyNameText,
427     nulldrv_GetKeyboardLayout,
428     nulldrv_GetKeyboardLayoutList,
429     nulldrv_GetKeyboardLayoutName,
430     nulldrv_LoadKeyboardLayout,
431     nulldrv_MapVirtualKeyEx,
432     nulldrv_SendInput,
433     nulldrv_ToUnicodeEx,
434     nulldrv_UnloadKeyboardLayout,
435     nulldrv_VkKeyScanEx,
436     /* mouse functions */
437     nulldrv_SetCursor,
438     nulldrv_GetCursorPos,
439     nulldrv_SetCursorPos,
440     nulldrv_ClipCursor,
441     /* screen saver functions */
442     nulldrv_GetScreenSaveActive,
443     nulldrv_SetScreenSaveActive,
444     /* clipboard functions */
445     nulldrv_AcquireClipboard,
446     nulldrv_CountClipboardFormats,
447     nulldrv_EmptyClipboard,
448     nulldrv_EndClipboardUpdate,
449     nulldrv_EnumClipboardFormats,
450     nulldrv_GetClipboardData,
451     nulldrv_GetClipboardFormatName,
452     nulldrv_IsClipboardFormatAvailable,
453     nulldrv_RegisterClipboardFormat,
454     nulldrv_SetClipboardData,
455     /* display modes */
456     nulldrv_ChangeDisplaySettingsEx,
457     nulldrv_EnumDisplayMonitors,
458     nulldrv_EnumDisplaySettingsEx,
459     nulldrv_GetMonitorInfo,
460     /* windowing functions */
461     nulldrv_CreateDesktopWindow,
462     nulldrv_CreateWindow,
463     nulldrv_DestroyWindow,
464     nulldrv_GetDCEx,
465     nulldrv_MsgWaitForMultipleObjectsEx,
466     nulldrv_ReleaseDC,
467     nulldrv_ScrollDC,
468     nulldrv_SetFocus,
469     nulldrv_SetParent,
470     nulldrv_SetWindowPos,
471     nulldrv_SetWindowRgn,
472     nulldrv_SetWindowIcon,
473     nulldrv_SetWindowStyle,
474     nulldrv_SetWindowText,
475     nulldrv_ShowWindow,
476     nulldrv_SysCommandSizeMove,
477     nulldrv_WindowFromDC,
478     nulldrv_WindowMessage
479 };
480
481
482 /**********************************************************************
483  * Lazy loading user driver
484  *
485  * Initial driver used before another driver is loaded.
486  * Each entry point simply loads the real driver and chains to it.
487  */
488
489 static HKL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
490 {
491     return load_driver()->pActivateKeyboardLayout( layout, flags );
492 }
493
494 static void loaderdrv_Beep(void)
495 {
496     load_driver()->pBeep();
497 }
498
499 static SHORT loaderdrv_GetAsyncKeyState( INT key )
500 {
501     return load_driver()->pGetAsyncKeyState( key );
502 }
503
504 static INT loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
505 {
506     return load_driver()->pGetKeyNameText( lparam, buffer, size );
507 }
508
509 static HKL loaderdrv_GetKeyboardLayout( DWORD layout )
510 {
511     return load_driver()->pGetKeyboardLayout( layout );
512 }
513
514 static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts )
515 {
516     return load_driver()->pGetKeyboardLayoutList( count, layouts );
517 }
518
519 static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
520 {
521     return load_driver()->pGetKeyboardLayoutName( name );
522 }
523
524 static HKL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
525 {
526     return load_driver()->pLoadKeyboardLayout( name, flags );
527 }
528
529 static UINT loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
530 {
531     return load_driver()->pMapVirtualKeyEx( code, type, layout );
532 }
533
534 static UINT loaderdrv_SendInput( UINT count, LPINPUT inputs, int size )
535 {
536     return load_driver()->pSendInput( count, inputs, size );
537 }
538
539 static INT loaderdrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
540                                   int size, UINT flags, HKL layout )
541 {
542     return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
543 }
544
545 static BOOL loaderdrv_UnloadKeyboardLayout( HKL layout )
546 {
547     return load_driver()->pUnloadKeyboardLayout( layout );
548 }
549
550 static SHORT loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
551 {
552     return load_driver()->pVkKeyScanEx( ch, layout );
553 }
554
555 static void loaderdrv_SetCursor( struct tagCURSORICONINFO *info )
556 {
557     load_driver()->pSetCursor( info );
558 }
559
560 static BOOL loaderdrv_GetCursorPos( LPPOINT pt )
561 {
562     return load_driver()->pGetCursorPos( pt );
563 }
564
565 static BOOL loaderdrv_SetCursorPos( INT x, INT y )
566 {
567     return load_driver()->pSetCursorPos( x, y );
568 }
569
570 static BOOL loaderdrv_ClipCursor( LPCRECT clip )
571 {
572     return load_driver()->pClipCursor( clip );
573 }
574
575 static BOOL loaderdrv_GetScreenSaveActive(void)
576 {
577     return load_driver()->pGetScreenSaveActive();
578 }
579
580 static void loaderdrv_SetScreenSaveActive( BOOL on )
581 {
582     load_driver()->pSetScreenSaveActive( on );
583 }
584
585 static INT loaderdrv_AcquireClipboard( HWND hwnd )
586 {
587     return load_driver()->pAcquireClipboard( hwnd );
588 }
589
590 static BOOL loaderdrv_CountClipboardFormats(void)
591 {
592     return load_driver()->pCountClipboardFormats();
593 }
594
595 static void loaderdrv_EmptyClipboard( BOOL keepunowned )
596 {
597     load_driver()->pEmptyClipboard( keepunowned );
598 }
599
600 static void loaderdrv_EndClipboardUpdate(void)
601 {
602     load_driver()->pEndClipboardUpdate();
603 }
604
605 static UINT loaderdrv_EnumClipboardFormats( UINT format )
606 {
607     return load_driver()->pEnumClipboardFormats( format );
608 }
609
610 static BOOL loaderdrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
611 {
612     return load_driver()->pGetClipboardData( format, h16, h32 );
613 }
614
615 static INT loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
616 {
617     return load_driver()->pGetClipboardFormatName( format, buffer, len );
618 }
619
620 static BOOL loaderdrv_IsClipboardFormatAvailable( UINT format )
621 {
622     return load_driver()->pIsClipboardFormatAvailable( format );
623 }
624
625 static UINT loaderdrv_RegisterClipboardFormat( LPCWSTR name )
626 {
627     return load_driver()->pRegisterClipboardFormat( name );
628 }
629
630 static BOOL loaderdrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
631 {
632     return load_driver()->pSetClipboardData( format, h16, h32, owner );
633 }
634
635 static LONG loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
636                                                DWORD flags, LPVOID lparam )
637 {
638     return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
639 }
640
641 static BOOL loaderdrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
642 {
643     return load_driver()->pEnumDisplayMonitors( hdc, rect, proc, lp );
644 }
645
646 static BOOL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
647 {
648     return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
649 }
650
651 static BOOL loaderdrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
652 {
653     return load_driver()->pGetMonitorInfo( handle, info );
654 }
655
656 static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd )
657 {
658     return load_driver()->pCreateDesktopWindow( hwnd );
659 }
660
661 static BOOL loaderdrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
662 {
663     return load_driver()->pCreateWindow( hwnd, cs, unicode );
664 }
665
666 static void loaderdrv_DestroyWindow( HWND hwnd )
667 {
668     load_driver()->pDestroyWindow( hwnd );
669 }
670
671 static HDC loaderdrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
672 {
673     return load_driver()->pGetDCEx( hwnd, hrgn, flags );
674 }
675
676 static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
677                                                     DWORD mask, DWORD flags )
678 {
679     return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
680 }
681
682 static INT loaderdrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
683 {
684     return load_driver()->pReleaseDC( hwnd, hdc, end_paint );
685 }
686
687 static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
688                                 HRGN hrgn, LPRECT update )
689 {
690     return load_driver()->pScrollDC( hdc, dx, dy, scroll, clip, hrgn, update );
691 }
692
693 static void loaderdrv_SetFocus( HWND hwnd )
694 {
695     load_driver()->pSetFocus( hwnd );
696 }
697
698 static void loaderdrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
699 {
700     load_driver()->pSetParent( hwnd, parent, old_parent );
701 }
702
703 static BOOL loaderdrv_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
704                                     const RECT *rectClient, UINT swp_flags, const RECT *valid_rects )
705 {
706     return load_driver()->pSetWindowPos( hwnd, insert_after, rectWindow, rectClient, swp_flags, valid_rects );
707 }
708
709 static int loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
710 {
711     return load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
712 }
713
714 static void loaderdrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
715 {
716     load_driver()->pSetWindowIcon( hwnd, type, icon );
717 }
718
719 static void loaderdrv_SetWindowStyle( HWND hwnd, DWORD old_style )
720 {
721     load_driver()->pSetWindowStyle( hwnd, old_style );
722 }
723
724 static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
725 {
726     load_driver()->pSetWindowText( hwnd, text );
727 }
728
729 static BOOL loaderdrv_ShowWindow( HWND hwnd, INT cmd )
730 {
731     return load_driver()->pShowWindow( hwnd, cmd );
732 }
733
734 static void loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
735 {
736     load_driver()->pSysCommandSizeMove( hwnd, wparam );
737 }
738
739 static HWND loaderdrv_WindowFromDC( HDC hdc )
740 {
741     return load_driver()->pWindowFromDC( hdc );
742 }
743
744 static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
745 {
746     return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
747 }
748
749 static const USER_DRIVER lazy_load_driver =
750 {
751     /* keyboard functions */
752     loaderdrv_ActivateKeyboardLayout,
753     loaderdrv_Beep,
754     loaderdrv_GetAsyncKeyState,
755     loaderdrv_GetKeyNameText,
756     loaderdrv_GetKeyboardLayout,
757     loaderdrv_GetKeyboardLayoutList,
758     loaderdrv_GetKeyboardLayoutName,
759     loaderdrv_LoadKeyboardLayout,
760     loaderdrv_MapVirtualKeyEx,
761     loaderdrv_SendInput,
762     loaderdrv_ToUnicodeEx,
763     loaderdrv_UnloadKeyboardLayout,
764     loaderdrv_VkKeyScanEx,
765     /* mouse functions */
766     loaderdrv_SetCursor,
767     loaderdrv_GetCursorPos,
768     loaderdrv_SetCursorPos,
769     loaderdrv_ClipCursor,
770     /* screen saver functions */
771     loaderdrv_GetScreenSaveActive,
772     loaderdrv_SetScreenSaveActive,
773     /* clipboard functions */
774     loaderdrv_AcquireClipboard,
775     loaderdrv_CountClipboardFormats,
776     loaderdrv_EmptyClipboard,
777     loaderdrv_EndClipboardUpdate,
778     loaderdrv_EnumClipboardFormats,
779     loaderdrv_GetClipboardData,
780     loaderdrv_GetClipboardFormatName,
781     loaderdrv_IsClipboardFormatAvailable,
782     loaderdrv_RegisterClipboardFormat,
783     loaderdrv_SetClipboardData,
784     /* display modes */
785     loaderdrv_ChangeDisplaySettingsEx,
786     loaderdrv_EnumDisplayMonitors,
787     loaderdrv_EnumDisplaySettingsEx,
788     loaderdrv_GetMonitorInfo,
789     /* windowing functions */
790     loaderdrv_CreateDesktopWindow,
791     loaderdrv_CreateWindow,
792     loaderdrv_DestroyWindow,
793     loaderdrv_GetDCEx,
794     loaderdrv_MsgWaitForMultipleObjectsEx,
795     loaderdrv_ReleaseDC,
796     loaderdrv_ScrollDC,
797     loaderdrv_SetFocus,
798     loaderdrv_SetParent,
799     loaderdrv_SetWindowPos,
800     loaderdrv_SetWindowRgn,
801     loaderdrv_SetWindowIcon,
802     loaderdrv_SetWindowStyle,
803     loaderdrv_SetWindowText,
804     loaderdrv_ShowWindow,
805     loaderdrv_SysCommandSizeMove,
806     loaderdrv_WindowFromDC,
807     loaderdrv_WindowMessage
808 };