gdi: Device name returned from EnumDisplayDevices is valid for CreateDC.

This commit is contained in:
Vitaliy Margolen 2006-01-03 12:05:54 +01:00 committed by Alexandre Julliard
parent e74bda9d95
commit 9561d6e29c
2 changed files with 11 additions and 1 deletions

View File

@ -263,11 +263,13 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
HMODULE module;
struct graphics_driver *driver;
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
EnterCriticalSection( &driver_section );
/* display driver is a special case */
if (!strcmpiW( name, displayW ))
if (!strcmpiW( name, displayW ) ||
!strcmpiW( name, display1W ))
{
driver = load_display_driver();
LeaveCriticalSection( &driver_section );

View File

@ -67,6 +67,7 @@ static void test_enumdisplaydevices(void)
while(1)
{
BOOL ret;
HDC dc;
ret = pEnumDisplayDevicesA(NULL, num, &dd, 0);
ok(ret || num != 0, "EnumDisplayDevices fails with num == 0\n");
if(!ret) break;
@ -75,6 +76,13 @@ static void test_enumdisplaydevices(void)
strcpy(primary_device_name, dd.DeviceName);
primary_num = num;
}
if(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
{
/* test creating DC */
dc = CreateDCA(dd.DeviceName, NULL, NULL, NULL);
ok(dc != NULL, "Failed to CreateDC(\"%s\") err=%ld\n", dd.DeviceName, GetLastError());
DeleteDC(dc);
}
num++;
}
ok(primary_num != -1, "Didn't get the primary device\n");