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