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
5fa34304
Commit
5fa34304
authored
Aug 07, 2013
by
Bruno Jesus
Committed by
Alexandre Julliard
Aug 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Implement WSAEnumProtocols[A|W] using a helper function.
parent
8bbbf7cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
32 deletions
+29
-32
protocol.c
dlls/ws2_32/protocol.c
+29
-32
No files found.
dlls/ws2_32/protocol.c
View file @
5fa34304
...
...
@@ -204,22 +204,23 @@ static INT WINSOCK_EnterSingleProtocolA( INT protocol, WSAPROTOCOL_INFOA* info )
return
ret
;
}
/*****************************************************************************
* WSAEnumProtocolsA [WS2_32.@]
*
* see function WSAEnumProtocolsW
*/
INT
WINAPI
WSAEnumProtocolsA
(
LPINT
protocols
,
LPWSAPROTOCOL_INFOA
buffer
,
LPDWORD
len
)
static
INT
WINSOCK_EnumProtocols
(
BOOL
unicode
,
LPINT
protocols
,
LPWSAPROTOCOL_INFOW
buffer
,
LPDWORD
len
)
{
INT
i
=
0
;
DWORD
size
=
0
;
INT
local
[]
=
{
WS_IPPROTO_TCP
,
WS_IPPROTO_UDP
,
NSPROTO_IPX
,
NSPROTO_SPX
,
NSPROTO_SPXII
,
0
};
union
_info
{
LPWSAPROTOCOL_INFOA
a
;
LPWSAPROTOCOL_INFOW
w
;
}
info
;
info
.
w
=
buffer
;
if
(
!
protocols
)
protocols
=
local
;
while
(
protocols
[
i
])
i
++
;
size
=
i
*
sizeof
(
WSAPROTOCOL_INFOA
);
size
=
i
*
(
unicode
?
sizeof
(
WSAPROTOCOL_INFOW
)
:
sizeof
(
WSAPROTOCOL_INFOA
)
);
if
(
*
len
<
size
||
!
buffer
)
{
...
...
@@ -230,13 +231,31 @@ INT WINAPI WSAEnumProtocolsA( LPINT protocols, LPWSAPROTOCOL_INFOA buffer, LPDWO
for
(
i
=
0
;
protocols
[
i
];
i
++
)
{
if
(
WINSOCK_EnterSingleProtocolA
(
protocols
[
i
],
&
buffer
[
i
]
)
==
SOCKET_ERROR
)
return
i
;
if
(
unicode
)
{
if
(
WINSOCK_EnterSingleProtocolW
(
protocols
[
i
],
&
info
.
w
[
i
]
)
==
SOCKET_ERROR
)
break
;
}
else
{
if
(
WINSOCK_EnterSingleProtocolA
(
protocols
[
i
],
&
info
.
a
[
i
]
)
==
SOCKET_ERROR
)
break
;
}
}
return
i
;
}
/*****************************************************************************
* WSAEnumProtocolsA [WS2_32.@]
*
* see function WSAEnumProtocolsW
*/
INT
WINAPI
WSAEnumProtocolsA
(
LPINT
protocols
,
LPWSAPROTOCOL_INFOA
buffer
,
LPDWORD
len
)
{
return
WINSOCK_EnumProtocols
(
FALSE
,
protocols
,
(
LPWSAPROTOCOL_INFOW
)
buffer
,
len
);
}
/*****************************************************************************
* WSAEnumProtocolsW [WS2_32.@]
*
* Retrieves information about specified set of active network protocols.
...
...
@@ -275,29 +294,7 @@ INT WINAPI WSAEnumProtocolsA( LPINT protocols, LPWSAPROTOCOL_INFOA buffer, LPDWO
*/
INT
WINAPI
WSAEnumProtocolsW
(
LPINT
protocols
,
LPWSAPROTOCOL_INFOW
buffer
,
LPDWORD
len
)
{
INT
i
=
0
;
DWORD
size
=
0
;
INT
local
[]
=
{
WS_IPPROTO_TCP
,
WS_IPPROTO_UDP
,
NSPROTO_IPX
,
NSPROTO_SPX
,
NSPROTO_SPXII
,
0
};
if
(
!
protocols
)
protocols
=
local
;
while
(
protocols
[
i
])
i
++
;
size
=
i
*
sizeof
(
WSAPROTOCOL_INFOW
);
if
(
*
len
<
size
||
!
buffer
)
{
*
len
=
size
;
WSASetLastError
(
WSAENOBUFS
);
return
SOCKET_ERROR
;
}
for
(
i
=
0
;
protocols
[
i
];
i
++
)
{
if
(
WINSOCK_EnterSingleProtocolW
(
protocols
[
i
],
&
buffer
[
i
]
)
==
SOCKET_ERROR
)
return
i
;
}
return
i
;
return
WINSOCK_EnumProtocols
(
TRUE
,
protocols
,
buffer
,
len
);
}
/*****************************************************************************
...
...
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