Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
3501b0a5
Commit
3501b0a5
authored
14 years ago
by
Andrew Nguyen
Committed by
Alexandre Julliard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
kernel32: Fail with an invalid output parameter in GetNumberOfConsoleInputEvents.
parent
858ccfff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/kernel32/console.c
+7
-1
7 additions, 1 deletion
dlls/kernel32/console.c
dlls/kernel32/tests/console.c
+54
-0
54 additions, 0 deletions
dlls/kernel32/tests/console.c
with
61 additions
and
1 deletion
dlls/kernel32/console.c
+
7
−
1
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
;
...
...
This diff is collapsed.
Click to expand it.
dlls/kernel32/tests/console.c
+
54
−
0
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
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment