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
a9e96734
Commit
a9e96734
authored
Jan 17, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Jan 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Implement GetBestInterfaceEx.
parent
a4b18699
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
5 deletions
+46
-5
iphlpapi.spec
dlls/iphlpapi/iphlpapi.spec
+1
-0
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+35
-5
iphlpapi.h
include/iphlpapi.h
+10
-0
No files found.
dlls/iphlpapi/iphlpapi.spec
View file @
a9e96734
...
...
@@ -20,6 +20,7 @@
@ stub GetAdapterOrderMap
@ stdcall GetAdaptersInfo( ptr ptr )
@ stdcall GetBestInterface( long ptr )
@ stdcall GetBestInterfaceEx( ptr ptr )
@ stub GetBestInterfaceFromStack
@ stdcall GetBestRoute( long long long )
@ stub GetBestRouteFromStack
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
a9e96734
...
...
@@ -39,9 +39,12 @@
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#define USE_WS_PREFIX
#include "winsock2.h"
#include "iphlpapi.h"
#include "ifenum.h"
#include "ipstats.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
iphlpapi
);
...
...
@@ -812,17 +815,44 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
*/
DWORD
WINAPI
GetBestInterface
(
IPAddr
dwDestAddr
,
PDWORD
pdwBestIfIndex
)
{
struct
WS_sockaddr_in
sa_in
;
memset
(
&
sa_in
,
0
,
sizeof
(
sa_in
));
sa_in
.
sin_family
=
AF_INET
;
sa_in
.
sin_addr
.
S_un
.
S_addr
=
dwDestAddr
;
return
GetBestInterfaceEx
((
struct
WS_sockaddr
*
)
&
sa_in
,
pdwBestIfIndex
);
}
/******************************************************************
* GetBestInterfaceEx (IPHLPAPI.@)
*
* Get the interface, with the best route for the given IP address.
*
* PARAMS
* dwDestAddr [In] IP address to search the interface for
* pdwBestIfIndex [Out] found best interface
*
* RETURNS
* Success: NO_ERROR
* Failure: error code from winerror.h
*/
DWORD
WINAPI
GetBestInterfaceEx
(
struct
WS_sockaddr
*
pDestAddr
,
PDWORD
pdwBestIfIndex
)
{
DWORD
ret
;
TRACE
(
"
dwDestAddr 0x%08lx, pdwBestIfIndex %p
\n
"
,
dw
DestAddr
,
pdwBestIfIndex
);
if
(
!
pdwBestIfIndex
)
TRACE
(
"
pDestAddr %p, pdwBestIfIndex %p
\n
"
,
p
DestAddr
,
pdwBestIfIndex
);
if
(
!
p
DestAddr
||
!
p
dwBestIfIndex
)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
MIB_IPFORWARDROW
ipRow
;
ret
=
GetBestRoute
(
dwDestAddr
,
0
,
&
ipRow
);
if
(
ret
==
ERROR_SUCCESS
)
*
pdwBestIfIndex
=
ipRow
.
dwForwardIfIndex
;
if
(
pDestAddr
->
sa_family
==
AF_INET
)
{
ret
=
GetBestRoute
(((
struct
WS_sockaddr_in
*
)
pDestAddr
)
->
sin_addr
.
S_un
.
S_addr
,
0
,
&
ipRow
);
if
(
ret
==
ERROR_SUCCESS
)
*
pdwBestIfIndex
=
ipRow
.
dwForwardIfIndex
;
}
else
{
FIXME
(
"address family %d not supported
\n
"
,
pDestAddr
->
sa_family
);
ret
=
ERROR_NOT_SUPPORTED
;
}
}
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
...
...
include/iphlpapi.h
View file @
a9e96734
...
...
@@ -94,6 +94,16 @@ DWORD WINAPI GetUniDirectionalAdapterInfo(
DWORD
WINAPI
GetBestInterface
(
IPAddr
dwDestAddr
,
PDWORD
pdwBestIfIndex
);
#ifdef __WINE_WINSOCKAPI_STDLIB_H
DWORD
WINAPI
GetBestInterfaceEx
(
#ifdef USE_WS_PREFIX
struct
WS_sockaddr
*
pDestAddr
,
#else
struct
sockaddr
*
pDestAddr
,
#endif
PDWORD
pdwBestIfIndex
);
#endif
DWORD
WINAPI
GetBestRoute
(
DWORD
dwDestAddr
,
DWORD
dwSourceAddr
,
PMIB_IPFORWARDROW
pBestRoute
);
...
...
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