[GDI32] SetBkMode: Avoid invalid input. CORE-19656 (#7089)

Fixes a bug in Midori 0.5.11 installer which caused bad rendering
that was making the text hard to read (no background).
In Windows it's visible as FillRect(0x89011a1f, 0x0019f87c, 0xabababab),
and in ReactOS as SetBkMode(0xb5010fce, -1546139919).

After a number of attempts to get the same behavior, I haven't found a way
to fix it without a hack to make the installer look identical to Windows.

At least I added handling for the incorrect value in SetBkMode.
This shouldn't matter anywhere. It may not look the same as on Windows,
but the text will at least be readable.
This commit is contained in:
Tomáš Veselý 2024-07-08 20:34:36 +02:00 committed by GitHub
parent 4da2e78319
commit a9bdd62d84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1060,6 +1060,13 @@ SetBkMode(
PDC_ATTR pdcattr;
INT iOldMode;
/* Avoid bad mode setting */
if ((iBkMode != TRANSPARENT) && (iBkMode != OPAQUE))
{
DPRINT1("SetBkMode: Incorrect value\n");
return 0;
}
HANDLE_METADC(INT, SetBkMode, 0, hdc, iBkMode);
/* Get the DC attribute */