Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1335768f
Commit
1335768f
authored
Nov 11, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Allow non-console handles in DuplicateConsoleHandle.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e460b37a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
console.c
dlls/kernel32/console.c
+3
-7
console.c
dlls/kernel32/tests/console.c
+29
-0
No files found.
dlls/kernel32/console.c
View file @
1335768f
...
...
@@ -113,13 +113,9 @@ BOOL WINAPI VerifyConsoleIoHandle(HANDLE handle)
HANDLE
WINAPI
DuplicateConsoleHandle
(
HANDLE
handle
,
DWORD
access
,
BOOL
inherit
,
DWORD
options
)
{
HANDLE
ret
;
if
(
!
is_console_handle
(
handle
)
||
!
DuplicateHandle
(
GetCurrentProcess
(),
wine_server_ptr_handle
(
console_handle_unmap
(
handle
)),
GetCurrentProcess
(),
&
ret
,
access
,
inherit
,
options
))
return
INVALID_HANDLE_VALUE
;
return
console_handle_map
(
ret
);
HANDLE
ret
;
return
DuplicateHandle
(
GetCurrentProcess
(),
handle
,
GetCurrentProcess
(),
&
ret
,
access
,
inherit
,
options
)
?
ret
:
INVALID_HANDLE_VALUE
;
}
/******************************************************************
...
...
dlls/kernel32/tests/console.c
View file @
1335768f
...
...
@@ -1506,6 +1506,34 @@ static void test_GetSetStdHandle(void)
ok
(
error
==
0xdeadbeef
,
"wrong GetLastError() %d
\n
"
,
error
);
}
static
void
test_DuplicateConsoleHandle
(
void
)
{
HANDLE
handle
,
event
;
BOOL
ret
;
if
(
skip_nt
)
return
;
event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
/* duplicate an event handle with DuplicateConsoleHandle */
handle
=
DuplicateConsoleHandle
(
event
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
);
ok
(
handle
!=
NULL
,
"DuplicateConsoleHandle failed: %u
\n
"
,
GetLastError
());
ret
=
SetEvent
(
handle
);
ok
(
ret
,
"SetEvent failed: %u
\n
"
,
GetLastError
());
ret
=
CloseConsoleHandle
(
handle
);
todo_wine
ok
(
ret
,
"CloseConsoleHandle failed: %u
\n
"
,
GetLastError
());
ret
=
CloseConsoleHandle
(
event
);
todo_wine
ok
(
ret
,
"CloseConsoleHandle failed: %u
\n
"
,
GetLastError
());
handle
=
DuplicateConsoleHandle
((
HANDLE
)
0xdeadbeef
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
);
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"DuplicateConsoleHandle failed: %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"last error = %u
\n
"
,
GetLastError
());
}
static
void
test_GetNumberOfConsoleInputEvents
(
HANDLE
input_handle
)
{
DWORD
count
;
...
...
@@ -4387,6 +4415,7 @@ START_TEST(console)
test_OpenCON
();
test_VerifyConsoleIoHandle
(
hConOut
);
test_GetSetStdHandle
();
test_DuplicateConsoleHandle
();
test_GetNumberOfConsoleInputEvents
(
hConIn
);
test_WriteConsoleInputA
(
hConIn
);
test_WriteConsoleInputW
(
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