Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
976d5cae
Commit
976d5cae
authored
Jan 18, 2009
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jan 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Ensure that WriteConsoleW succeeds with an empty input buffer.
parent
1571c05a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
console.c
dlls/kernel32/console.c
+2
-0
console.c
dlls/kernel32/tests/console.c
+41
-0
No files found.
dlls/kernel32/console.c
View file @
976d5cae
...
...
@@ -2057,6 +2057,8 @@ BOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
!
GetConsoleScreenBufferInfo
(
hConsoleOutput
,
&
csbi
))
return
FALSE
;
if
(
!
nNumberOfCharsToWrite
)
return
TRUE
;
if
(
mode
&
ENABLE_PROCESSED_OUTPUT
)
{
unsigned
int
i
;
...
...
dlls/kernel32/tests/console.c
View file @
976d5cae
...
...
@@ -173,6 +173,45 @@ static void testCursorInfo(HANDLE hCon)
ERROR_INVALID_ACCESS
,
GetLastError
());
}
static
void
testEmptyWrite
(
HANDLE
hCon
)
{
COORD
c
;
DWORD
len
;
const
char
*
mytest
=
""
;
c
.
X
=
c
.
Y
=
0
;
ok
(
SetConsoleCursorPosition
(
hCon
,
c
)
!=
0
,
"Cursor in upper-left
\n
"
);
len
=
-
1
;
ok
(
WriteConsole
(
hCon
,
NULL
,
0
,
&
len
,
NULL
)
!=
0
&&
len
==
0
,
"WriteConsole
\n
"
);
okCURSOR
(
hCon
,
c
);
/* Passing a NULL lpBuffer with sufficiently large non-zero length succeeds
* on native Windows and result in memory-like contents being written to
* the console. Calling WriteConsoleW like this will crash on Wine. */
if
(
0
)
{
len
=
-
1
;
ok
(
!
WriteConsole
(
hCon
,
NULL
,
16
,
&
len
,
NULL
)
&&
len
==
-
1
,
"WriteConsole
\n
"
);
okCURSOR
(
hCon
,
c
);
/* Cursor advances for this call. */
len
=
-
1
;
ok
(
WriteConsole
(
hCon
,
NULL
,
128
,
&
len
,
NULL
)
!=
0
&&
len
==
128
,
"WriteConsole
\n
"
);
}
len
=
-
1
;
ok
(
WriteConsole
(
hCon
,
mytest
,
0
,
&
len
,
NULL
)
!=
0
&&
len
==
0
,
"WriteConsole
\n
"
);
okCURSOR
(
hCon
,
c
);
/* WriteConsole does not halt on a null terminator and is happy to write
* memory contents beyond the actual size of the buffer. */
len
=
-
1
;
ok
(
WriteConsole
(
hCon
,
mytest
,
16
,
&
len
,
NULL
)
!=
0
&&
len
==
16
,
"WriteConsole
\n
"
);
c
.
X
+=
16
;
okCURSOR
(
hCon
,
c
);
}
static
void
testWriteSimple
(
HANDLE
hCon
)
{
COORD
c
;
...
...
@@ -407,6 +446,8 @@ static void testWrite(HANDLE hCon, COORD sbSize)
/* FIXME: should in fact insure that the sb is at least 10 character wide */
ok
(
SetConsoleTextAttribute
(
hCon
,
TEST_ATTRIB
),
"Setting default text color
\n
"
);
resetContent
(
hCon
,
sbSize
,
FALSE
);
testEmptyWrite
(
hCon
);
resetContent
(
hCon
,
sbSize
,
FALSE
);
testWriteSimple
(
hCon
);
resetContent
(
hCon
,
sbSize
,
FALSE
);
testWriteNotWrappedNotProcessed
(
hCon
,
sbSize
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment