From d99f6821183ef16457f5cedb13289bc715d11f09 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 5 Sep 2018 19:52:16 +0200 Subject: [PATCH] gdi32: Don't return screen resolution on printer devices. Signed-off-by: Alexandre Julliard --- dlls/gdi32/driver.c | 4 ++-- dlls/gdi32/tests/dc.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 6580008bf5b..ce60d110d9d 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -355,7 +355,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap ) case SCALINGFACTORY: return 0; case VREFRESH: return GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY ? 1 : 0; case DESKTOPHORZRES: - if (pGetSystemMetrics) + if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics) { DPI_AWARENESS_CONTEXT context; UINT ret; @@ -366,7 +366,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap ) } return GetDeviceCaps( dev->hdc, HORZRES ); case DESKTOPVERTRES: - if (pGetSystemMetrics) + if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics) { DPI_AWARENESS_CONTEXT context; UINT ret; diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index 5ad3b314832..5eec74a72c5 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -471,6 +471,12 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale } else { + ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetDeviceCaps( ref_dc, HORZRES ), + "Got DESKTOPHORZRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetDeviceCaps( ref_dc, HORZRES )); + ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetDeviceCaps( ref_dc, VERTRES ), + "Got DESKTOPVERTRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetDeviceCaps( ref_dc, VERTRES )); SetRect( &ref_rect, 0, 0, GetDeviceCaps( ref_dc, DESKTOPHORZRES ), GetDeviceCaps( ref_dc, DESKTOPVERTRES ) ); }