diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index f625f324b0..73d11da961 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -223,6 +223,23 @@ HMODULE CDECL __wine_get_driver_module( HDC hdc ) } +/*********************************************************************** + * __wine_set_display_driver_module (GDI32.@) + */ +void CDECL __wine_set_display_driver( HMODULE module ) +{ + struct graphics_driver *driver; + + if (!(driver = create_driver( module ))) + { + ERR( "Could not create graphics driver\n" ); + ExitProcess(1); + } + if (InterlockedCompareExchangePointer( (void **)&display_driver, driver, NULL )) + HeapFree( GetProcessHeap(), 0, driver ); +} + + static INT nulldrv_AbortDoc( PHYSDEV dev ) { return 0; diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 65f1d0c391..be6410d16b 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -515,6 +515,7 @@ # Graphics drivers @ cdecl __wine_get_driver_module(long) +@ cdecl __wine_set_display_driver(long) # OpenGL @ cdecl __wine_get_wgl_driver(long long) diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index fdcf8532ad..37de424a5b 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -158,6 +158,7 @@ static const USER_DRIVER *load_driver(void) } else LdrAddRefDll( 0, graphics_driver ); + __wine_set_display_driver( graphics_driver ); register_builtin_classes(); return driver; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 83f4885c61..ad9c7c4ec3 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -277,6 +277,7 @@ extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set ); extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect, const RECT *device_rect, struct window_surface *surface ); extern HMODULE CDECL __wine_get_driver_module( HDC hdc ); +extern void CDECL __wine_set_display_driver( HMODULE module ); extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version ); #endif /* __WINE_WINE_GDI_DRIVER_H */