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
a86a2894
Commit
a86a2894
authored
Jun 23, 2003
by
Eric Pouech
Committed by
Alexandre Julliard
Jun 23, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In console input record queue, replace semaphore with a manual reset
event, so that we get correct behavior in synchronization handling.
parent
76f93fb6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
32 deletions
+16
-32
console.c
dlls/kernel/console.c
+4
-7
server_protocol.h
include/wine/server_protocol.h
+1
-2
wineconsole.c
programs/wineconsole/wineconsole.c
+1
-4
console.c
server/console.c
+8
-15
console.h
server/console.h
+1
-1
protocol.def
server/protocol.def
+0
-1
trace.c
server/trace.c
+1
-2
No files found.
dlls/kernel/console.c
View file @
a86a2894
...
@@ -191,7 +191,7 @@ BOOL WINAPI WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer,
...
@@ -191,7 +191,7 @@ BOOL WINAPI WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer,
DWORD
count
,
LPDWORD
written
)
DWORD
count
,
LPDWORD
written
)
{
{
BOOL
ret
;
BOOL
ret
;
DWORD
w
;
TRACE
(
"(%p,%p,%ld,%p)
\n
"
,
handle
,
buffer
,
count
,
written
);
TRACE
(
"(%p,%p,%ld,%p)
\n
"
,
handle
,
buffer
,
count
,
written
);
if
(
written
)
*
written
=
0
;
if
(
written
)
*
written
=
0
;
...
@@ -199,14 +199,11 @@ BOOL WINAPI WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer,
...
@@ -199,14 +199,11 @@ BOOL WINAPI WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer,
{
{
req
->
handle
=
console_handle_unmap
(
handle
);
req
->
handle
=
console_handle_unmap
(
handle
);
wine_server_add_data
(
req
,
buffer
,
count
*
sizeof
(
INPUT_RECORD
)
);
wine_server_add_data
(
req
,
buffer
,
count
*
sizeof
(
INPUT_RECORD
)
);
if
((
ret
=
!
wine_server_call_err
(
req
)))
w
=
reply
->
written
;
if
((
ret
=
!
wine_server_call_err
(
req
))
&&
written
)
*
written
=
reply
->
written
;
}
}
SERVER_END_REQ
;
SERVER_END_REQ
;
if
(
ret
)
{
ReleaseSemaphore
(
GetConsoleInputWaitHandle
(),
w
,
NULL
);
if
(
written
)
*
written
=
w
;
}
return
ret
;
return
ret
;
}
}
...
...
include/wine/server_protocol.h
View file @
a86a2894
...
@@ -1036,7 +1036,6 @@ struct alloc_console_request
...
@@ -1036,7 +1036,6 @@ struct alloc_console_request
unsigned
int
access
;
unsigned
int
access
;
int
inherit
;
int
inherit
;
process_id_t
pid
;
process_id_t
pid
;
obj_handle_t
wait_event
;
};
};
struct
alloc_console_reply
struct
alloc_console_reply
{
{
...
@@ -3583,6 +3582,6 @@ union generic_reply
...
@@ -3583,6 +3582,6 @@ union generic_reply
struct
get_next_hook_reply
get_next_hook_reply
;
struct
get_next_hook_reply
get_next_hook_reply
;
};
};
#define SERVER_PROTOCOL_VERSION 11
0
#define SERVER_PROTOCOL_VERSION 11
1
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
programs/wineconsole/wineconsole.c
View file @
a86a2894
...
@@ -535,7 +535,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
...
@@ -535,7 +535,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
DWORD
ret
;
DWORD
ret
;
struct
config_data
cfg
;
struct
config_data
cfg
;
STARTUPINFOW
si
;
STARTUPINFOW
si
;
HANDLE
sem
;
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
));
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
));
if
(
!
data
)
return
0
;
if
(
!
data
)
return
0
;
...
@@ -564,7 +563,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
...
@@ -564,7 +563,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
/* should always be defined */
/* should always be defined */
}
}
sem
=
CreateSemaphore
(
NULL
,
0
,
65536
,
NULL
);
/* the handles here are created without the whistles and bells required by console
/* the handles here are created without the whistles and bells required by console
* (mainly because wineconsole doesn't need it)
* (mainly because wineconsole doesn't need it)
* - they are not inheritable
* - they are not inheritable
...
@@ -574,8 +572,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
...
@@ -574,8 +572,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
{
{
req
->
access
=
GENERIC_READ
|
GENERIC_WRITE
;
req
->
access
=
GENERIC_READ
|
GENERIC_WRITE
;
req
->
inherit
=
FALSE
;
req
->
inherit
=
FALSE
;
req
->
pid
=
pid
;
req
->
pid
=
pid
;
req
->
wait_event
=
sem
;
ret
=
!
wine_server_call_err
(
req
);
ret
=
!
wine_server_call_err
(
req
);
data
->
hConIn
=
(
HANDLE
)
reply
->
handle_in
;
data
->
hConIn
=
(
HANDLE
)
reply
->
handle_in
;
...
...
server/console.c
View file @
a86a2894
...
@@ -203,7 +203,7 @@ static struct console_input_events *create_console_input_events(void)
...
@@ -203,7 +203,7 @@ static struct console_input_events *create_console_input_events(void)
return
evt
;
return
evt
;
}
}
static
struct
object
*
create_console_input
(
struct
thread
*
renderer
,
struct
object
*
wait_obj
)
static
struct
object
*
create_console_input
(
struct
thread
*
renderer
)
{
{
struct
console_input
*
console_input
;
struct
console_input
*
console_input
;
...
@@ -222,7 +222,7 @@ static struct object *create_console_input( struct thread* renderer, struct obje
...
@@ -222,7 +222,7 @@ static struct object *create_console_input( struct thread* renderer, struct obje
console_input
->
history_index
=
0
;
console_input
->
history_index
=
0
;
console_input
->
history_mode
=
0
;
console_input
->
history_mode
=
0
;
console_input
->
edition_mode
=
0
;
console_input
->
edition_mode
=
0
;
console_input
->
wait_obj
=
wait_obj
;
console_input
->
event
=
create_event
(
NULL
,
0
,
1
,
0
)
;
if
(
!
console_input
->
history
||
!
console_input
->
evt
)
if
(
!
console_input
->
history
||
!
console_input
->
evt
)
{
{
...
@@ -514,9 +514,8 @@ static int write_console_input( struct console_input* console, int count,
...
@@ -514,9 +514,8 @@ static int write_console_input( struct console_input* console, int count,
else
i
++
;
else
i
++
;
}
}
}
}
if
(
!
console
->
recnum
&&
count
)
set_event
(
console
->
event
);
console
->
recnum
+=
count
;
console
->
recnum
+=
count
;
/* wake up all waiters */
wake_up
(
&
console
->
obj
,
0
);
return
count
;
return
count
;
}
}
...
@@ -555,6 +554,7 @@ static int read_console_input( obj_handle_t handle, int count, int flush )
...
@@ -555,6 +554,7 @@ static int read_console_input( obj_handle_t handle, int count, int flush )
{
{
free
(
console
->
records
);
free
(
console
->
records
);
console
->
records
=
NULL
;
console
->
records
=
NULL
;
reset_event
(
console
->
event
);
}
}
}
}
release_object
(
console
);
release_object
(
console
);
...
@@ -943,7 +943,7 @@ static void console_input_destroy( struct object *obj )
...
@@ -943,7 +943,7 @@ static void console_input_destroy( struct object *obj )
release_object
(
console_in
->
evt
);
release_object
(
console_in
->
evt
);
console_in
->
evt
=
NULL
;
console_in
->
evt
=
NULL
;
release_object
(
console_in
->
wait_obj
);
release_object
(
console_in
->
event
);
for
(
i
=
0
;
i
<
console_in
->
history_size
;
i
++
)
for
(
i
=
0
;
i
<
console_in
->
history_size
;
i
++
)
if
(
console_in
->
history
[
i
])
free
(
console_in
->
history
[
i
]
);
if
(
console_in
->
history
[
i
])
free
(
console_in
->
history
[
i
]
);
...
@@ -1209,7 +1209,6 @@ DECL_HANDLER(alloc_console)
...
@@ -1209,7 +1209,6 @@ DECL_HANDLER(alloc_console)
struct
process
*
process
;
struct
process
*
process
;
struct
process
*
renderer
=
current
->
process
;
struct
process
*
renderer
=
current
->
process
;
struct
console_input
*
console
;
struct
console_input
*
console
;
struct
object
*
wait_event
;
process
=
(
req
->
pid
)
?
get_process_from_id
(
req
->
pid
)
:
process
=
(
req
->
pid
)
?
get_process_from_id
(
req
->
pid
)
:
(
struct
process
*
)
grab_object
(
renderer
->
parent
);
(
struct
process
*
)
grab_object
(
renderer
->
parent
);
...
@@ -1222,13 +1221,7 @@ DECL_HANDLER(alloc_console)
...
@@ -1222,13 +1221,7 @@ DECL_HANDLER(alloc_console)
set_error
(
STATUS_ACCESS_DENIED
);
set_error
(
STATUS_ACCESS_DENIED
);
goto
the_end
;
goto
the_end
;
}
}
wait_event
=
get_handle_obj
(
renderer
,
req
->
wait_event
,
0
,
NULL
);
if
((
console
=
(
struct
console_input
*
)
create_console_input
(
current
)))
if
(
!
wait_event
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
goto
the_end
;
}
if
((
console
=
(
struct
console_input
*
)
create_console_input
(
current
,
wait_event
)))
{
{
if
((
in
=
alloc_handle
(
renderer
,
console
,
req
->
access
,
req
->
inherit
)))
if
((
in
=
alloc_handle
(
renderer
,
console
,
req
->
access
,
req
->
inherit
)))
{
{
...
@@ -1531,8 +1524,8 @@ DECL_HANDLER(get_console_wait_event)
...
@@ -1531,8 +1524,8 @@ DECL_HANDLER(get_console_wait_event)
if
(
console
)
if
(
console
)
{
{
reply
->
handle
=
alloc_handle
(
current
->
process
,
console
->
wait_obj
,
reply
->
handle
=
alloc_handle
(
current
->
process
,
console
->
event
,
SEMAPHORE
_ALL_ACCESS
,
FALSE
);
EVENT
_ALL_ACCESS
,
FALSE
);
release_object
(
console
);
release_object
(
console
);
}
}
else
set_error
(
STATUS_INVALID_PARAMETER
);
else
set_error
(
STATUS_INVALID_PARAMETER
);
...
...
server/console.h
View file @
a86a2894
...
@@ -42,7 +42,7 @@ struct console_input
...
@@ -42,7 +42,7 @@ struct console_input
int
history_index
;
/* number of used entries in history array */
int
history_index
;
/* number of used entries in history array */
int
history_mode
;
/* mode of history (non zero means remove doubled strings */
int
history_mode
;
/* mode of history (non zero means remove doubled strings */
int
edition_mode
;
/* index to edition mode flavors */
int
edition_mode
;
/* index to edition mode flavors */
struct
object
*
wait_obj
;
/* objec
t to wait on for input queue */
struct
event
*
event
;
/* even
t to wait on for input queue */
};
};
/* console functions */
/* console functions */
...
...
server/protocol.def
View file @
a86a2894
...
@@ -775,7 +775,6 @@ enum fd_type
...
@@ -775,7 +775,6 @@ enum fd_type
unsigned int access; /* wanted access rights */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
int inherit; /* inherit flag */
process_id_t pid; /* pid of process which shall be attached to the console */
process_id_t pid; /* pid of process which shall be attached to the console */
obj_handle_t wait_event; /* semaphore for number of active input events */
@REPLY
@REPLY
obj_handle_t handle_in; /* handle to console input */
obj_handle_t handle_in; /* handle to console input */
obj_handle_t event; /* handle to renderer events change notification */
obj_handle_t event; /* handle to renderer events change notification */
...
...
server/trace.c
View file @
a86a2894
...
@@ -997,8 +997,7 @@ static void dump_alloc_console_request( const struct alloc_console_request *req
...
@@ -997,8 +997,7 @@ static void dump_alloc_console_request( const struct alloc_console_request *req
{
{
fprintf
(
stderr
,
" access=%08x,"
,
req
->
access
);
fprintf
(
stderr
,
" access=%08x,"
,
req
->
access
);
fprintf
(
stderr
,
" inherit=%d,"
,
req
->
inherit
);
fprintf
(
stderr
,
" inherit=%d,"
,
req
->
inherit
);
fprintf
(
stderr
,
" pid=%04x,"
,
req
->
pid
);
fprintf
(
stderr
,
" pid=%04x"
,
req
->
pid
);
fprintf
(
stderr
,
" wait_event=%p"
,
req
->
wait_event
);
}
}
static
void
dump_alloc_console_reply
(
const
struct
alloc_console_reply
*
req
)
static
void
dump_alloc_console_reply
(
const
struct
alloc_console_reply
*
req
)
...
...
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