Default to the null driver instead of dying if the specified display

driver couldn't be loaded.
This commit is contained in:
Alexandre Julliard 2005-10-31 15:54:55 +00:00
parent 2dc8067408
commit bc30574383
1 changed files with 59 additions and 58 deletions

View File

@ -42,7 +42,7 @@ static const USER_DRIVER *load_driver(void)
HMODULE graphics_driver; HMODULE graphics_driver;
USER_DRIVER *driver, *prev; USER_DRIVER *driver, *prev;
strcpy( buffer, "x11,tty" ); /* default value */ strcpy( buffer, "x11" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */ /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey )) if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
{ {
@ -61,17 +61,12 @@ static const USER_DRIVER *load_driver(void)
if ((graphics_driver = LoadLibraryA( libname )) != 0) break; if ((graphics_driver = LoadLibraryA( libname )) != 0) break;
name = next; name = next;
} }
if (!graphics_driver)
{
MESSAGE( "wine: Could not load graphics driver '%s'.\n", buffer );
if (!strcasecmp( buffer, "x11" ))
MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) ); driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
memcpy( driver, &null_driver, sizeof(*driver) ); memcpy( driver, &null_driver, sizeof(*driver) );
if (graphics_driver)
{
#define GET_USER_FUNC(name) \ #define GET_USER_FUNC(name) \
do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0) do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0)
@ -125,6 +120,7 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(WindowFromDC); GET_USER_FUNC(WindowFromDC);
GET_USER_FUNC(WindowMessage); GET_USER_FUNC(WindowMessage);
#undef GET_USER_FUNC #undef GET_USER_FUNC
}
prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, (void *)&lazy_load_driver ); prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, (void *)&lazy_load_driver );
if (prev != &lazy_load_driver) if (prev != &lazy_load_driver)
@ -308,7 +304,12 @@ static BOOL nulldrv_CreateDesktopWindow( HWND hwnd )
static BOOL nulldrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) static BOOL nulldrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{ {
return TRUE; static int warned;
if (!warned++)
MESSAGE( "Application tries to create a window, but no driver could be loaded.\n"
"Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
return FALSE;
} }
static void nulldrv_DestroyWindow( HWND hwnd ) static void nulldrv_DestroyWindow( HWND hwnd )