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