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
6b4399e3
Commit
6b4399e3
authored
Oct 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Make htonl/htons/ntohl/ntohs proper functions.
parent
91e54e5f
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
102 deletions
+37
-102
Makefile.in
dlls/inetmib1/Makefile.in
+1
-1
Makefile.in
dlls/iphlpapi/Makefile.in
+1
-1
Makefile.in
dlls/iphlpapi/tests/Makefile.in
+1
-1
rtl.c
dlls/ntdll/rtl.c
+3
-0
driver_netio.c
dlls/ntoskrnl.exe/tests/driver_netio.c
+10
-5
protocol.c
dlls/ws2_32/protocol.c
+8
-8
ws2_32.spec
dlls/ws2_32/ws2_32.spec
+4
-4
winsock.h
include/winsock.h
+4
-42
winsock2.h
include/winsock2.h
+4
-40
sasl_w.c
libs/ldap/libldap/sasl_w.c
+1
-0
No files found.
dlls/inetmib1/Makefile.in
View file @
6b4399e3
MODULE
=
inetmib1.dll
IMPORTS
=
snmpapi
IMPORTS
=
snmpapi
ws2_32
DELAYIMPORTS
=
iphlpapi
C_SRCS
=
\
...
...
dlls/iphlpapi/Makefile.in
View file @
6b4399e3
MODULE
=
iphlpapi.dll
IMPORTLIB
=
iphlpapi
IMPORTS
=
advapi32 dnsapi nsi uuid
IMPORTS
=
advapi32 dnsapi nsi uuid
ws2_32
C_SRCS
=
\
iphlpapi_main.c
...
...
dlls/iphlpapi/tests/Makefile.in
View file @
6b4399e3
TESTDLL
=
iphlpapi.dll
IMPORTS
=
iphlpapi
IMPORTS
=
iphlpapi
ws2_32
C_SRCS
=
\
iphlpapi.c
dlls/ntdll/rtl.c
View file @
6b4399e3
...
...
@@ -40,6 +40,9 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ntdll
);
WINE_DECLARE_DEBUG_CHANNEL
(
debugstr
);
#define htons(x) RtlUshortByteSwap(x)
#define ntohs(x) RtlUshortByteSwap(x)
/* CRC polynomial 0xedb88320 */
static
const
DWORD
CRC_table
[
256
]
=
{
...
...
dlls/ntoskrnl.exe/tests/driver_netio.c
View file @
6b4399e3
...
...
@@ -40,6 +40,11 @@
#include "utils.h"
#define htonl(x) RtlUlongByteSwap(x)
#define htons(x) RtlUshortByteSwap(x)
#define ntohl(x) RtlUlongByteSwap(x)
#define ntohs(x) RtlUshortByteSwap(x)
static
DRIVER_OBJECT
*
driver_obj
;
static
DEVICE_OBJECT
*
device_obj
;
...
...
@@ -148,7 +153,7 @@ static void test_wsk_get_address_info(void)
ok
(
addr_info
->
ai_addrlen
==
sizeof
(
*
addr
),
"Got unexpected ai_addrlen %I64u.
\n
"
,
(
UINT64
)
addr_info
->
ai_addrlen
);
ok
(
addr
->
sin_family
==
AF_INET
,
"Got unexpected sin_family %u.
\n
"
,
addr
->
sin_family
);
ok
(
ntohs
(
addr
->
sin_port
)
==
12345
,
"Got unexpected sin_port %u.
\n
"
,
ntohs
(
addr
->
sin_port
));
ok
(
ntohl
(
addr
->
sin_addr
.
s_addr
)
==
0x7f000001
,
"Got unexpected sin_addr %#lx.
\n
"
,
ok
(
ntohl
(
addr
->
sin_addr
.
s_addr
)
==
INADDR_LOOPBACK
,
"Got unexpected sin_addr %#lx.
\n
"
,
ntohl
(
addr
->
sin_addr
.
s_addr
));
++
count
;
...
...
@@ -308,12 +313,12 @@ static void test_wsk_listen_socket(void)
ok
(
local_addr
.
sin_family
==
AF_INET
,
"Got unexpected sin_family %u.
\n
"
,
local_addr
.
sin_family
);
ok
(
local_addr
.
sin_port
==
htons
(
SERVER_LISTEN_PORT
),
"Got unexpected sin_port %u.
\n
"
,
ntohs
(
local_addr
.
sin_port
));
ok
(
local_addr
.
sin_addr
.
s_addr
==
htonl
(
0x7f000001
),
"Got unexpected sin_addr %#lx.
\n
"
,
ok
(
local_addr
.
sin_addr
.
s_addr
==
htonl
(
INADDR_LOOPBACK
),
"Got unexpected sin_addr %#lx.
\n
"
,
ntohl
(
local_addr
.
sin_addr
.
s_addr
));
ok
(
remote_addr
.
sin_family
==
AF_INET
,
"Got unexpected sin_family %u.
\n
"
,
remote_addr
.
sin_family
);
ok
(
remote_addr
.
sin_port
,
"Got zero sin_port.
\n
"
);
ok
(
remote_addr
.
sin_addr
.
s_addr
==
htonl
(
0x7f000001
),
"Got unexpected sin_addr %#lx.
\n
"
,
ok
(
remote_addr
.
sin_addr
.
s_addr
==
htonl
(
INADDR_LOOPBACK
),
"Got unexpected sin_addr %#lx.
\n
"
,
ntohl
(
remote_addr
.
sin_addr
.
s_addr
));
accept_socket
=
(
WSK_SOCKET
*
)
wsk_irp
->
IoStatus
.
Information
;
...
...
@@ -415,7 +420,7 @@ static void test_wsk_connect_socket(void)
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
CLIENT_LISTEN_PORT
);
addr
.
sin_addr
.
s_addr
=
htonl
(
0x7f000001
);
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
IoReuseIrp
(
wsk_irp
,
STATUS_UNSUCCESSFUL
);
IoSetCompletionRoutine
(
wsk_irp
,
irp_completion_routine
,
&
irp_complete_event
,
TRUE
,
TRUE
,
TRUE
);
...
...
@@ -443,7 +448,7 @@ static void test_wsk_connect_socket(void)
wsk_irp
->
IoStatus
.
Information
);
addr
.
sin_port
=
htons
(
CLIENT_LISTEN_PORT
);
addr
.
sin_addr
.
s_addr
=
htonl
(
0x7f000001
);
addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
IoReuseIrp
(
wsk_irp
,
STATUS_UNSUCCESSFUL
);
IoSetCompletionRoutine
(
wsk_irp
,
irp_completion_routine
,
&
irp_complete_event
,
TRUE
,
TRUE
,
TRUE
);
...
...
dlls/ws2_32/protocol.c
View file @
6b4399e3
...
...
@@ -1895,18 +1895,18 @@ u_long WINAPI inet_addr( const char *str )
/***********************************************************************
* htonl (ws2_32.8)
*/
u_long
WINAPI
WS_
htonl
(
u_long
hostlong
)
u_long
WINAPI
htonl
(
u_long
hostlong
)
{
return
htonl
(
hostlong
);
return
RtlUlongByteSwap
(
hostlong
);
}
/***********************************************************************
* htons (ws2_32.9)
*/
u_short
WINAPI
WS_
htons
(
u_short
hostshort
)
u_short
WINAPI
htons
(
u_short
hostshort
)
{
return
htons
(
hostshort
);
return
RtlUshortByteSwap
(
hostshort
);
}
...
...
@@ -1943,18 +1943,18 @@ int WINAPI WSAHtons( SOCKET s, u_short hostshort, u_short *netshort )
/***********************************************************************
* ntohl (ws2_32.14)
*/
u_long
WINAPI
WS_
ntohl
(
u_long
netlong
)
u_long
WINAPI
ntohl
(
u_long
netlong
)
{
return
ntohl
(
netlong
);
return
RtlUlongByteSwap
(
netlong
);
}
/***********************************************************************
* ntohs (ws2_32.15)
*/
u_short
WINAPI
WS_
ntohs
(
u_short
netshort
)
u_short
WINAPI
ntohs
(
u_short
netshort
)
{
return
ntohs
(
netshort
);
return
RtlUshortByteSwap
(
netshort
);
}
...
...
dlls/ws2_32/ws2_32.spec
View file @
6b4399e3
...
...
@@ -5,14 +5,14 @@
5 stdcall getpeername(long ptr ptr)
6 stdcall getsockname(long ptr ptr)
7 stdcall getsockopt(long long long ptr ptr)
8 stdcall htonl(long)
WS_htonl
9 stdcall htons(long)
WS_htons
8 stdcall htonl(long)
9 stdcall htons(long)
10 stdcall ioctlsocket(long long ptr)
11 stdcall inet_addr(str)
12 stdcall inet_ntoa(ptr)
13 stdcall listen(long long)
14 stdcall ntohl(long)
WS_ntohl
15 stdcall ntohs(long)
WS_ntohs
14 stdcall ntohl(long)
15 stdcall ntohs(long)
16 stdcall recv(long ptr long long)
17 stdcall recvfrom(long ptr long long ptr ptr)
18 stdcall select(long ptr ptr ptr ptr)
...
...
include/winsock.h
View file @
6b4399e3
...
...
@@ -480,48 +480,6 @@ WINSOCK_API_LINKAGE int WINAPI __WSAFDIsSet(SOCKET,WS(fd_set)*);
#endif
/* WS_DEFINE_SELECT */
/* we have to define hton/ntoh as macros to avoid conflicts with Unix headers */
#ifndef USE_WS_PREFIX
#undef htonl
#undef htons
#undef ntohl
#undef ntohs
#ifdef WORDS_BIGENDIAN
static
inline
u_short
__wine_ushort_noop
(
u_short
s
)
{
return
s
;
}
static
inline
ULONG
__wine_ulong_noop
(
ULONG
l
)
{
return
l
;
}
#define htonl __wine_ulong_noop
#define htons __wine_ushort_noop
#define ntohl __wine_ulong_noop
#define ntohs __wine_ushort_noop
#else
/* WORDS_BIGENDIAN */
static
inline
u_short
__wine_ushort_swap
(
u_short
s
)
{
return
(
s
>>
8
)
|
(
s
<<
8
);
}
static
inline
ULONG
__wine_ulong_swap
(
ULONG
l
)
{
return
((
ULONG
)
__wine_ushort_swap
((
u_short
)
l
)
<<
16
)
|
__wine_ushort_swap
((
u_short
)(
l
>>
16
));
}
#define htonl __wine_ulong_swap
#define htons __wine_ushort_swap
#define ntohl __wine_ulong_swap
#define ntohs __wine_ushort_swap
#endif
/* WORDS_BIGENDIAN */
#endif
/* USE_WS_PREFIX */
/*
* Internet address (old style... should be updated)
*/
...
...
@@ -966,10 +924,14 @@ WINSOCK_API_LINKAGE struct WS(servent)* WINAPI WS(getservbyname)(const char*,con
WINSOCK_API_LINKAGE
struct
WS
(
servent
)
*
WINAPI
WS
(
getservbyport
)(
int
,
const
char
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
getsockname
)(
SOCKET
,
struct
WS
(
sockaddr
)
*
,
int
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
getsockopt
)(
SOCKET
,
int
,
int
,
char
*
,
int
*
);
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
htonl
)(
ULONG
);
WINSOCK_API_LINKAGE
WS
(
u_short
)
WINAPI
WS
(
htons
)(
WS
(
u_short
));
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
inet_addr
)(
const
char
*
);
WINSOCK_API_LINKAGE
char
*
WINAPI
WS
(
inet_ntoa
)(
struct
WS
(
in_addr
));
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
ioctlsocket
)(
SOCKET
,
LONG
,
ULONG
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
listen
)(
SOCKET
,
int
);
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
ntohl
)(
ULONG
);
WINSOCK_API_LINKAGE
WS
(
u_short
)
WINAPI
WS
(
ntohs
)(
WS
(
u_short
));
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
recv
)(
SOCKET
,
char
*
,
int
,
int
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
recvfrom
)(
SOCKET
,
char
*
,
int
,
int
,
struct
WS
(
sockaddr
)
*
,
int
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
send
)(
SOCKET
,
const
char
*
,
int
,
int
);
...
...
include/winsock2.h
View file @
6b4399e3
...
...
@@ -1001,46 +1001,6 @@ typedef struct WSAData
#endif
}
WSADATA
,
*
LPWSADATA
;
#ifndef USE_WS_PREFIX
#undef htonl
#undef htons
#undef ntohl
#undef ntohs
#ifdef WORDS_BIGENDIAN
static
inline
u_short
__wine_ushort_noop
(
u_short
s
)
{
return
s
;
}
static
inline
ULONG
__wine_ulong_noop
(
ULONG
l
)
{
return
l
;
}
#define htonl __wine_ulong_noop
#define htons __wine_ushort_noop
#define ntohl __wine_ulong_noop
#define ntohs __wine_ushort_noop
#else
/* WORDS_BIGENDIAN */
static
inline
u_short
__wine_ushort_swap
(
u_short
s
)
{
return
(
s
>>
8
)
|
(
s
<<
8
);
}
static
inline
ULONG
__wine_ulong_swap
(
ULONG
l
)
{
return
((
ULONG
)
__wine_ushort_swap
((
u_short
)
l
)
<<
16
)
|
__wine_ushort_swap
((
u_short
)(
l
>>
16
));
}
#define htonl __wine_ulong_swap
#define htons __wine_ushort_swap
#define ntohl __wine_ulong_swap
#define ntohs __wine_ushort_swap
#endif
/* WORDS_BIGENDIAN */
#endif
/* USE_WS_PREFIX */
#define WSAMAKEASYNCREPLY(size, error) MAKELONG(size, error)
#define WSAMAKESELECTREPLY(flags, error) MAKELONG(flags, error)
#define WSAGETASYNCBUFLEN(x) LOWORD(x)
...
...
@@ -1134,10 +1094,14 @@ WINSOCK_API_LINKAGE struct WS(servent) * WINAPI WS(getservbyname)(const char *,
WINSOCK_API_LINKAGE
struct
WS
(
servent
)
*
WINAPI
WS
(
getservbyport
)(
int
,
const
char
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
getsockname
)(
SOCKET
,
struct
WS
(
sockaddr
)
*
,
int
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
getsockopt
)(
SOCKET
,
int
,
int
,
char
*
,
int
*
);
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
htonl
)(
ULONG
);
WINSOCK_API_LINKAGE
WS
(
u_short
)
WINAPI
WS
(
htons
)(
WS
(
u_short
));
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
inet_addr
)(
const
char
*
);
WINSOCK_API_LINKAGE
char
*
WINAPI
WS
(
inet_ntoa
)(
struct
WS
(
in_addr
));
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
ioctlsocket
)(
SOCKET
,
LONG
,
WS
(
u_long
)
*
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
listen
)(
SOCKET
,
int
);
WINSOCK_API_LINKAGE
ULONG
WINAPI
WS
(
ntohl
)(
ULONG
);
WINSOCK_API_LINKAGE
WS
(
u_short
)
WINAPI
WS
(
ntohs
)(
WS
(
u_short
));
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
recv
)(
SOCKET
,
char
*
,
int
,
int
);
WINSOCK_API_LINKAGE
int
WINAPI
WS
(
recvfrom
)(
SOCKET
,
char
*
,
int
,
int
,
struct
WS
(
sockaddr
)
*
,
int
*
);
#ifdef WS_DEFINE_SELECT
...
...
libs/ldap/libldap/sasl_w.c
View file @
6b4399e3
...
...
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <windef.h>
#include <winerror.h>
#include <winsock.h>
#include <sspi.h>
#include <rpc.h>
#include <sasl.h>
...
...
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