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
ccaaf695
Commit
ccaaf695
authored
Aug 13, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Close PEB ConsoleHandle in FreeConsole.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
701b0139
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
console.c
dlls/kernel32/tests/console.c
+12
-0
console.c
dlls/kernelbase/console.c
+3
-0
No files found.
dlls/kernel32/tests/console.c
View file @
ccaaf695
...
...
@@ -3592,9 +3592,15 @@ static void test_FreeConsole(void)
HANDLE
handle
;
BOOL
ret
;
todo_wine
ok
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
!=
NULL
,
"ConsoleHandle is NULL
\n
"
);
ret
=
FreeConsole
();
ok
(
ret
,
"FreeConsole failed: %u
\n
"
,
GetLastError
());
ok
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
==
NULL
,
"ConsoleHandle = %p
\n
"
,
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
);
handle
=
CreateFileA
(
"CONOUT$"
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
handle
==
INVALID_HANDLE_VALUE
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
/* winxp */
)),
...
...
@@ -3719,8 +3725,12 @@ static void test_AttachConsole_child(DWORD console_pid)
ok
(
!
res
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"AttachConsole returned: %x(%u)
\n
"
,
res
,
GetLastError
());
todo_wine
ok
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
!=
NULL
,
"ConsoleHandle is NULL
\n
"
);
res
=
FreeConsole
();
ok
(
res
,
"FreeConsole failed: %u
\n
"
,
GetLastError
());
ok
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
==
NULL
,
"ConsoleHandle = %p
\n
"
,
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
);
SetStdHandle
(
STD_ERROR_HANDLE
,
pipe_out
);
...
...
@@ -3728,6 +3738,8 @@ static void test_AttachConsole_child(DWORD console_pid)
ok
(
res
,
"AttachConsole failed: %u
\n
"
,
GetLastError
());
ok
(
pipe_out
!=
GetStdHandle
(
STD_ERROR_HANDLE
),
"std handle not set to console
\n
"
);
todo_wine
ok
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
!=
NULL
,
"ConsoleHandle is NULL
\n
"
);
console
=
CreateFileA
(
"CONOUT$"
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
console
!=
INVALID_HANDLE_VALUE
,
"Could not open console
\n
"
);
...
...
dlls/kernelbase/console.c
View file @
ccaaf695
...
...
@@ -509,6 +509,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole(void)
RtlEnterCriticalSection
(
&
console_section
);
NtClose
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
);
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
=
NULL
;
if
(
console_flags
&
CONSOLE_INPUT_HANDLE
)
NtClose
(
GetStdHandle
(
STD_INPUT_HANDLE
));
if
(
console_flags
&
CONSOLE_OUTPUT_HANDLE
)
NtClose
(
GetStdHandle
(
STD_OUTPUT_HANDLE
));
if
(
console_flags
&
CONSOLE_ERROR_HANDLE
)
NtClose
(
GetStdHandle
(
STD_ERROR_HANDLE
));
...
...
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