Default to the null driver instead of dying if the specified display
driver couldn't be loaded.
This commit is contained in:
parent
2dc8067408
commit
bc30574383
|
@ -42,7 +42,7 @@ static const USER_DRIVER *load_driver(void)
|
|||
HMODULE graphics_driver;
|
||||
USER_DRIVER *driver, *prev;
|
||||
|
||||
strcpy( buffer, "x11,tty" ); /* default value */
|
||||
strcpy( buffer, "x11" ); /* default value */
|
||||
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
|
||||
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;
|
||||
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) );
|
||||
memcpy( driver, &null_driver, sizeof(*driver) );
|
||||
|
||||
if (graphics_driver)
|
||||
{
|
||||
#define GET_USER_FUNC(name) \
|
||||
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(WindowMessage);
|
||||
#undef GET_USER_FUNC
|
||||
}
|
||||
|
||||
prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, (void *)&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 )
|
||||
{
|
||||
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 )
|
||||
|
|
Loading…
Reference in New Issue