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
4031265f
Commit
4031265f
authored
Jul 01, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Invalidate console wait handle in FreeConsole.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f0696f7e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
console.c
dlls/kernelbase/console.c
+22
-0
kernelbase.h
dlls/kernelbase/kernelbase.h
+1
-0
sync.c
dlls/kernelbase/sync.c
+1
-19
No files found.
dlls/kernelbase/console.c
View file @
4031265f
...
...
@@ -53,6 +53,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static
CRITICAL_SECTION
console_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
HANDLE
console_wait_event
;
static
WCHAR
input_exe
[
MAX_PATH
+
1
];
struct
ctrl_handler
...
...
@@ -345,12 +347,31 @@ BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW( HANDLE handle, WCHAR
return
ret
;
}
HANDLE
get_console_wait_handle
(
HANDLE
handle
)
{
HANDLE
event
=
0
;
SERVER_START_REQ
(
get_console_wait_event
)
{
req
->
handle
=
wine_server_obj_handle
(
console_handle_map
(
handle
));
if
(
!
wine_server_call
(
req
))
event
=
wine_server_ptr_handle
(
reply
->
event
);
}
SERVER_END_REQ
;
if
(
event
)
{
if
(
InterlockedCompareExchangePointer
(
&
console_wait_event
,
event
,
0
))
NtClose
(
event
);
handle
=
console_wait_event
;
}
return
handle
;
}
/***********************************************************************
* FreeConsole (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
FreeConsole
(
void
)
{
HANDLE
event
;
BOOL
ret
;
SERVER_START_REQ
(
free_console
)
...
...
@@ -358,6 +379,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole(void)
ret
=
!
wine_server_call_err
(
req
);
}
SERVER_END_REQ
;
if
((
event
=
InterlockedExchangePointer
(
&
console_wait_event
,
NULL
)))
NtClose
(
event
);
return
ret
;
}
...
...
dlls/kernelbase/kernelbase.h
View file @
4031265f
...
...
@@ -28,6 +28,7 @@ extern WCHAR *file_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN;
extern
DWORD
file_name_WtoA
(
LPCWSTR
src
,
INT
srclen
,
LPSTR
dest
,
INT
destlen
)
DECLSPEC_HIDDEN
;
extern
void
init_startup_info
(
RTL_USER_PROCESS_PARAMETERS
*
params
)
DECLSPEC_HIDDEN
;
extern
void
init_locale
(
void
)
DECLSPEC_HIDDEN
;
extern
HANDLE
get_console_wait_handle
(
HANDLE
handle
)
DECLSPEC_HIDDEN
;
extern
const
WCHAR
windows_dir
[]
DECLSPEC_HIDDEN
;
extern
const
WCHAR
system_dir
[]
DECLSPEC_HIDDEN
;
...
...
dlls/kernelbase/sync.c
View file @
4031265f
...
...
@@ -213,8 +213,6 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
static
HANDLE
normalize_handle_if_console
(
HANDLE
handle
)
{
static
HANDLE
wait_event
;
if
((
handle
==
(
HANDLE
)
STD_INPUT_HANDLE
)
||
(
handle
==
(
HANDLE
)
STD_OUTPUT_HANDLE
)
||
(
handle
==
(
HANDLE
)
STD_ERROR_HANDLE
))
...
...
@@ -223,23 +221,7 @@ static HANDLE normalize_handle_if_console( HANDLE handle )
/* even screen buffer console handles are waitable, and are
* handled as a handle to the console itself
*/
if
(
is_console_handle
(
handle
))
{
HANDLE
event
=
0
;
SERVER_START_REQ
(
get_console_wait_event
)
{
req
->
handle
=
wine_server_obj_handle
(
console_handle_map
(
handle
));
if
(
!
wine_server_call
(
req
))
event
=
wine_server_ptr_handle
(
reply
->
event
);
}
SERVER_END_REQ
;
if
(
event
)
{
if
(
InterlockedCompareExchangePointer
(
&
wait_event
,
event
,
0
))
NtClose
(
event
);
handle
=
wait_event
;
}
}
return
handle
;
return
is_console_handle
(
handle
)
?
get_console_wait_handle
(
handle
)
:
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