From: Francois Gouget fgouget@codeweavers.com
--- dlls/gdi32/tests/dc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index c64ef332060..b556fb58f13 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -1288,16 +1288,11 @@ static void test_gamma(void) ok(!ret, "SetDeviceGammaRamp succeeded\n");
/* try ramps which are not uniform */ - ramp[0][0] = 0; - for (i = 1; i < 256; i++) ramp[0][i] = ramp[0][i - 1] + 512; + for (i = 0; i < 256; i++) ramp[0][i] = 512 * i; /* wraps midway */ ret = SetDeviceGammaRamp(hdc, &ramp); ok(ret, "SetDeviceGammaRamp failed\n"); - ramp[0][0] = 0; - for (i = 2; i < 256; i+=2) - { - ramp[0][i - 1] = ramp[0][i - 2]; - ramp[0][i] = ramp[0][i - 2] + 512; - } + for (i = 0; i < 256; i += 2) + ramp[0][i] = ramp[0][i + 1] = 256 * i; /* stairs */ ret = SetDeviceGammaRamp(hdc, &ramp); ok(ret, "SetDeviceGammaRamp failed\n");
From: Francois Gouget fgouget@codeweavers.com
Otherwise the only way to identify which failure happened is to check its line number which is not practical across versions. --- dlls/gdi32/tests/dc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index b556fb58f13..72d0f76f748 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -1268,37 +1268,37 @@ static void test_gamma(void) /* set one color ramp to zeros */ memset(ramp[0], 0, sizeof(ramp[0])); ret = SetDeviceGammaRamp(hdc, &ramp); - ok(!ret, "SetDeviceGammaRamp succeeded\n"); + ok(!ret, "SetDeviceGammaRamp(zeroes) succeeded\n");
/* set one color ramp to a flat straight rising line */ for (i = 0; i < 256; i++) ramp[0][i] = i; ret = SetDeviceGammaRamp(hdc, &ramp); - todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n"); + todo_wine ok(!ret, "SetDeviceGammaRamp(low) succeeded\n");
/* set one color ramp to a steep straight rising line */ for (i = 0; i < 256; i++) ramp[0][i] = i * 256; ret = SetDeviceGammaRamp(hdc, &ramp); - ok(ret, "SetDeviceGammaRamp failed\n"); + ok(ret, "SetDeviceGammaRamp(steep) failed\n");
/* try a bright gamma ramp */ ramp[0][0] = 0; ramp[0][1] = 0x7FFF; for (i = 2; i < 256; i++) ramp[0][i] = 0xFFFF; ret = SetDeviceGammaRamp(hdc, &ramp); - ok(!ret, "SetDeviceGammaRamp succeeded\n"); + ok(!ret, "SetDeviceGammaRam(bright) succeeded\n");
/* try ramps which are not uniform */ for (i = 0; i < 256; i++) ramp[0][i] = 512 * i; /* wraps midway */ ret = SetDeviceGammaRamp(hdc, &ramp); - ok(ret, "SetDeviceGammaRamp failed\n"); + ok(ret, "SetDeviceGammaRamp(wrap) failed\n"); for (i = 0; i < 256; i += 2) ramp[0][i] = ramp[0][i + 1] = 256 * i; /* stairs */ ret = SetDeviceGammaRamp(hdc, &ramp); - ok(ret, "SetDeviceGammaRamp failed\n"); + ok(ret, "SetDeviceGammaRamp(stairs) failed\n");
/* cleanup: set old ramp again */ ret = SetDeviceGammaRamp(hdc, &oldramp); - ok(ret, "SetDeviceGammaRamp failed\n"); + ok(ret, "SetDeviceGammaRamp(old) failed\n");
done: ReleaseDC(NULL, hdc);
From: Francois Gouget fgouget@codeweavers.com
SetDeviceGammaRamp() checks the specified ramp to prevent applications from setting malicious gamma ramps (e.g. hiding text by remapping its color to match the background). But Windows 10 1909 has fewer checks than later Windows 10 versions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54593 --- dlls/gdi32/tests/dc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index 72d0f76f748..8ccadbd6ff6 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -1268,12 +1268,14 @@ static void test_gamma(void) /* set one color ramp to zeros */ memset(ramp[0], 0, sizeof(ramp[0])); ret = SetDeviceGammaRamp(hdc, &ramp); - ok(!ret, "SetDeviceGammaRamp(zeroes) succeeded\n"); + ok(!ret || broken(ret /* win1909 */), + "SetDeviceGammaRamp(zeroes) succeeded\n");
/* set one color ramp to a flat straight rising line */ for (i = 0; i < 256; i++) ramp[0][i] = i; ret = SetDeviceGammaRamp(hdc, &ramp); - todo_wine ok(!ret, "SetDeviceGammaRamp(low) succeeded\n"); + todo_wine ok(!ret || broken(ret /* win1909 */), + "SetDeviceGammaRamp(low) succeeded\n");
/* set one color ramp to a steep straight rising line */ for (i = 0; i < 256; i++) ramp[0][i] = i * 256; @@ -1285,7 +1287,8 @@ static void test_gamma(void) ramp[0][1] = 0x7FFF; for (i = 2; i < 256; i++) ramp[0][i] = 0xFFFF; ret = SetDeviceGammaRamp(hdc, &ramp); - ok(!ret, "SetDeviceGammaRam(bright) succeeded\n"); + ok(!ret || broken(ret /* win1909 */), + "SetDeviceGammaRam(bright) succeeded\n");
/* try ramps which are not uniform */ for (i = 0; i < 256; i++) ramp[0][i] = 512 * i; /* wraps midway */
This merge request was approved by Huw Davies.