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
cabb350f
Commit
cabb350f
authored
May 26, 2008
by
Kai Blin
Committed by
Alexandre Julliard
May 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Add support for FROM_PROTOCOL_INFO to WSASocket().
parent
3978df4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
18 deletions
+55
-18
socket.c
dlls/ws2_32/socket.c
+11
-18
sock.c
dlls/ws2_32/tests/sock.c
+42
-0
winsock2.h
include/winsock2.h
+2
-0
No files found.
dlls/ws2_32/socket.c
View file @
cabb350f
...
@@ -297,6 +297,7 @@ static const int ws_af_map[][2] =
...
@@ -297,6 +297,7 @@ static const int ws_af_map[][2] =
#ifdef HAVE_IPX
#ifdef HAVE_IPX
MAP_OPTION
(
AF_IPX
),
MAP_OPTION
(
AF_IPX
),
#endif
#endif
{
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
},
};
};
static
const
int
ws_socktype_map
[][
2
]
=
static
const
int
ws_socktype_map
[][
2
]
=
...
@@ -304,6 +305,7 @@ static const int ws_socktype_map[][2] =
...
@@ -304,6 +305,7 @@ static const int ws_socktype_map[][2] =
MAP_OPTION
(
SOCK_DGRAM
),
MAP_OPTION
(
SOCK_DGRAM
),
MAP_OPTION
(
SOCK_STREAM
),
MAP_OPTION
(
SOCK_STREAM
),
MAP_OPTION
(
SOCK_RAW
),
MAP_OPTION
(
SOCK_RAW
),
{
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
},
};
};
static
const
int
ws_proto_map
[][
2
]
=
static
const
int
ws_proto_map
[][
2
]
=
...
@@ -314,6 +316,7 @@ static const int ws_proto_map[][2] =
...
@@ -314,6 +316,7 @@ static const int ws_proto_map[][2] =
MAP_OPTION
(
IPPROTO_ICMP
),
MAP_OPTION
(
IPPROTO_ICMP
),
MAP_OPTION
(
IPPROTO_IGMP
),
MAP_OPTION
(
IPPROTO_IGMP
),
MAP_OPTION
(
IPPROTO_RAW
),
MAP_OPTION
(
IPPROTO_RAW
),
{
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
},
};
};
static
const
int
ws_aiflag_map
[][
2
]
=
static
const
int
ws_aiflag_map
[][
2
]
=
...
@@ -3781,28 +3784,18 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
...
@@ -3781,28 +3784,18 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
return
ret
;
return
ret
;
}
}
/* c
heck and convert the socket family
*/
/* c
onvert the socket family and type
*/
af
=
convert_af_w2u
(
af
);
af
=
convert_af_w2u
(
af
);
if
(
af
==
-
1
)
{
FIXME
(
"Unsupported socket family %d!
\n
"
,
af
);
SetLastError
(
WSAEAFNOSUPPORT
);
return
INVALID_SOCKET
;
}
/* check the socket type */
type
=
convert_socktype_w2u
(
type
);
type
=
convert_socktype_w2u
(
type
);
if
(
type
==
-
1
)
{
SetLastError
(
WSAESOCKTNOSUPPORT
);
return
INVALID_SOCKET
;
}
/* check the protocol type */
if
(
lpProtocolInfo
)
if
(
protocol
<
0
)
/* don't support negative values */
{
{
SetLastError
(
WSAEPROTONOSUPPORT
);
if
(
af
==
FROM_PROTOCOL_INFO
)
return
INVALID_SOCKET
;
af
=
lpProtocolInfo
->
iAddressFamily
;
if
(
type
==
FROM_PROTOCOL_INFO
)
type
=
lpProtocolInfo
->
iSocketType
;
if
(
protocol
==
FROM_PROTOCOL_INFO
)
protocol
=
lpProtocolInfo
->
iProtocol
;
}
}
if
(
af
==
AF_UNSPEC
)
/* did they not specify the address family? */
if
(
af
==
AF_UNSPEC
)
/* did they not specify the address family? */
...
...
dlls/ws2_32/tests/sock.c
View file @
cabb350f
...
@@ -1115,6 +1115,47 @@ static void test_getservbyname(void)
...
@@ -1115,6 +1115,47 @@ static void test_getservbyname(void)
}
}
}
}
static
void
test_WSASocket
(
void
)
{
SOCKET
sock
=
INVALID_SOCKET
;
WSAPROTOCOL_INFOA
*
pi
;
int
providers
[]
=
{
6
,
0
};
int
ret
,
err
;
UINT
pi_size
;
ret
=
WSAEnumProtocolsA
(
providers
,
NULL
,
&
pi_size
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAEnumProtocolsA({6,0}, NULL, 0) returned %d
\n
"
,
ret
);
err
=
WSAGetLastError
();
ok
(
err
==
WSAENOBUFS
,
"WSAEnumProtocolsA error is %d, not WSAENOBUFS(%d)
\n
"
,
err
,
WSAENOBUFS
);
pi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pi_size
);
ok
(
pi
!=
NULL
,
"Failed to allocate memory
\n
"
);
if
(
pi
==
NULL
)
{
skip
(
"Can't continue without memory.
\n
"
);
return
;
}
ret
=
WSAEnumProtocolsA
(
providers
,
pi
,
&
pi_size
);
ok
(
ret
!=
SOCKET_ERROR
,
"WSAEnumProtocolsA failed, last error is %d
\n
"
,
WSAGetLastError
());
if
(
ret
==
0
)
{
skip
(
"No protocols enumerated.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pi
);
return
;
}
sock
=
WSASocketA
(
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
FROM_PROTOCOL_INFO
,
&
pi
[
0
],
0
,
0
);
ok
(
sock
!=
INVALID_SOCKET
,
"Failed to create socket: %d
\n
"
,
WSAGetLastError
());
closesocket
(
sock
);
HeapFree
(
GetProcessHeap
(),
0
,
pi
);
}
static
void
test_WSAAddressToStringA
(
void
)
static
void
test_WSAAddressToStringA
(
void
)
{
{
INT
ret
;
INT
ret
;
...
@@ -2054,6 +2095,7 @@ START_TEST( sock )
...
@@ -2054,6 +2095,7 @@ START_TEST( sock )
test_UDP
();
test_UDP
();
test_getservbyname
();
test_getservbyname
();
test_WSASocket
();
test_WSAAddressToStringA
();
test_WSAAddressToStringA
();
test_WSAAddressToStringW
();
test_WSAAddressToStringW
();
...
...
include/winsock2.h
View file @
cabb350f
...
@@ -75,6 +75,8 @@ extern "C" {
...
@@ -75,6 +75,8 @@ extern "C" {
/* protocol types */
/* protocol types */
#define FROM_PROTOCOL_INFO (-1)
#ifndef USE_WS_PREFIX
#ifndef USE_WS_PREFIX
#define SOCK_STREAM 1
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define SOCK_DGRAM 2
...
...
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