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
0c2f556a
Commit
0c2f556a
authored
Sep 28, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Sep 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Reimplement ws_protocol_info() using the supported_protocols array.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9498f962
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
157 deletions
+20
-157
socket.c
dlls/ws2_32/socket.c
+20
-157
No files found.
dlls/ws2_32/socket.c
View file @
0c2f556a
...
@@ -185,21 +185,6 @@
...
@@ -185,21 +185,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
winsock
);
WINE_DEFAULT_DEBUG_CHANNEL
(
winsock
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
/* names of the protocols */
static
const
WCHAR
NameIpxW
[]
=
{
'I'
,
'P'
,
'X'
,
'\0'
};
static
const
WCHAR
NameSpxW
[]
=
{
'S'
,
'P'
,
'X'
,
'\0'
};
static
const
WCHAR
NameSpxIIW
[]
=
{
'S'
,
'P'
,
'X'
,
' '
,
'I'
,
'I'
,
'\0'
};
static
const
WCHAR
NameTcpW
[]
=
{
'T'
,
'C'
,
'P'
,
'/'
,
'I'
,
'P'
,
'\0'
};
static
const
WCHAR
NameUdpW
[]
=
{
'U'
,
'D'
,
'P'
,
'/'
,
'I'
,
'P'
,
'\0'
};
/* Taken from Win2k */
static
const
GUID
ProviderIdIP
=
{
0xe70f1aa0
,
0xab8b
,
0x11cf
,
{
0x8c
,
0xa3
,
0x00
,
0x80
,
0x5f
,
0x48
,
0xa1
,
0x92
}
};
static
const
GUID
ProviderIdIPX
=
{
0x11058240
,
0xbe47
,
0x11cf
,
{
0x95
,
0xc8
,
0x00
,
0x80
,
0x5f
,
0x48
,
0xa1
,
0x92
}
};
static
const
GUID
ProviderIdSPX
=
{
0x11058241
,
0xbe47
,
0x11cf
,
{
0x95
,
0xc8
,
0x00
,
0x80
,
0x5f
,
0x48
,
0xa1
,
0x92
}
};
static
const
WSAPROTOCOL_INFOW
supported_protocols
[]
=
static
const
WSAPROTOCOL_INFOW
supported_protocols
[]
=
{
{
{
{
...
@@ -2304,149 +2289,13 @@ static INT WS_DuplicateSocket(BOOL unicode, SOCKET s, DWORD dwProcessId, LPWSAPR
...
@@ -2304,149 +2289,13 @@ static INT WS_DuplicateSocket(BOOL unicode, SOCKET s, DWORD dwProcessId, LPWSAPR
return
0
;
return
0
;
}
}
/*****************************************************************************
* WS_EnterSingleProtocolW [internal]
*
* enters the protocol information of one given protocol into the given
* buffer.
*
* RETURNS
* TRUE if a protocol was entered into the buffer.
*
* BUGS
* - only implemented for IPX, SPX, SPXII, TCP, UDP
* - there is no check that the operating system supports the returned
* protocols
*/
static
BOOL
WS_EnterSingleProtocolW
(
INT
protocol
,
WSAPROTOCOL_INFOW
*
info
)
{
memset
(
info
,
0
,
sizeof
(
WSAPROTOCOL_INFOW
)
);
info
->
iProtocol
=
protocol
;
switch
(
protocol
)
{
case
WS_IPPROTO_TCP
:
info
->
dwServiceFlags1
=
XP1_IFS_HANDLES
|
XP1_EXPEDITED_DATA
|
XP1_GRACEFUL_CLOSE
|
XP1_GUARANTEED_ORDER
|
XP1_GUARANTEED_DELIVERY
;
info
->
ProviderId
=
ProviderIdIP
;
info
->
dwCatalogEntryId
=
0x3e9
;
info
->
dwProviderFlags
=
PFL_MATCHES_PROTOCOL_ZERO
;
info
->
ProtocolChain
.
ChainLen
=
1
;
info
->
iVersion
=
2
;
info
->
iAddressFamily
=
WS_AF_INET
;
info
->
iMaxSockAddr
=
0x10
;
info
->
iMinSockAddr
=
0x10
;
info
->
iSocketType
=
WS_SOCK_STREAM
;
strcpyW
(
info
->
szProtocol
,
NameTcpW
);
break
;
case
WS_IPPROTO_UDP
:
info
->
dwServiceFlags1
=
XP1_IFS_HANDLES
|
XP1_SUPPORT_BROADCAST
|
XP1_SUPPORT_MULTIPOINT
|
XP1_MESSAGE_ORIENTED
|
XP1_CONNECTIONLESS
;
info
->
ProviderId
=
ProviderIdIP
;
info
->
dwCatalogEntryId
=
0x3ea
;
info
->
dwProviderFlags
=
PFL_MATCHES_PROTOCOL_ZERO
;
info
->
ProtocolChain
.
ChainLen
=
1
;
info
->
iVersion
=
2
;
info
->
iAddressFamily
=
WS_AF_INET
;
info
->
iMaxSockAddr
=
0x10
;
info
->
iMinSockAddr
=
0x10
;
info
->
iSocketType
=
WS_SOCK_DGRAM
;
info
->
dwMessageSize
=
0xffbb
;
strcpyW
(
info
->
szProtocol
,
NameUdpW
);
break
;
case
WS_NSPROTO_IPX
:
info
->
dwServiceFlags1
=
XP1_PARTIAL_MESSAGE
|
XP1_SUPPORT_BROADCAST
|
XP1_SUPPORT_MULTIPOINT
|
XP1_MESSAGE_ORIENTED
|
XP1_CONNECTIONLESS
;
info
->
ProviderId
=
ProviderIdIPX
;
info
->
dwCatalogEntryId
=
0x406
;
info
->
dwProviderFlags
=
PFL_MATCHES_PROTOCOL_ZERO
;
info
->
ProtocolChain
.
ChainLen
=
1
;
info
->
iVersion
=
2
;
info
->
iAddressFamily
=
WS_AF_IPX
;
info
->
iMaxSockAddr
=
0x10
;
info
->
iMinSockAddr
=
0x0e
;
info
->
iSocketType
=
WS_SOCK_DGRAM
;
info
->
iProtocolMaxOffset
=
0xff
;
info
->
dwMessageSize
=
0x240
;
strcpyW
(
info
->
szProtocol
,
NameIpxW
);
break
;
case
WS_NSPROTO_SPX
:
info
->
dwServiceFlags1
=
XP1_IFS_HANDLES
|
XP1_PSEUDO_STREAM
|
XP1_MESSAGE_ORIENTED
|
XP1_GUARANTEED_ORDER
|
XP1_GUARANTEED_DELIVERY
;
info
->
ProviderId
=
ProviderIdSPX
;
info
->
dwCatalogEntryId
=
0x407
;
info
->
dwProviderFlags
=
PFL_MATCHES_PROTOCOL_ZERO
;
info
->
ProtocolChain
.
ChainLen
=
1
;
info
->
iVersion
=
2
;
info
->
iAddressFamily
=
WS_AF_IPX
;
info
->
iMaxSockAddr
=
0x10
;
info
->
iMinSockAddr
=
0x0e
;
info
->
iSocketType
=
WS_SOCK_SEQPACKET
;
info
->
dwMessageSize
=
0xffffffff
;
strcpyW
(
info
->
szProtocol
,
NameSpxW
);
break
;
case
WS_NSPROTO_SPXII
:
info
->
dwServiceFlags1
=
XP1_IFS_HANDLES
|
XP1_GRACEFUL_CLOSE
|
XP1_PSEUDO_STREAM
|
XP1_MESSAGE_ORIENTED
|
XP1_GUARANTEED_ORDER
|
XP1_GUARANTEED_DELIVERY
;
info
->
ProviderId
=
ProviderIdSPX
;
info
->
dwCatalogEntryId
=
0x409
;
info
->
dwProviderFlags
=
PFL_MATCHES_PROTOCOL_ZERO
;
info
->
ProtocolChain
.
ChainLen
=
1
;
info
->
iVersion
=
2
;
info
->
iAddressFamily
=
WS_AF_IPX
;
info
->
iMaxSockAddr
=
0x10
;
info
->
iMinSockAddr
=
0x0e
;
info
->
iSocketType
=
WS_SOCK_SEQPACKET
;
info
->
dwMessageSize
=
0xffffffff
;
strcpyW
(
info
->
szProtocol
,
NameSpxIIW
);
break
;
default:
FIXME
(
"unknown Protocol <0x%08x>
\n
"
,
protocol
);
return
FALSE
;
}
return
TRUE
;
}
/*****************************************************************************
* WS_EnterSingleProtocolA [internal]
*
* see function WS_EnterSingleProtocolW
*
*/
static
BOOL
WS_EnterSingleProtocolA
(
INT
protocol
,
WSAPROTOCOL_INFOA
*
info
)
{
WSAPROTOCOL_INFOW
infow
;
INT
ret
;
memset
(
info
,
0
,
sizeof
(
WSAPROTOCOL_INFOA
)
);
ret
=
WS_EnterSingleProtocolW
(
protocol
,
&
infow
);
if
(
ret
)
{
/* convert the structure from W to A */
memcpy
(
info
,
&
infow
,
FIELD_OFFSET
(
WSAPROTOCOL_INFOA
,
szProtocol
)
);
WideCharToMultiByte
(
CP_ACP
,
0
,
infow
.
szProtocol
,
-
1
,
info
->
szProtocol
,
WSAPROTOCOL_LEN
+
1
,
NULL
,
NULL
);
}
return
ret
;
}
static
BOOL
ws_protocol_info
(
SOCKET
s
,
int
unicode
,
WSAPROTOCOL_INFOW
*
buffer
,
int
*
size
)
static
BOOL
ws_protocol_info
(
SOCKET
s
,
int
unicode
,
WSAPROTOCOL_INFOW
*
buffer
,
int
*
size
)
{
{
NTSTATUS
status
;
NTSTATUS
status
;
int
address_family
;
int
address_family
;
int
socket_type
;
int
socket_type
;
int
protocol
;
int
protocol
;
unsigned
int
i
;
*
size
=
unicode
?
sizeof
(
WSAPROTOCOL_INFOW
)
:
sizeof
(
WSAPROTOCOL_INFOA
);
*
size
=
unicode
?
sizeof
(
WSAPROTOCOL_INFOW
)
:
sizeof
(
WSAPROTOCOL_INFOA
);
memset
(
buffer
,
0
,
*
size
);
memset
(
buffer
,
0
,
*
size
);
...
@@ -2471,14 +2320,28 @@ static BOOL ws_protocol_info(SOCKET s, int unicode, WSAPROTOCOL_INFOW *buffer, i
...
@@ -2471,14 +2320,28 @@ static BOOL ws_protocol_info(SOCKET s, int unicode, WSAPROTOCOL_INFOW *buffer, i
return
FALSE
;
return
FALSE
;
}
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
supported_protocols
);
++
i
)
{
const
WSAPROTOCOL_INFOW
*
info
=
&
supported_protocols
[
i
];
if
(
address_family
==
info
->
iAddressFamily
&&
socket_type
==
info
->
iSocketType
&&
protocol
>=
info
->
iProtocol
&&
protocol
<=
info
->
iProtocol
+
info
->
iProtocolMaxOffset
)
{
if
(
unicode
)
if
(
unicode
)
WS_EnterSingleProtocolW
(
protocol
,
buffer
)
;
*
buffer
=
*
info
;
else
else
WS_EnterSingleProtocolA
(
protocol
,
(
WSAPROTOCOL_INFOA
*
)
buffer
);
{
buffer
->
iAddressFamily
=
address_family
;
WSAPROTOCOL_INFOA
*
bufferA
=
(
WSAPROTOCOL_INFOA
*
)
buffer
;
buffer
->
iSocketType
=
socket_type
;
memcpy
(
bufferA
,
info
,
offsetof
(
WSAPROTOCOL_INFOW
,
szProtocol
)
);
WideCharToMultiByte
(
CP_ACP
,
0
,
info
->
szProtocol
,
-
1
,
bufferA
->
szProtocol
,
sizeof
(
bufferA
->
szProtocol
),
NULL
,
NULL
);
}
buffer
->
iProtocol
=
protocol
;
buffer
->
iProtocol
=
protocol
;
return
TRUE
;
}
}
FIXME
(
"Could not fill protocol information for family %d, type %d, protocol %d.
\n
"
,
address_family
,
socket_type
,
protocol
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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