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