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
cc5afe41
Commit
cc5afe41
authored
Nov 10, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Wait directly on console handles.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2eb86444
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
33 deletions
+6
-33
console.c
dlls/kernelbase/console.c
+1
-24
kernelbase.h
dlls/kernelbase/kernelbase.h
+0
-1
sync.c
dlls/kernelbase/sync.c
+5
-8
No files found.
dlls/kernelbase/console.c
View file @
cc5afe41
...
...
@@ -37,8 +37,8 @@
#include "winnls.h"
#include "winerror.h"
#include "wincon.h"
#include "winternl.h"
#include "wine/condrv.h"
#include "wine/server.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "kernelbase.h"
...
...
@@ -56,7 +56,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
static
CRITICAL_SECTION
console_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
HANDLE
console_connection
;
static
HANDLE
console_wait_event
;
static
unsigned
int
console_flags
;
#define CONSOLE_INPUT_HANDLE 0x01
...
...
@@ -559,32 +558,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH FillConsoleOutputCharacterW( HANDLE handle, WCHAR
written
,
sizeof
(
*
written
),
NULL
);
}
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
;
RtlEnterCriticalSection
(
&
console_section
);
NtClose
(
console_connection
);
...
...
@@ -598,8 +577,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeConsole(void)
if
(
console_flags
&
CONSOLE_ERROR_HANDLE
)
NtClose
(
GetStdHandle
(
STD_ERROR_HANDLE
));
console_flags
=
0
;
if
((
event
=
InterlockedExchangePointer
(
&
console_wait_event
,
NULL
)))
NtClose
(
event
);
RtlLeaveCriticalSection
(
&
console_section
);
return
TRUE
;
}
...
...
dlls/kernelbase/kernelbase.h
View file @
cc5afe41
...
...
@@ -36,7 +36,6 @@ extern DWORD file_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen )
extern
void
init_startup_info
(
RTL_USER_PROCESS_PARAMETERS
*
params
)
DECLSPEC_HIDDEN
;
extern
void
init_locale
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_console
(
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 @
cc5afe41
...
...
@@ -211,17 +211,14 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
***********************************************************************/
static
HANDLE
normalize_
handle_if_conso
le
(
HANDLE
handle
)
static
HANDLE
normalize_
std_hand
le
(
HANDLE
handle
)
{
if
((
handle
==
(
HANDLE
)
STD_INPUT_HANDLE
)
||
(
handle
==
(
HANDLE
)
STD_OUTPUT_HANDLE
)
||
(
handle
==
(
HANDLE
)
STD_ERROR_HANDLE
))
handle
=
GetStdHandle
(
HandleToULong
(
handle
)
);
return
GetStdHandle
(
HandleToULong
(
handle
)
);
/* even screen buffer console handles are waitable, and are
* handled as a handle to the console itself
*/
return
is_console_handle
(
handle
)
?
get_console_wait_handle
(
handle
)
:
handle
;
return
handle
;
}
...
...
@@ -235,7 +232,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH RegisterWaitForSingleObjectEx( HANDLE handle, WA
TRACE
(
"%p %p %p %d %d
\n
"
,
handle
,
callback
,
context
,
timeout
,
flags
);
handle
=
normalize_
handle_if_conso
le
(
handle
);
handle
=
normalize_
std_hand
le
(
handle
);
if
(
!
set_ntstatus
(
RtlRegisterWait
(
&
ret
,
handle
,
callback
,
context
,
timeout
,
flags
)))
return
NULL
;
return
ret
;
}
...
...
@@ -340,7 +337,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH WaitForMultipleObjectsEx( DWORD count, const HAND
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
WAIT_FAILED
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
hloc
[
i
]
=
normalize_
handle_if_conso
le
(
handles
[
i
]
);
for
(
i
=
0
;
i
<
count
;
i
++
)
hloc
[
i
]
=
normalize_
std_hand
le
(
handles
[
i
]
);
status
=
NtWaitForMultipleObjects
(
count
,
hloc
,
!
wait_all
,
alertable
,
get_nt_timeout
(
&
time
,
timeout
)
);
...
...
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