From ecfd9db94417a086dccbcb4769120a2b2a55aaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Thu, 19 Feb 2004 17:04:11 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20by=20H=EF=BF=BDseyin=20Uslu=20<20194562?= =?UTF-8?q?@mail.baskent.edu.tr>=20Check=20color=20passed=20on=20command?= =?UTF-8?q?=20line,=20make=20sure=20foreground=20and=20background=20are=20?= =?UTF-8?q?not=20the=20same.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=8263 --- reactos/subsys/system/cmd/color.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/reactos/subsys/system/cmd/color.c b/reactos/subsys/system/cmd/color.c index a5fbc5f22c2..9150bc8b38f 100644 --- a/reactos/subsys/system/cmd/color.c +++ b/reactos/subsys/system/cmd/color.c @@ -1,4 +1,4 @@ -/* $Id: color.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $ +/* $Id: color.c,v 1.4 2004/02/19 17:04:11 gvg Exp $ * * COLOR.C - color internal command. * @@ -68,19 +68,26 @@ VOID SetScreenColor (WORD wColor, BOOL bFill) CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; - if (bFill == TRUE) + if ((wColor & 0xF) == (wColor &0xF0) >> 4) { - GetConsoleScreenBufferInfo (hConsole, &csbi); + ConErrPuts (_T("Same colors error! (Background and foreground can't be the same color)")); + } + else + { + if (bFill == TRUE) + { + GetConsoleScreenBufferInfo (hConsole, &csbi); - coPos.X = 0; - coPos.Y = 0; - FillConsoleOutputAttribute (hConsole, + coPos.X = 0; + coPos.Y = 0; + FillConsoleOutputAttribute (hConsole, (WORD)(wColor & 0x00FF), (csbi.dwSize.X)*(csbi.dwSize.Y), coPos, &dwWritten); - } - SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF)); + } + SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF)); + } }