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
743929e4
Commit
743929e4
authored
Nov 26, 2011
by
Bruno Jesus
Committed by
Alexandre Julliard
Nov 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Fix function GetAcceptExSockaddrs.
parent
c253bab2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
socket.c
dlls/ws2_32/socket.c
+2
-2
sock.c
dlls/ws2_32/tests/sock.c
+31
-3
No files found.
dlls/ws2_32/socket.c
View file @
743929e4
...
...
@@ -1675,13 +1675,13 @@ static NTSTATUS WS2_async_accept( void *arg, IO_STATUS_BLOCK *iosb, NTSTATUS sta
/* WS2 Spec says size param is extra 16 bytes long...what do we put in it? */
addr
=
((
char
*
)
wsa
->
buf
)
+
wsa
->
data_len
;
len
=
wsa
->
local_len
-
sizeof
(
int
);
WS_get
peer
name
(
HANDLE2SOCKET
(
wsa
->
accept_socket
),
WS_get
sock
name
(
HANDLE2SOCKET
(
wsa
->
accept_socket
),
(
struct
WS_sockaddr
*
)(
addr
+
sizeof
(
int
)),
&
len
);
*
(
int
*
)
addr
=
len
;
addr
+=
wsa
->
local_len
;
len
=
wsa
->
remote_len
-
sizeof
(
int
);
WS_get
sock
name
(
HANDLE2SOCKET
(
wsa
->
accept_socket
),
WS_get
peer
name
(
HANDLE2SOCKET
(
wsa
->
accept_socket
),
(
struct
WS_sockaddr
*
)(
addr
+
sizeof
(
int
)),
&
len
);
*
(
int
*
)
addr
=
len
;
...
...
dlls/ws2_32/tests/sock.c
View file @
743929e4
...
...
@@ -4495,17 +4495,18 @@ static void test_AcceptEx(void)
SOCKET
acceptor
=
INVALID_SOCKET
;
SOCKET
connector
=
INVALID_SOCKET
;
SOCKET
connector2
=
INVALID_SOCKET
;
struct
sockaddr_in
bindAddress
;
struct
sockaddr_in
bindAddress
,
peerAddress
,
*
readBindAddress
,
*
readRemoteAddress
;
int
socklen
;
GUID
acceptExGuid
=
WSAID_ACCEPTEX
;
GUID
acceptExGuid
=
WSAID_ACCEPTEX
,
getAcceptExGuid
=
WSAID_GETACCEPTEXSOCKADDRS
;
LPFN_ACCEPTEX
pAcceptEx
=
NULL
;
LPFN_GETACCEPTEXSOCKADDRS
pGetAcceptExSockaddrs
=
NULL
;
fd_set
fds_accept
,
fds_send
;
struct
timeval
timeout
=
{
0
,
10
};
/* wait for 10 milliseconds */
int
got
,
conn1
,
i
;
DWORD
bytesReturned
;
char
buffer
[
1024
];
OVERLAPPED
overlapped
;
int
iret
;
int
iret
,
localSize
=
sizeof
(
struct
sockaddr_in
),
remoteSize
=
localSize
;
BOOL
bret
;
DWORD
dwret
;
...
...
@@ -4557,6 +4558,13 @@ static void test_AcceptEx(void)
goto
end
;
}
iret
=
WSAIoctl
(
listener
,
SIO_GET_EXTENSION_FUNCTION_POINTER
,
&
getAcceptExGuid
,
sizeof
(
getAcceptExGuid
),
&
pGetAcceptExSockaddrs
,
sizeof
(
pGetAcceptExSockaddrs
),
&
bytesReturned
,
NULL
,
NULL
);
if
(
iret
)
{
skip
(
"WSAIoctl failed to get GetAcceptExSockaddrs with ret %d + errno %d
\n
"
,
iret
,
WSAGetLastError
());
goto
end
;
}
bret
=
pAcceptEx
(
INVALID_SOCKET
,
acceptor
,
buffer
,
sizeof
(
buffer
)
-
2
*
(
sizeof
(
struct
sockaddr_in
)
+
16
),
sizeof
(
struct
sockaddr_in
)
+
16
,
sizeof
(
struct
sockaddr_in
)
+
16
,
&
bytesReturned
,
&
overlapped
);
...
...
@@ -4693,6 +4701,26 @@ static void test_AcceptEx(void)
dwret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
0
);
ok
(
dwret
==
WAIT_TIMEOUT
,
"Waiting for accept event timeout failed with %d + errno %d
\n
"
,
dwret
,
GetLastError
());
iret
=
getsockname
(
connector
,
(
struct
sockaddr
*
)
&
peerAddress
,
&
remoteSize
);
ok
(
!
iret
,
"getsockname failed.
\n
"
);
/* Check if the buffer from AcceptEx is decoded correclty */
pGetAcceptExSockaddrs
(
buffer
,
2
,
sizeof
(
struct
sockaddr_in
)
+
16
,
sizeof
(
struct
sockaddr_in
)
+
16
,
(
struct
sockaddr
**
)
&
readBindAddress
,
&
localSize
,
(
struct
sockaddr
**
)
&
readRemoteAddress
,
&
remoteSize
);
ok
(
readBindAddress
->
sin_addr
.
s_addr
==
bindAddress
.
sin_addr
.
s_addr
,
"Local socket address is different %s != %s
\n
"
,
inet_ntoa
(
readBindAddress
->
sin_addr
),
inet_ntoa
(
bindAddress
.
sin_addr
));
ok
(
readBindAddress
->
sin_port
==
bindAddress
.
sin_port
,
"Local socket port is different: %d != %d
\n
"
,
readBindAddress
->
sin_port
,
bindAddress
.
sin_port
);
ok
(
readRemoteAddress
->
sin_addr
.
s_addr
==
peerAddress
.
sin_addr
.
s_addr
,
"Remote socket address is different %s != %s
\n
"
,
inet_ntoa
(
readRemoteAddress
->
sin_addr
),
inet_ntoa
(
peerAddress
.
sin_addr
));
ok
(
readRemoteAddress
->
sin_port
==
peerAddress
.
sin_port
,
"Remote socket port is different: %d != %d
\n
"
,
readRemoteAddress
->
sin_port
,
peerAddress
.
sin_port
);
iret
=
send
(
connector
,
buffer
,
1
,
0
);
ok
(
iret
==
1
,
"could not send 1 byte: send %d errno %d
\n
"
,
iret
,
WSAGetLastError
());
...
...
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