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
3501b0a5
Commit
3501b0a5
authored
Jan 03, 2011
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jan 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fail with an invalid output parameter in GetNumberOfConsoleInputEvents.
parent
858ccfff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
1 deletion
+61
-1
console.c
dlls/kernel32/console.c
+7
-1
console.c
dlls/kernel32/tests/console.c
+54
-0
No files found.
dlls/kernel32/console.c
View file @
3501b0a5
...
...
@@ -992,7 +992,13 @@ BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE handle, LPDWORD nrofevents )
req
->
flush
=
FALSE
;
if
((
ret
=
!
wine_server_call_err
(
req
)))
{
if
(
nrofevents
)
*
nrofevents
=
reply
->
read
;
if
(
nrofevents
)
*
nrofevents
=
reply
->
read
;
else
{
SetLastError
(
ERROR_INVALID_ACCESS
);
ret
=
FALSE
;
}
}
}
SERVER_END_REQ
;
...
...
dlls/kernel32/tests/console.c
View file @
3501b0a5
...
...
@@ -1168,6 +1168,59 @@ static void test_GetSetStdHandle(void)
ok
(
error
==
0xdeadbeef
,
"wrong GetLastError() %d
\n
"
,
error
);
}
static
void
test_GetNumberOfConsoleInputEvents
(
HANDLE
input_handle
)
{
DWORD
count
;
BOOL
ret
;
int
i
;
const
struct
{
HANDLE
handle
;
LPDWORD
nrofevents
;
DWORD
last_error
;
}
invalid_table
[]
=
{
{
NULL
,
NULL
,
ERROR_INVALID_HANDLE
},
{
NULL
,
&
count
,
ERROR_INVALID_HANDLE
},
{
INVALID_HANDLE_VALUE
,
NULL
,
ERROR_INVALID_HANDLE
},
{
INVALID_HANDLE_VALUE
,
&
count
,
ERROR_INVALID_HANDLE
},
};
for
(
i
=
0
;
i
<
sizeof
(
invalid_table
)
/
sizeof
(
invalid_table
[
0
]);
i
++
)
{
SetLastError
(
0xdeadbeef
);
if
(
invalid_table
[
i
].
nrofevents
)
count
=
0xdeadbeef
;
ret
=
GetNumberOfConsoleInputEvents
(
invalid_table
[
i
].
handle
,
invalid_table
[
i
].
nrofevents
);
ok
(
!
ret
,
"[%d] Expected GetNumberOfConsoleInputEvents to return FALSE, got %d
\n
"
,
i
,
ret
);
if
(
invalid_table
[
i
].
nrofevents
)
{
ok
(
count
==
0xdeadbeef
,
"[%d] Expected output count to be unmodified, got %u
\n
"
,
i
,
count
);
}
ok
(
GetLastError
()
==
invalid_table
[
i
].
last_error
,
"[%d] Expected last error to be %u, got %u
\n
"
,
i
,
invalid_table
[
i
].
last_error
,
GetLastError
());
}
/* Test crashes on Windows 7. */
if
(
0
)
{
SetLastError
(
0xdeadbeef
);
ret
=
GetNumberOfConsoleInputEvents
(
input_handle
,
NULL
);
ok
(
!
ret
,
"Expected GetNumberOfConsoleInputEvents to return FALSE, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_ACCESS
,
"Expected last error to be ERROR_INVALID_ACCESS, got %u
\n
"
,
GetLastError
());
}
count
=
0xdeadbeef
;
ret
=
GetNumberOfConsoleInputEvents
(
input_handle
,
&
count
);
ok
(
ret
==
TRUE
,
"Expected GetNumberOfConsoleInputEvents to return TRUE, got %d
\n
"
,
ret
);
ok
(
count
!=
0xdeadbeef
,
"Expected output count to initialized
\n
"
);
}
START_TEST
(
console
)
{
HANDLE
hConIn
,
hConOut
;
...
...
@@ -1221,4 +1274,5 @@ START_TEST(console)
test_OpenConsoleW
();
test_VerifyConsoleIoHandle
(
hConOut
);
test_GetSetStdHandle
();
test_GetNumberOfConsoleInputEvents
(
hConIn
);
}
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