Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4bed8266
Commit
4bed8266
authored
Jan 17, 2001
by
James Hatheway
Committed by
Alexandre Julliard
Jan 17, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In WsControl, don't mix Linux and Wine socket calls. Always use Wine calls.
Added hack for missing WINAPI in Unix socket() definition.
parent
c85144b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
socket.c
dlls/winsock/socket.c
+9
-1
socket.c
dlls/wsock32/socket.c
+33
-10
No files found.
dlls/winsock/socket.c
View file @
4bed8266
...
...
@@ -1625,7 +1625,15 @@ INT WINAPI WSOCK32_ioctlsocket(SOCKET s, LONG cmd, ULONG *argp)
WARN
(
"Warning: WS1.1 shouldn't be using async I/O
\n
"
);
SetLastError
(
WSAEINVAL
);
return
SOCKET_ERROR
;
case
SIOCGIFBRDADDR
:
case
SIOCGIFNETMASK
:
case
SIOCGIFADDR
:
/* These don't need any special handling. They are used by
WsControl, and are here to suppress an unecessary warning. */
break
;
default:
/* Netscape tries hard to use bogus ioctl 0x667e */
WARN
(
"
\t
unknown WS_IOCTL cmd (%08lx)
\n
"
,
cmd
);
...
...
dlls/wsock32/socket.c
View file @
4bed8266
...
...
@@ -4,6 +4,21 @@
* Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
*/
/*
FIXME: This hack is fixing a problem in WsControl. When we call socket(),
it is supposed to call into ws2_32's WSOCK32_socket.
The problem is that socket() is predefined in a linux system header that
we are including, which is different from the WINE definition.
(cdecl vs. stdapi) The result is stack corruption.
The correct answer to this problem is to make winsock.h not dependent
on system headers, that way all of our functions are defined consistently.
Until that happens we need this hack.
*/
#define socket linux_socket
/* */
#include "config.h"
#include <sys/types.h>
...
...
@@ -25,6 +40,14 @@
# include <net/if.h>
#endif
/* FIXME: The rest of the socket() cdecl<->stdapi stack corruption problem
discussed above. */
#undef socket
extern
SOCKET
WINAPI
socket
(
INT
af
,
INT
type
,
INT
protocol
);
/* */
DEFAULT_DEBUG_CHANNEL
(
winsock
);
...
...
@@ -158,7 +181,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
IFEntry
*
IntInfo
=
(
IFEntry
*
)
pResponseInfo
;
char
ifName
[
512
];
struct
ifreq
ifInfo
;
int
sock
;
SOCKET
sock
;
if
(
!
WSCNTL_GetInterfaceName
(
pcommand
->
toi_entity
.
tei_instance
,
ifName
))
...
...
@@ -186,7 +209,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
if
(
ioctlsocket
(
sock
,
SIOCGIFHWADDR
,
(
ULONG
*
)
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining MAC Address!
\n
"
);
close
(
sock
);
close
socket
(
sock
);
return
(
-
1
);
}
else
...
...
@@ -199,7 +222,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
if
(
ioctlsocket
(
sock
,
SIOCGENADDR
,
(
ULONG
*
)
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining MAC Address!
\n
"
);
close
(
sock
);
close
socket
(
sock
);
return
(
-
1
);
}
else
...
...
@@ -223,7 +246,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
&
IntInfo
->
if_inoctets
,
&
IntInfo
->
if_outoctets
))
<
0
)
{
ERR
(
"Error obtaining transmit/receive stats for the network interface!
\n
"
);
close
(
sock
);
close
socket
(
sock
);
return
(
-
1
);
}
...
...
@@ -233,7 +256,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
IntInfo
->
if_speed
=
1000000
;
/* Speed of interface (bits per second?) */
/************************************************************************/
close
(
sock
);
close
socket
(
sock
);
*
pcbResponseInfoLen
=
sizeof
(
IFEntry
)
+
IntInfo
->
if_descrlen
;
}
else
if
(
pcommand
->
toi_entity
.
tei_entity
==
CL_NL_ENTITY
)
...
...
@@ -312,7 +335,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
IPAddrEntry
*
baseIPInfo
=
(
IPAddrEntry
*
)
pResponseInfo
;
char
ifName
[
512
];
struct
ifreq
ifInfo
;
int
sock
;
SOCKET
sock
;
if
(
*
pcbResponseInfoLen
<
sizeof
(
IPAddrEntry
))
{
...
...
@@ -342,7 +365,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* IP Address */
strcpy
(
ifInfo
.
ifr_name
,
ifName
);
ifInfo
.
ifr_addr
.
sa_family
=
AF_INET
;
if
(
ioctl
(
sock
,
SIOCGIFADDR
,
&
ifInfo
)
<
0
)
if
(
ioctl
socket
(
sock
,
SIOCGIFADDR
,
(
ULONG
*
)
&
ifInfo
)
<
0
)
{
baseIPInfo
->
iae_addr
=
0x0
;
}
...
...
@@ -354,7 +377,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* Broadcast Address */
strcpy
(
ifInfo
.
ifr_name
,
ifName
);
if
(
ioctl
(
sock
,
SIOCGIFBRDADDR
,
&
ifInfo
)
<
0
)
if
(
ioctl
socket
(
sock
,
SIOCGIFBRDADDR
,
(
ULONG
*
)
&
ifInfo
)
<
0
)
{
baseIPInfo
->
iae_bcastaddr
=
0x0
;
}
...
...
@@ -366,7 +389,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* Subnet Mask */
strcpy
(
ifInfo
.
ifr_name
,
ifName
);
if
(
ioctl
(
sock
,
SIOCGIFNETMASK
,
&
ifInfo
)
<
0
)
if
(
ioctl
socket
(
sock
,
SIOCGIFNETMASK
,
(
ULONG
*
)
&
ifInfo
)
<
0
)
{
baseIPInfo
->
iae_mask
=
0x0
;
}
...
...
@@ -396,7 +419,7 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* Calculate size of out buffer */
*
pcbResponseInfoLen
=
sizeof
(
IPAddrEntry
);
close
(
sock
);
close
socket
(
sock
);
break
;
}
...
...
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