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