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
27cb7c72
Commit
27cb7c72
authored
Nov 10, 2007
by
Andrey Turkin
Committed by
Alexandre Julliard
Nov 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Make certain winsock functions generate i/o completion messages.
parent
c702a91a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
3 deletions
+76
-3
socket.c
dlls/ws2_32/socket.c
+24
-2
server_protocol.h
include/wine/server_protocol.h
+19
-1
fd.c
server/fd.c
+11
-0
protocol.def
server/protocol.def
+9
-0
request.h
server/request.h
+2
-0
trace.c
server/trace.c
+11
-0
No files found.
dlls/ws2_32/socket.c
View file @
27cb7c72
...
...
@@ -2562,6 +2562,22 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds,
return
ret
;
}
/* helper to send completion messages for client-only i/o operation case */
static
void
WS_AddCompletion
(
SOCKET
sock
,
ULONG_PTR
CompletionValue
,
NTSTATUS
CompletionStatus
,
ULONG_PTR
Information
)
{
NTSTATUS
status
;
SERVER_START_REQ
(
add_fd_completion
)
{
req
->
handle
=
SOCKET2HANDLE
(
sock
);
req
->
cvalue
=
CompletionValue
;
req
->
status
=
CompletionStatus
;
req
->
information
=
Information
;
status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
}
/***********************************************************************
* send (WS2_32.19)
...
...
@@ -2613,6 +2629,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
unsigned
int
i
,
options
;
int
n
,
fd
,
err
;
struct
iovec
iovec
[
WS_MSG_MAXIOVLEN
];
ULONG_PTR
cvalue
=
(
lpOverlapped
&&
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
==
0
)
?
(
ULONG_PTR
)
lpOverlapped
:
0
;
TRACE
(
"socket %04lx, wsabuf %p, nbufs %d, flags %d, to %p, tolen %d, ovl %p, func %p
\n
"
,
s
,
lpBuffers
,
dwBufferCount
,
dwFlags
,
...
...
@@ -2649,6 +2666,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
if
(
n
==
-
1
&&
errno
!=
EAGAIN
)
{
err
=
wsaErrno
();
if
(
cvalue
)
WS_AddCompletion
(
s
,
cvalue
,
err
,
0
);
goto
error
;
}
...
...
@@ -2689,7 +2707,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
req
->
async
.
arg
=
wsa
;
req
->
async
.
apc
=
ws2_async_apc
;
req
->
async
.
event
=
lpCompletionRoutine
?
0
:
lpOverlapped
->
hEvent
;
req
->
async
.
cvalue
=
0
;
req
->
async
.
cvalue
=
cvalue
;
err
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
...
...
@@ -2704,6 +2722,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
*
lpNumberOfBytesSent
=
n
;
if
(
!
wsa
->
completion_func
)
{
if
(
cvalue
)
WS_AddCompletion
(
s
,
cvalue
,
STATUS_SUCCESS
,
n
);
SetEvent
(
lpOverlapped
->
hEvent
);
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
}
...
...
@@ -4127,6 +4146,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
int
n
,
fd
,
err
;
DWORD
timeout_start
=
GetTickCount
();
struct
iovec
iovec
[
WS_MSG_MAXIOVLEN
];
ULONG_PTR
cvalue
=
(
lpOverlapped
&&
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
==
0
)
?
(
ULONG_PTR
)
lpOverlapped
:
0
;
TRACE
(
"socket %04lx, wsabuf %p, nbufs %d, flags %d, from %p, fromlen %d, ovl %p, func %p
\n
"
,
s
,
lpBuffers
,
dwBufferCount
,
*
lpFlags
,
lpFrom
,
...
...
@@ -4159,6 +4179,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
if
(
errno
!=
EAGAIN
)
{
err
=
wsaErrno
();
if
(
cvalue
)
WS_AddCompletion
(
s
,
cvalue
,
err
,
0
);
goto
error
;
}
}
...
...
@@ -4203,7 +4224,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
req
->
async
.
arg
=
wsa
;
req
->
async
.
apc
=
ws2_async_apc
;
req
->
async
.
event
=
lpCompletionRoutine
?
0
:
lpOverlapped
->
hEvent
;
req
->
async
.
cvalue
=
0
;
req
->
async
.
cvalue
=
cvalue
;
err
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
...
...
@@ -4217,6 +4238,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
iosb
->
Information
=
n
;
if
(
!
wsa
->
completion_func
)
{
if
(
cvalue
)
WS_AddCompletion
(
s
,
cvalue
,
STATUS_SUCCESS
,
n
);
SetEvent
(
lpOverlapped
->
hEvent
);
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
}
...
...
include/wine/server_protocol.h
View file @
27cb7c72
...
...
@@ -4189,6 +4189,21 @@ struct set_completion_info_reply
};
struct
add_fd_completion_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
unsigned
long
cvalue
;
unsigned
int
status
;
unsigned
long
information
;
};
struct
add_fd_completion_reply
{
struct
reply_header
__header
;
};
enum
request
{
REQ_new_process
,
...
...
@@ -4418,6 +4433,7 @@ enum request
REQ_remove_completion
,
REQ_query_completion
,
REQ_set_completion_info
,
REQ_add_fd_completion
,
REQ_NB_REQUESTS
};
...
...
@@ -4652,6 +4668,7 @@ union generic_request
struct
remove_completion_request
remove_completion_request
;
struct
query_completion_request
query_completion_request
;
struct
set_completion_info_request
set_completion_info_request
;
struct
add_fd_completion_request
add_fd_completion_request
;
};
union
generic_reply
{
...
...
@@ -4884,8 +4901,9 @@ union generic_reply
struct
remove_completion_reply
remove_completion_reply
;
struct
query_completion_reply
query_completion_reply
;
struct
set_completion_info_reply
set_completion_info_reply
;
struct
add_fd_completion_reply
add_fd_completion_reply
;
};
#define SERVER_PROTOCOL_VERSION 3
29
#define SERVER_PROTOCOL_VERSION 3
30
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/fd.c
View file @
27cb7c72
...
...
@@ -2056,3 +2056,14 @@ DECL_HANDLER(set_completion_info)
release_object
(
fd
);
}
}
/* push new completion msg into a completion queue attached to the fd */
DECL_HANDLER
(
add_fd_completion
)
{
struct
fd
*
fd
=
get_handle_fd_obj
(
current
->
process
,
req
->
handle
,
0
);
if
(
fd
)
{
fd_add_completion
(
fd
,
req
->
cvalue
,
req
->
status
,
req
->
information
);
release_object
(
fd
);
}
}
server/protocol.def
View file @
27cb7c72
...
...
@@ -3006,3 +3006,12 @@ enum message_type
obj_handle_t chandle; /* port handle */
unsigned long ckey; /* completion key */
@END
/* check for associated completion and push msg */
@REQ(add_fd_completion)
obj_handle_t handle; /* async' object */
unsigned long cvalue; /* completion value */
unsigned int status; /* completion status */
unsigned long information; /* IO_STATUS_BLOCK Information */
@END
server/request.h
View file @
27cb7c72
...
...
@@ -337,6 +337,7 @@ DECL_HANDLER(add_completion);
DECL_HANDLER
(
remove_completion
);
DECL_HANDLER
(
query_completion
);
DECL_HANDLER
(
set_completion_info
);
DECL_HANDLER
(
add_fd_completion
);
#ifdef WANT_REQUEST_HANDLERS
...
...
@@ -570,6 +571,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(
req_handler
)
req_remove_completion
,
(
req_handler
)
req_query_completion
,
(
req_handler
)
req_set_completion_info
,
(
req_handler
)
req_add_fd_completion
,
};
#endif
/* WANT_REQUEST_HANDLERS */
...
...
server/trace.c
View file @
27cb7c72
...
...
@@ -3698,6 +3698,14 @@ static void dump_set_completion_info_request( const struct set_completion_info_r
fprintf
(
stderr
,
" ckey=%lx"
,
req
->
ckey
);
}
static
void
dump_add_fd_completion_request
(
const
struct
add_fd_completion_request
*
req
)
{
fprintf
(
stderr
,
" handle=%p,"
,
req
->
handle
);
fprintf
(
stderr
,
" cvalue=%lx,"
,
req
->
cvalue
);
fprintf
(
stderr
,
" status=%08x,"
,
req
->
status
);
fprintf
(
stderr
,
" information=%lx"
,
req
->
information
);
}
static
const
dump_func
req_dumpers
[
REQ_NB_REQUESTS
]
=
{
(
dump_func
)
dump_new_process_request
,
(
dump_func
)
dump_get_new_process_info_request
,
...
...
@@ -3926,6 +3934,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_remove_completion_request
,
(
dump_func
)
dump_query_completion_request
,
(
dump_func
)
dump_set_completion_info_request
,
(
dump_func
)
dump_add_fd_completion_request
,
};
static
const
dump_func
reply_dumpers
[
REQ_NB_REQUESTS
]
=
{
...
...
@@ -4156,6 +4165,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_remove_completion_reply
,
(
dump_func
)
dump_query_completion_reply
,
(
dump_func
)
0
,
(
dump_func
)
0
,
};
static
const
char
*
const
req_names
[
REQ_NB_REQUESTS
]
=
{
...
...
@@ -4386,6 +4396,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"remove_completion"
,
"query_completion"
,
"set_completion_info"
,
"add_fd_completion"
,
};
static
const
struct
...
...
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