ntoskrnl.exe/tests: Fix path buffer allocation size.
[wine.git] / dlls / user32 / driver.c
blob5b2929245c9d3f62e2935ed2ea5163d549513dae
1 /*
2 * USER driver support
4 * Copyright 2000, 2005 Alexandre Julliard
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.
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.
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
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "winuser.h"
27 #include "wine/debug.h"
28 #include "wine/gdi_driver.h"
29 #include "wine/unicode.h"
31 #include "user_private.h"
32 #include "controls.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(user);
35 WINE_DECLARE_DEBUG_CHANNEL(winediag);
37 static USER_DRIVER null_driver, lazy_load_driver;
39 const USER_DRIVER *USER_Driver = &lazy_load_driver;
40 static char driver_load_error[80];
42 static BOOL CDECL nodrv_CreateWindow( HWND hwnd );
44 static HMODULE load_desktop_driver( HWND hwnd )
46 static const WCHAR display_device_guid_propW[] = {
47 '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
48 'd','e','v','i','c','e','_','g','u','i','d',0 };
49 static const WCHAR key_pathW[] = {
50 'S','y','s','t','e','m','\\',
51 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
52 'C','o','n','t','r','o','l','\\',
53 'V','i','d','e','o','\\','{',0};
54 static const WCHAR displayW[] = {'}','\\','0','0','0','0',0};
55 static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
56 HMODULE ret = 0;
57 HKEY hkey;
58 DWORD size;
59 WCHAR path[MAX_PATH];
60 WCHAR key[ARRAY_SIZE(key_pathW) + ARRAY_SIZE(displayW) + 40];
61 UINT guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW ));
63 USER_CheckNotLock();
65 strcpy( driver_load_error, "The explorer process failed to start." ); /* default error */
67 if (!guid_atom)
69 SendMessageW( hwnd, WM_NULL, 0, 0 ); /* wait for the desktop process to be ready */
70 guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW ));
72 memcpy( key, key_pathW, sizeof(key_pathW) );
73 if (!GlobalGetAtomNameW( guid_atom, key + strlenW(key), 40 )) return 0;
74 strcatW( key, displayW );
75 if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0;
76 size = sizeof(path);
77 if (!RegQueryValueExW( hkey, driverW, NULL, NULL, (BYTE *)path, &size ))
79 if (!(ret = LoadLibraryW( path ))) ERR( "failed to load %s\n", debugstr_w(path) );
80 TRACE( "%s %p\n", debugstr_w(path), ret );
82 else
84 size = sizeof(driver_load_error);
85 RegQueryValueExA( hkey, "DriverError", NULL, NULL, (BYTE *)driver_load_error, &size );
87 RegCloseKey( hkey );
88 return ret;
91 /* load the graphics driver */
92 static const USER_DRIVER *load_driver(void)
94 void *ptr;
95 HMODULE graphics_driver;
96 USER_DRIVER *driver, *prev;
98 driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
99 *driver = null_driver;
101 graphics_driver = load_desktop_driver( GetDesktopWindow() );
102 if (graphics_driver)
104 #define GET_USER_FUNC(name) \
105 do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0)
107 GET_USER_FUNC(ActivateKeyboardLayout);
108 GET_USER_FUNC(Beep);
109 GET_USER_FUNC(GetAsyncKeyState);
110 GET_USER_FUNC(GetKeyNameText);
111 GET_USER_FUNC(GetKeyboardLayout);
112 GET_USER_FUNC(GetKeyboardLayoutList);
113 GET_USER_FUNC(GetKeyboardLayoutName);
114 GET_USER_FUNC(LoadKeyboardLayout);
115 GET_USER_FUNC(MapVirtualKeyEx);
116 GET_USER_FUNC(RegisterHotKey);
117 GET_USER_FUNC(ToUnicodeEx);
118 GET_USER_FUNC(UnloadKeyboardLayout);
119 GET_USER_FUNC(UnregisterHotKey);
120 GET_USER_FUNC(VkKeyScanEx);
121 GET_USER_FUNC(DestroyCursorIcon);
122 GET_USER_FUNC(SetCursor);
123 GET_USER_FUNC(GetCursorPos);
124 GET_USER_FUNC(SetCursorPos);
125 GET_USER_FUNC(ClipCursor);
126 GET_USER_FUNC(UpdateClipboard);
127 GET_USER_FUNC(ChangeDisplaySettingsEx);
128 GET_USER_FUNC(EnumDisplayMonitors);
129 GET_USER_FUNC(EnumDisplaySettingsEx);
130 GET_USER_FUNC(GetMonitorInfo);
131 GET_USER_FUNC(CreateDesktopWindow);
132 GET_USER_FUNC(CreateWindow);
133 GET_USER_FUNC(DestroyWindow);
134 GET_USER_FUNC(FlashWindowEx);
135 GET_USER_FUNC(GetDC);
136 GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
137 GET_USER_FUNC(ReleaseDC);
138 GET_USER_FUNC(ScrollDC);
139 GET_USER_FUNC(SetCapture);
140 GET_USER_FUNC(SetFocus);
141 GET_USER_FUNC(SetLayeredWindowAttributes);
142 GET_USER_FUNC(SetParent);
143 GET_USER_FUNC(SetWindowRgn);
144 GET_USER_FUNC(SetWindowIcon);
145 GET_USER_FUNC(SetWindowStyle);
146 GET_USER_FUNC(SetWindowText);
147 GET_USER_FUNC(ShowWindow);
148 GET_USER_FUNC(SysCommand);
149 GET_USER_FUNC(UpdateLayeredWindow);
150 GET_USER_FUNC(WindowMessage);
151 GET_USER_FUNC(WindowPosChanging);
152 GET_USER_FUNC(WindowPosChanged);
153 GET_USER_FUNC(SystemParametersInfo);
154 GET_USER_FUNC(ThreadDetach);
155 #undef GET_USER_FUNC
157 else
159 USEROBJECTFLAGS flags;
160 HWINSTA winstation;
162 winstation = GetProcessWindowStation();
163 if (!GetUserObjectInformationA(winstation, UOI_FLAGS, &flags, sizeof(flags), NULL)
164 || (flags.dwFlags & WSF_VISIBLE))
165 driver->pCreateWindow = nodrv_CreateWindow;
168 prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, &lazy_load_driver );
169 if (prev != &lazy_load_driver)
171 /* another thread beat us to it */
172 HeapFree( GetProcessHeap(), 0, driver );
173 driver = prev;
175 else LdrAddRefDll( 0, graphics_driver );
177 __wine_set_display_driver( graphics_driver );
178 register_builtin_classes();
180 return driver;
183 /* unload the graphics driver on process exit */
184 void USER_unload_driver(void)
186 USER_DRIVER *prev;
187 /* make sure we don't try to call the driver after it has been detached */
188 prev = InterlockedExchangePointer( (void **)&USER_Driver, &null_driver );
189 if (prev != &lazy_load_driver && prev != &null_driver)
190 HeapFree( GetProcessHeap(), 0, prev );
194 /**********************************************************************
195 * Null user driver
197 * These are fallbacks for entry points that are not implemented in the real driver.
200 #define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1))
202 static HKL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
204 return 0;
207 static void CDECL nulldrv_Beep(void)
211 static SHORT CDECL nulldrv_GetAsyncKeyState( INT key )
213 return -1;
216 static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
218 HKEY hKeyKeyboard;
219 DWORD rc;
220 INT count = 0;
221 ULONG_PTR baselayout;
222 LANGID langid;
223 static const WCHAR szKeyboardReg[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s',0};
225 baselayout = GetUserDefaultLCID();
226 langid = PRIMARYLANGID(LANGIDFROMLCID(baselayout));
227 if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
228 baselayout = MAKELONG( baselayout, 0xe001 ); /* IME */
229 else
230 baselayout |= baselayout << 16;
232 /* Enumerate the Registry */
233 rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,szKeyboardReg,&hKeyKeyboard);
234 if (rc == ERROR_SUCCESS)
236 do {
237 WCHAR szKeyName[9];
238 HKL layout;
239 rc = RegEnumKeyW(hKeyKeyboard, count, szKeyName, 9);
240 if (rc == ERROR_SUCCESS)
242 layout = (HKL)(ULONG_PTR)strtoulW(szKeyName,NULL,16);
243 if (baselayout != 0 && layout == (HKL)baselayout)
244 baselayout = 0; /* found in the registry do not add again */
245 if (size && layouts)
247 if (count >= size ) break;
248 layouts[count] = layout;
250 count ++;
252 } while (rc == ERROR_SUCCESS);
253 RegCloseKey(hKeyKeyboard);
256 /* make sure our base layout is on the list */
257 if (baselayout != 0)
259 if (size && layouts)
261 if (count < size)
263 layouts[count] = (HKL)baselayout;
264 count++;
267 else
268 count++;
271 return count;
274 static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
276 return 0;
279 static HKL CDECL nulldrv_GetKeyboardLayout( DWORD thread_id )
281 return 0;
284 static BOOL CDECL nulldrv_GetKeyboardLayoutName( LPWSTR name )
286 return FALSE;
289 static HKL CDECL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
291 return 0;
294 static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
296 return 0;
299 static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
301 return TRUE;
304 static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
305 int size, UINT flags, HKL layout )
307 return 0;
310 static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout )
312 return 0;
315 static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
319 static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
321 return -1;
324 static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
328 static void CDECL nulldrv_SetCursor( HCURSOR cursor )
332 static BOOL CDECL nulldrv_GetCursorPos( LPPOINT pt )
334 return FALSE;
337 static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y )
339 return FALSE;
342 static BOOL CDECL nulldrv_ClipCursor( LPCRECT clip )
344 return FALSE;
347 static void CDECL nulldrv_UpdateClipboard(void)
351 static LONG CDECL nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
352 DWORD flags, LPVOID lparam )
354 return DISP_CHANGE_FAILED;
357 static BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
359 RECT r = {0, 0, 640, 480};
361 TRACE("(%p, %p, %p, 0x%lx)\n", hdc, rect, proc, lp);
363 proc(NULLDRV_DEFAULT_HMONITOR, hdc, &r, lp);
364 return TRUE;
367 static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
369 return FALSE;
372 static BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
374 RECT r = {0, 0, 640, 480};
375 static const WCHAR device[] = {'W','i','n','D','i','s','c',0};
377 TRACE("(%p, %p)\n", handle, info);
379 if (handle != NULLDRV_DEFAULT_HMONITOR)
381 SetLastError(ERROR_INVALID_MONITOR_HANDLE);
382 return FALSE;
385 info->rcMonitor = r;
386 info->rcWork = r;
387 info->dwFlags = MONITORINFOF_PRIMARY;
388 if (info->cbSize >= sizeof(MONITORINFOEXW))
389 lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, device );
390 return TRUE;
393 static BOOL CDECL nulldrv_CreateDesktopWindow( HWND hwnd )
395 return TRUE;
398 static BOOL CDECL nodrv_CreateWindow( HWND hwnd )
400 static int warned;
401 HWND parent = GetAncestor( hwnd, GA_PARENT );
403 /* HWND_MESSAGE windows don't need a graphics driver */
404 if (!parent || parent == get_user_thread_info()->msg_window) return TRUE;
405 if (warned++) return FALSE;
407 ERR_(winediag)( "Application tried to create a window, but no driver could be loaded.\n" );
408 if (driver_load_error[0]) ERR_(winediag)( "%s\n", driver_load_error );
409 return FALSE;
412 static BOOL CDECL nulldrv_CreateWindow( HWND hwnd )
414 return TRUE;
417 static void CDECL nulldrv_DestroyWindow( HWND hwnd )
421 static void CDECL nulldrv_FlashWindowEx( FLASHWINFO *info )
425 static void CDECL nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
426 const RECT *top_rect, DWORD flags )
430 static DWORD CDECL nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
431 DWORD mask, DWORD flags )
433 return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
434 timeout, flags & MWMO_ALERTABLE );
437 static void CDECL nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
441 static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
443 RECT rect;
445 GetClipBox( hdc, &rect );
446 return BitBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
447 hdc, rect.left - dx, rect.top - dy, SRCCOPY );
450 static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags )
454 static void CDECL nulldrv_SetFocus( HWND hwnd )
458 static void CDECL nulldrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
462 static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
466 static void CDECL nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
470 static void CDECL nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
474 static void CDECL nulldrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
478 static void CDECL nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
482 static UINT CDECL nulldrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
484 return swp;
487 static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
489 return -1;
492 static BOOL CDECL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
493 const RECT *window_rect )
495 return TRUE;
498 static LRESULT CDECL nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
500 return 0;
503 static void CDECL nulldrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
504 const RECT *window_rect, const RECT *client_rect,
505 RECT *visible_rect, struct window_surface **surface )
509 static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
510 const RECT *window_rect, const RECT *client_rect,
511 const RECT *visible_rect, const RECT *valid_rects,
512 struct window_surface *surface )
516 static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
518 return FALSE;
521 static void CDECL nulldrv_ThreadDetach( void )
525 static USER_DRIVER null_driver =
527 /* keyboard functions */
528 nulldrv_ActivateKeyboardLayout,
529 nulldrv_Beep,
530 nulldrv_GetAsyncKeyState,
531 nulldrv_GetKeyNameText,
532 nulldrv_GetKeyboardLayout,
533 nulldrv_GetKeyboardLayoutList,
534 nulldrv_GetKeyboardLayoutName,
535 nulldrv_LoadKeyboardLayout,
536 nulldrv_MapVirtualKeyEx,
537 nulldrv_RegisterHotKey,
538 nulldrv_ToUnicodeEx,
539 nulldrv_UnloadKeyboardLayout,
540 nulldrv_UnregisterHotKey,
541 nulldrv_VkKeyScanEx,
542 /* cursor/icon functions */
543 nulldrv_DestroyCursorIcon,
544 nulldrv_SetCursor,
545 nulldrv_GetCursorPos,
546 nulldrv_SetCursorPos,
547 nulldrv_ClipCursor,
548 /* clipboard functions */
549 nulldrv_UpdateClipboard,
550 /* display modes */
551 nulldrv_ChangeDisplaySettingsEx,
552 nulldrv_EnumDisplayMonitors,
553 nulldrv_EnumDisplaySettingsEx,
554 nulldrv_GetMonitorInfo,
555 /* windowing functions */
556 nulldrv_CreateDesktopWindow,
557 nulldrv_CreateWindow,
558 nulldrv_DestroyWindow,
559 nulldrv_FlashWindowEx,
560 nulldrv_GetDC,
561 nulldrv_MsgWaitForMultipleObjectsEx,
562 nulldrv_ReleaseDC,
563 nulldrv_ScrollDC,
564 nulldrv_SetCapture,
565 nulldrv_SetFocus,
566 nulldrv_SetLayeredWindowAttributes,
567 nulldrv_SetParent,
568 nulldrv_SetWindowRgn,
569 nulldrv_SetWindowIcon,
570 nulldrv_SetWindowStyle,
571 nulldrv_SetWindowText,
572 nulldrv_ShowWindow,
573 nulldrv_SysCommand,
574 nulldrv_UpdateLayeredWindow,
575 nulldrv_WindowMessage,
576 nulldrv_WindowPosChanging,
577 nulldrv_WindowPosChanged,
578 /* system parameters */
579 nulldrv_SystemParametersInfo,
580 /* thread management */
581 nulldrv_ThreadDetach
585 /**********************************************************************
586 * Lazy loading user driver
588 * Initial driver used before another driver is loaded.
589 * Each entry point simply loads the real driver and chains to it.
592 static HKL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
594 return load_driver()->pActivateKeyboardLayout( layout, flags );
597 static void CDECL loaderdrv_Beep(void)
599 load_driver()->pBeep();
602 static SHORT CDECL loaderdrv_GetAsyncKeyState( INT key )
604 return load_driver()->pGetAsyncKeyState( key );
607 static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
609 return load_driver()->pGetKeyNameText( lparam, buffer, size );
612 static HKL CDECL loaderdrv_GetKeyboardLayout( DWORD thread_id )
614 return load_driver()->pGetKeyboardLayout( thread_id );
617 static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
619 return load_driver()->pGetKeyboardLayoutList( size, layouts );
622 static BOOL CDECL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
624 return load_driver()->pGetKeyboardLayoutName( name );
627 static HKL CDECL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
629 return load_driver()->pLoadKeyboardLayout( name, flags );
632 static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
634 return load_driver()->pMapVirtualKeyEx( code, type, layout );
637 static BOOL CDECL loaderdrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
639 return load_driver()->pRegisterHotKey( hwnd, modifiers, vk );
642 static INT CDECL loaderdrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
643 int size, UINT flags, HKL layout )
645 return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
648 static BOOL CDECL loaderdrv_UnloadKeyboardLayout( HKL layout )
650 return load_driver()->pUnloadKeyboardLayout( layout );
653 static void CDECL loaderdrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
655 load_driver()->pUnregisterHotKey( hwnd, modifiers, vk );
658 static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
660 return load_driver()->pVkKeyScanEx( ch, layout );
663 static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
665 load_driver()->pSetCursor( cursor );
668 static BOOL CDECL loaderdrv_GetCursorPos( LPPOINT pt )
670 return load_driver()->pGetCursorPos( pt );
673 static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
675 return load_driver()->pSetCursorPos( x, y );
678 static BOOL CDECL loaderdrv_ClipCursor( LPCRECT clip )
680 return load_driver()->pClipCursor( clip );
683 static void CDECL loaderdrv_UpdateClipboard(void)
685 load_driver()->pUpdateClipboard();
688 static LONG CDECL loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
689 DWORD flags, LPVOID lparam )
691 return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
694 static BOOL CDECL loaderdrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp )
696 return load_driver()->pEnumDisplayMonitors( hdc, rect, proc, lp );
699 static BOOL CDECL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
701 return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
704 static BOOL CDECL loaderdrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
706 return load_driver()->pGetMonitorInfo( handle, info );
709 static BOOL CDECL loaderdrv_CreateDesktopWindow( HWND hwnd )
711 return load_driver()->pCreateDesktopWindow( hwnd );
714 static BOOL CDECL loaderdrv_CreateWindow( HWND hwnd )
716 return load_driver()->pCreateWindow( hwnd );
719 static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
721 load_driver()->pFlashWindowEx( info );
724 static void CDECL loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
725 const RECT *top_rect, DWORD flags )
727 load_driver()->pGetDC( hdc, hwnd, top_win, win_rect, top_rect, flags );
730 static void CDECL loaderdrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
732 load_driver()->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
735 static void CDECL loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
737 load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
740 static BOOL CDECL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
741 const RECT *window_rect )
743 return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect );
746 static USER_DRIVER lazy_load_driver =
748 /* keyboard functions */
749 loaderdrv_ActivateKeyboardLayout,
750 loaderdrv_Beep,
751 loaderdrv_GetAsyncKeyState,
752 loaderdrv_GetKeyNameText,
753 loaderdrv_GetKeyboardLayout,
754 loaderdrv_GetKeyboardLayoutList,
755 loaderdrv_GetKeyboardLayoutName,
756 loaderdrv_LoadKeyboardLayout,
757 loaderdrv_MapVirtualKeyEx,
758 loaderdrv_RegisterHotKey,
759 loaderdrv_ToUnicodeEx,
760 loaderdrv_UnloadKeyboardLayout,
761 loaderdrv_UnregisterHotKey,
762 loaderdrv_VkKeyScanEx,
763 /* cursor/icon functions */
764 nulldrv_DestroyCursorIcon,
765 loaderdrv_SetCursor,
766 loaderdrv_GetCursorPos,
767 loaderdrv_SetCursorPos,
768 loaderdrv_ClipCursor,
769 /* clipboard functions */
770 loaderdrv_UpdateClipboard,
771 /* display modes */
772 loaderdrv_ChangeDisplaySettingsEx,
773 loaderdrv_EnumDisplayMonitors,
774 loaderdrv_EnumDisplaySettingsEx,
775 loaderdrv_GetMonitorInfo,
776 /* windowing functions */
777 loaderdrv_CreateDesktopWindow,
778 loaderdrv_CreateWindow,
779 nulldrv_DestroyWindow,
780 loaderdrv_FlashWindowEx,
781 loaderdrv_GetDC,
782 nulldrv_MsgWaitForMultipleObjectsEx,
783 nulldrv_ReleaseDC,
784 nulldrv_ScrollDC,
785 nulldrv_SetCapture,
786 nulldrv_SetFocus,
787 loaderdrv_SetLayeredWindowAttributes,
788 nulldrv_SetParent,
789 loaderdrv_SetWindowRgn,
790 nulldrv_SetWindowIcon,
791 nulldrv_SetWindowStyle,
792 nulldrv_SetWindowText,
793 nulldrv_ShowWindow,
794 nulldrv_SysCommand,
795 loaderdrv_UpdateLayeredWindow,
796 nulldrv_WindowMessage,
797 nulldrv_WindowPosChanging,
798 nulldrv_WindowPosChanged,
799 /* system parameters */
800 nulldrv_SystemParametersInfo,
801 /* thread management */
802 nulldrv_ThreadDetach