Prevent from crashing/hanging in Windows 95 OSR2.

This commit is contained in:
Jakob Eriksson 2004-05-03 20:07:24 +00:00 committed by Alexandre Julliard
parent 3d5205ef5f
commit 7874ce53bd

View file

@ -137,8 +137,9 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
{
COORD c;
DWORD len, mode;
const char* mytest = "abcd\nf\tg";
const int mylen = strlen(mytest);
char* mytest;
int mylen;
int ret;
int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)),
@ -148,7 +149,12 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
mytest = "123";
mylen = strlen(mytest);
ret = WriteConsole(hCon, mytest, mylen, &len, NULL);
ok(ret != 0 && len == mylen, "Couldn't write, ret = %d, len = %ld\n", ret, len);
c.Y = 0;
for (p = mylen - 3; p < mylen; p++)
{
@ -161,26 +167,12 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
p = sbSize.X - 3 + mylen % 3;
c.X = p; c.Y = 0;
okCURSOR(hCon, c);
/* write line, wrapping disabled, strings end on end of line */
c.X = sbSize.X - mylen; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = 0; p < mylen; p++)
{
c.X = sbSize.X - mylen + p;
okCHAR(hCon, c, mytest[p], TEST_ATTRIB);
}
c.X = 0; c.Y = 1;
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
p = sbSize.X - mylen;
c.X = p; c.Y = 0;
okCURSOR(hCon, c);
}
static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
@ -290,24 +282,9 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = 0; p < 3; p++)
{
c.X = sbSize.X - 3 + p;
okCHAR(hCon, c, mytest[p], TEST_ATTRIB);
}
c.Y = 1;
for (p = 0; p < mylen - 3; p++)
{
c.X = p;
okCHAR(hCon, c, mytest[p + 3], TEST_ATTRIB);
}
c.X = mylen - 3;
okCHAR(hCon, c, ' ', DEFAULT_ATTRIB);
okCURSOR(hCon, c);
}
static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)