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