user32: Better reflect the current state of DrawIconEx.
[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 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     *driver = null_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(GetDC);
112         GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
113         GET_USER_FUNC(ReleaseDC);
114         GET_USER_FUNC(ScrollDC);
115         GET_USER_FUNC(SetCapture);
116         GET_USER_FUNC(SetFocus);
117         GET_USER_FUNC(SetParent);
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(SysCommand);
124         GET_USER_FUNC(WindowMessage);
125         GET_USER_FUNC(WindowPosChanging);
126         GET_USER_FUNC(WindowPosChanged);
127 #undef GET_USER_FUNC
128     }
129
130     prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, &lazy_load_driver );
131     if (prev != &lazy_load_driver)
132     {
133         /* another thread beat us to it */
134         HeapFree( GetProcessHeap(), 0, driver );
135         FreeLibrary( graphics_driver );
136         driver = prev;
137     }
138     return driver;
139 }
140
141 /* unload the graphics driver on process exit */
142 void USER_unload_driver(void)
143 {
144     /* make sure we don't try to call the driver after it has been detached */
145     USER_Driver = &null_driver;
146 }
147
148
149 /**********************************************************************
150  * Null user driver
151  *
152  * These are fallbacks for entry points that are not implemented in the real driver.
153  */
154
155 static HKL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
156 {
157     return 0;
158 }
159
160 static void nulldrv_Beep(void)
161 {
162 }
163
164 static SHORT nulldrv_GetAsyncKeyState( INT key )
165 {
166     return 0;
167 }
168
169 static INT nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
170 {
171     return 0;
172 }
173
174 static HKL nulldrv_GetKeyboardLayout( DWORD layout )
175 {
176     return 0;
177 }
178
179 static UINT nulldrv_GetKeyboardLayoutList( INT count, HKL *layouts )
180 {
181     return 0;
182 }
183
184 static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name )
185 {
186     return FALSE;
187 }
188
189 static HKL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
190 {
191     return 0;
192 }
193
194 static UINT nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
195 {
196     return 0;
197 }
198
199 static UINT nulldrv_SendInput( UINT count, LPINPUT inputs, int size )
200 {
201     return 0;
202 }
203
204 static INT nulldrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
205                                 int size, UINT flags, HKL layout )
206 {
207     return 0;
208 }
209
210 static BOOL nulldrv_UnloadKeyboardLayout( HKL layout )
211 {
212     return 0;
213 }
214
215 static SHORT nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
216 {
217     return -1;
218 }
219
220 static void nulldrv_SetCursor( struct tagCURSORICONINFO *info )
221 {
222 }
223
224 static BOOL nulldrv_GetCursorPos( LPPOINT pt )
225 {
226     return FALSE;
227 }
228
229 static BOOL nulldrv_SetCursorPos( INT x, INT y )
230 {
231     return FALSE;
232 }
233
234 static BOOL nulldrv_ClipCursor( LPCRECT clip )
235 {
236     return FALSE;
237 }
238
239 static BOOL nulldrv_GetScreenSaveActive(void)
240 {
241     return FALSE;
242 }
243
244 static void nulldrv_SetScreenSaveActive( BOOL on )
245 {
246 }
247
248 static INT nulldrv_AcquireClipboard( HWND hwnd )
249 {
250     return 0;
251 }
252
253 static BOOL nulldrv_CountClipboardFormats(void)
254 {
255     return 0;
256 }
257
258 static void nulldrv_EmptyClipboard( BOOL keepunowned )
259 {
260 }
261
262 static void nulldrv_EndClipboardUpdate(void)
263 {
264 }
265
266 static UINT nulldrv_EnumClipboardFormats( UINT format )
267 {
268     return 0;
269 }
270
271 static BOOL nulldrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
272 {
273     return FALSE;
274 }
275
276 static INT nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
277 {
278     return FALSE;
279 }
280
281 static BOOL nulldrv_IsClipboardFormatAvailable( UINT format )
282 {
283     return FALSE;
284 }
285
286 static UINT nulldrv_RegisterClipboardFormat( LPCWSTR name )
287 {
288     return 0;
289 }
290
291 static BOOL nulldrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
292 {
293     return FALSE;
294 }
295
296 static LONG nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
297                                              DWORD flags, LPVOID lparam )
298 {
299     return DISP_CHANGE_FAILED;
300 }
301
302 static BOOL nulldrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
303 {
304     return FALSE;
305 }
306
307 static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
308 {
309     return FALSE;
310 }
311
312 static BOOL nulldrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
313 {
314     return FALSE;
315 }
316
317 static BOOL nulldrv_CreateDesktopWindow( HWND hwnd )
318 {
319     return TRUE;
320 }
321
322 static BOOL nulldrv_CreateWindow( HWND hwnd )
323 {
324     static int warned;
325     if (warned++)
326         return FALSE;
327
328     MESSAGE( "Application tried to create a window, but no driver could be loaded.\n");
329     switch (driver_load_error)
330     {
331     case ERROR_MOD_NOT_FOUND:
332         MESSAGE( "The X11 driver is missing.  Check your build!\n" );
333         break;
334     case ERROR_DLL_INIT_FAILED:
335         MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
336         break;
337     default:
338         MESSAGE( "Unknown error (%d).\n", driver_load_error );
339     }
340
341     return FALSE;
342 }
343
344 static void nulldrv_DestroyWindow( HWND hwnd )
345 {
346 }
347
348 static void nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
349                            const RECT *top_rect, DWORD flags )
350 {
351 }
352
353 static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
354                                                   DWORD mask, DWORD flags )
355 {
356     return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
357                                      timeout, flags & MWMO_ALERTABLE );
358 }
359
360 static void nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
361 {
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_SetCapture( HWND hwnd, UINT flags )
371 {
372 }
373
374 static void nulldrv_SetFocus( HWND hwnd )
375 {
376 }
377
378 static void nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
379 {
380 }
381
382 static int nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
383 {
384     return 1;
385 }
386
387 static void nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
388 {
389 }
390
391 static void nulldrv_SetWindowStyle( HWND hwnd, DWORD old_style )
392 {
393 }
394
395 static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
396 {
397 }
398
399 static UINT nulldrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
400 {
401     return swp;
402 }
403
404 static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
405 {
406     return -1;
407 }
408
409 static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
410 {
411     return 0;
412 }
413
414 static void nulldrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
415                                        const RECT *window_rect, const RECT *client_rect,
416                                        RECT *visible_rect )
417 {
418 }
419
420 static void nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
421                                       const RECT *window_rect, const RECT *client_rect,
422                                       const RECT *visible_rect, const RECT *valid_rects )
423 {
424 }
425
426 static USER_DRIVER null_driver =
427 {
428     /* keyboard functions */
429     nulldrv_ActivateKeyboardLayout,
430     nulldrv_Beep,
431     nulldrv_GetAsyncKeyState,
432     nulldrv_GetKeyNameText,
433     nulldrv_GetKeyboardLayout,
434     nulldrv_GetKeyboardLayoutList,
435     nulldrv_GetKeyboardLayoutName,
436     nulldrv_LoadKeyboardLayout,
437     nulldrv_MapVirtualKeyEx,
438     nulldrv_SendInput,
439     nulldrv_ToUnicodeEx,
440     nulldrv_UnloadKeyboardLayout,
441     nulldrv_VkKeyScanEx,
442     /* mouse functions */
443     nulldrv_SetCursor,
444     nulldrv_GetCursorPos,
445     nulldrv_SetCursorPos,
446     nulldrv_ClipCursor,
447     /* screen saver functions */
448     nulldrv_GetScreenSaveActive,
449     nulldrv_SetScreenSaveActive,
450     /* clipboard functions */
451     nulldrv_AcquireClipboard,
452     nulldrv_CountClipboardFormats,
453     nulldrv_EmptyClipboard,
454     nulldrv_EndClipboardUpdate,
455     nulldrv_EnumClipboardFormats,
456     nulldrv_GetClipboardData,
457     nulldrv_GetClipboardFormatName,
458     nulldrv_IsClipboardFormatAvailable,
459     nulldrv_RegisterClipboardFormat,
460     nulldrv_SetClipboardData,
461     /* display modes */
462     nulldrv_ChangeDisplaySettingsEx,
463     nulldrv_EnumDisplayMonitors,
464     nulldrv_EnumDisplaySettingsEx,
465     nulldrv_GetMonitorInfo,
466     /* windowing functions */
467     nulldrv_CreateDesktopWindow,
468     nulldrv_CreateWindow,
469     nulldrv_DestroyWindow,
470     nulldrv_GetDC,
471     nulldrv_MsgWaitForMultipleObjectsEx,
472     nulldrv_ReleaseDC,
473     nulldrv_ScrollDC,
474     nulldrv_SetCapture,
475     nulldrv_SetFocus,
476     nulldrv_SetParent,
477     nulldrv_SetWindowRgn,
478     nulldrv_SetWindowIcon,
479     nulldrv_SetWindowStyle,
480     nulldrv_SetWindowText,
481     nulldrv_ShowWindow,
482     nulldrv_SysCommand,
483     nulldrv_WindowMessage,
484     nulldrv_WindowPosChanging,
485     nulldrv_WindowPosChanged
486 };
487
488
489 /**********************************************************************
490  * Lazy loading user driver
491  *
492  * Initial driver used before another driver is loaded.
493  * Each entry point simply loads the real driver and chains to it.
494  */
495
496 static HKL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
497 {
498     return load_driver()->pActivateKeyboardLayout( layout, flags );
499 }
500
501 static void loaderdrv_Beep(void)
502 {
503     load_driver()->pBeep();
504 }
505
506 static SHORT loaderdrv_GetAsyncKeyState( INT key )
507 {
508     return load_driver()->pGetAsyncKeyState( key );
509 }
510
511 static INT loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
512 {
513     return load_driver()->pGetKeyNameText( lparam, buffer, size );
514 }
515
516 static HKL loaderdrv_GetKeyboardLayout( DWORD layout )
517 {
518     return load_driver()->pGetKeyboardLayout( layout );
519 }
520
521 static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts )
522 {
523     return load_driver()->pGetKeyboardLayoutList( count, layouts );
524 }
525
526 static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
527 {
528     return load_driver()->pGetKeyboardLayoutName( name );
529 }
530
531 static HKL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
532 {
533     return load_driver()->pLoadKeyboardLayout( name, flags );
534 }
535
536 static UINT loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
537 {
538     return load_driver()->pMapVirtualKeyEx( code, type, layout );
539 }
540
541 static UINT loaderdrv_SendInput( UINT count, LPINPUT inputs, int size )
542 {
543     return load_driver()->pSendInput( count, inputs, size );
544 }
545
546 static INT loaderdrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
547                                   int size, UINT flags, HKL layout )
548 {
549     return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
550 }
551
552 static BOOL loaderdrv_UnloadKeyboardLayout( HKL layout )
553 {
554     return load_driver()->pUnloadKeyboardLayout( layout );
555 }
556
557 static SHORT loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
558 {
559     return load_driver()->pVkKeyScanEx( ch, layout );
560 }
561
562 static void loaderdrv_SetCursor( struct tagCURSORICONINFO *info )
563 {
564     load_driver()->pSetCursor( info );
565 }
566
567 static BOOL loaderdrv_GetCursorPos( LPPOINT pt )
568 {
569     return load_driver()->pGetCursorPos( pt );
570 }
571
572 static BOOL loaderdrv_SetCursorPos( INT x, INT y )
573 {
574     return load_driver()->pSetCursorPos( x, y );
575 }
576
577 static BOOL loaderdrv_ClipCursor( LPCRECT clip )
578 {
579     return load_driver()->pClipCursor( clip );
580 }
581
582 static BOOL loaderdrv_GetScreenSaveActive(void)
583 {
584     return load_driver()->pGetScreenSaveActive();
585 }
586
587 static void loaderdrv_SetScreenSaveActive( BOOL on )
588 {
589     load_driver()->pSetScreenSaveActive( on );
590 }
591
592 static INT loaderdrv_AcquireClipboard( HWND hwnd )
593 {
594     return load_driver()->pAcquireClipboard( hwnd );
595 }
596
597 static BOOL loaderdrv_CountClipboardFormats(void)
598 {
599     return load_driver()->pCountClipboardFormats();
600 }
601
602 static void loaderdrv_EmptyClipboard( BOOL keepunowned )
603 {
604     load_driver()->pEmptyClipboard( keepunowned );
605 }
606
607 static void loaderdrv_EndClipboardUpdate(void)
608 {
609     load_driver()->pEndClipboardUpdate();
610 }
611
612 static UINT loaderdrv_EnumClipboardFormats( UINT format )
613 {
614     return load_driver()->pEnumClipboardFormats( format );
615 }
616
617 static BOOL loaderdrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
618 {
619     return load_driver()->pGetClipboardData( format, h16, h32 );
620 }
621
622 static INT loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
623 {
624     return load_driver()->pGetClipboardFormatName( format, buffer, len );
625 }
626
627 static BOOL loaderdrv_IsClipboardFormatAvailable( UINT format )
628 {
629     return load_driver()->pIsClipboardFormatAvailable( format );
630 }
631
632 static UINT loaderdrv_RegisterClipboardFormat( LPCWSTR name )
633 {
634     return load_driver()->pRegisterClipboardFormat( name );
635 }
636
637 static BOOL loaderdrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
638 {
639     return load_driver()->pSetClipboardData( format, h16, h32, owner );
640 }
641
642 static LONG loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
643                                                DWORD flags, LPVOID lparam )
644 {
645     return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
646 }
647
648 static BOOL loaderdrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
649 {
650     return load_driver()->pEnumDisplayMonitors( hdc, rect, proc, lp );
651 }
652
653 static BOOL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
654 {
655     return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
656 }
657
658 static BOOL loaderdrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
659 {
660     return load_driver()->pGetMonitorInfo( handle, info );
661 }
662
663 static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd )
664 {
665     return load_driver()->pCreateDesktopWindow( hwnd );
666 }
667
668 static BOOL loaderdrv_CreateWindow( HWND hwnd )
669 {
670     return load_driver()->pCreateWindow( hwnd );
671 }
672
673 static void loaderdrv_DestroyWindow( HWND hwnd )
674 {
675     load_driver()->pDestroyWindow( hwnd );
676 }
677
678 static void loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
679                              const RECT *top_rect, DWORD flags )
680 {
681     load_driver()->pGetDC( hdc, hwnd, top_win, win_rect, top_rect, flags );
682 }
683
684 static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
685                                                     DWORD mask, DWORD flags )
686 {
687     return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
688 }
689
690 static void loaderdrv_ReleaseDC( HWND hwnd, HDC hdc )
691 {
692     load_driver()->pReleaseDC( hwnd, hdc );
693 }
694
695 static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
696                                 HRGN hrgn, LPRECT update )
697 {
698     return load_driver()->pScrollDC( hdc, dx, dy, scroll, clip, hrgn, update );
699 }
700
701 static void loaderdrv_SetCapture( HWND hwnd, UINT flags )
702 {
703     load_driver()->pSetCapture( hwnd, flags );
704 }
705
706 static void loaderdrv_SetFocus( HWND hwnd )
707 {
708     load_driver()->pSetFocus( hwnd );
709 }
710
711 static void loaderdrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
712 {
713     load_driver()->pSetParent( hwnd, parent, old_parent );
714 }
715
716 static int loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
717 {
718     return load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
719 }
720
721 static void loaderdrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
722 {
723     load_driver()->pSetWindowIcon( hwnd, type, icon );
724 }
725
726 static void loaderdrv_SetWindowStyle( HWND hwnd, DWORD old_style )
727 {
728     load_driver()->pSetWindowStyle( hwnd, old_style );
729 }
730
731 static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
732 {
733     load_driver()->pSetWindowText( hwnd, text );
734 }
735
736 static UINT loaderdrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
737 {
738     return load_driver()->pShowWindow( hwnd, cmd, rect, swp );
739 }
740
741 static LRESULT loaderdrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
742 {
743     return load_driver()->pSysCommand( hwnd, wparam, lparam );
744 }
745
746 static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
747 {
748     return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
749 }
750
751 static void loaderdrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
752                                          const RECT *window_rect, const RECT *client_rect,
753                                          RECT *visible_rect )
754 {
755     load_driver()->pWindowPosChanging( hwnd, insert_after, swp_flags,
756                                        window_rect, client_rect, visible_rect );
757 }
758
759 static void loaderdrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
760                                         const RECT *window_rect, const RECT *client_rect,
761                                         const RECT *visible_rect, const RECT *valid_rects )
762 {
763     load_driver()->pWindowPosChanged( hwnd, insert_after, swp_flags, window_rect,
764                                       client_rect, visible_rect, valid_rects );
765 }
766
767 static USER_DRIVER lazy_load_driver =
768 {
769     /* keyboard functions */
770     loaderdrv_ActivateKeyboardLayout,
771     loaderdrv_Beep,
772     loaderdrv_GetAsyncKeyState,
773     loaderdrv_GetKeyNameText,
774     loaderdrv_GetKeyboardLayout,
775     loaderdrv_GetKeyboardLayoutList,
776     loaderdrv_GetKeyboardLayoutName,
777     loaderdrv_LoadKeyboardLayout,
778     loaderdrv_MapVirtualKeyEx,
779     loaderdrv_SendInput,
780     loaderdrv_ToUnicodeEx,
781     loaderdrv_UnloadKeyboardLayout,
782     loaderdrv_VkKeyScanEx,
783     /* mouse functions */
784     loaderdrv_SetCursor,
785     loaderdrv_GetCursorPos,
786     loaderdrv_SetCursorPos,
787     loaderdrv_ClipCursor,
788     /* screen saver functions */
789     loaderdrv_GetScreenSaveActive,
790     loaderdrv_SetScreenSaveActive,
791     /* clipboard functions */
792     loaderdrv_AcquireClipboard,
793     loaderdrv_CountClipboardFormats,
794     loaderdrv_EmptyClipboard,
795     loaderdrv_EndClipboardUpdate,
796     loaderdrv_EnumClipboardFormats,
797     loaderdrv_GetClipboardData,
798     loaderdrv_GetClipboardFormatName,
799     loaderdrv_IsClipboardFormatAvailable,
800     loaderdrv_RegisterClipboardFormat,
801     loaderdrv_SetClipboardData,
802     /* display modes */
803     loaderdrv_ChangeDisplaySettingsEx,
804     loaderdrv_EnumDisplayMonitors,
805     loaderdrv_EnumDisplaySettingsEx,
806     loaderdrv_GetMonitorInfo,
807     /* windowing functions */
808     loaderdrv_CreateDesktopWindow,
809     loaderdrv_CreateWindow,
810     loaderdrv_DestroyWindow,
811     loaderdrv_GetDC,
812     loaderdrv_MsgWaitForMultipleObjectsEx,
813     loaderdrv_ReleaseDC,
814     loaderdrv_ScrollDC,
815     loaderdrv_SetCapture,
816     loaderdrv_SetFocus,
817     loaderdrv_SetParent,
818     loaderdrv_SetWindowRgn,
819     loaderdrv_SetWindowIcon,
820     loaderdrv_SetWindowStyle,
821     loaderdrv_SetWindowText,
822     loaderdrv_ShowWindow,
823     loaderdrv_SysCommand,
824     loaderdrv_WindowMessage,
825     loaderdrv_WindowPosChanging,
826     loaderdrv_WindowPosChanged
827 };