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
d044171b
Commit
d044171b
authored
Jul 09, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Jul 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Implement GetIfEntry() on top of nsi.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e93053c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
65 deletions
+16
-65
ifenum.c
dlls/iphlpapi/ifenum.c
+0
-41
ifenum.h
dlls/iphlpapi/ifenum.h
+0
-7
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+16
-17
No files found.
dlls/iphlpapi/ifenum.c
View file @
d044171b
...
...
@@ -745,47 +745,6 @@ DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status
return
ret
;
}
DWORD
getInterfaceEntryByName
(
const
char
*
name
,
PMIB_IFROW
entry
)
{
BYTE
addr
[
MAX_INTERFACE_PHYSADDR
];
DWORD
ret
,
len
=
sizeof
(
addr
),
type
;
if
(
!
name
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
entry
)
return
ERROR_INVALID_PARAMETER
;
if
(
getInterfacePhysicalByName
(
name
,
&
len
,
addr
,
&
type
)
==
NO_ERROR
)
{
WCHAR
*
assigner
;
const
char
*
walker
;
memset
(
entry
,
0
,
sizeof
(
MIB_IFROW
));
for
(
assigner
=
entry
->
wszName
,
walker
=
name
;
*
walker
;
walker
++
,
assigner
++
)
*
assigner
=
*
walker
;
*
assigner
=
0
;
getInterfaceIndexByName
(
name
,
&
entry
->
dwIndex
);
entry
->
dwPhysAddrLen
=
len
;
memcpy
(
entry
->
bPhysAddr
,
addr
,
len
);
memset
(
entry
->
bPhysAddr
+
len
,
0
,
sizeof
(
entry
->
bPhysAddr
)
-
len
);
entry
->
dwType
=
type
;
/* FIXME: how to calculate real speed? */
getInterfaceMtuByName
(
name
,
&
entry
->
dwMtu
);
/* lie, there's no "administratively down" here */
entry
->
dwAdminStatus
=
MIB_IF_ADMIN_STATUS_UP
;
getInterfaceStatusByName
(
name
,
&
entry
->
dwOperStatus
);
/* punt on dwLastChange? */
entry
->
dwDescrLen
=
min
(
strlen
(
name
),
MAX_INTERFACE_DESCRIPTION
-
1
);
memcpy
(
entry
->
bDescr
,
name
,
entry
->
dwDescrLen
);
entry
->
bDescr
[
entry
->
dwDescrLen
]
=
'\0'
;
entry
->
dwDescrLen
++
;
ret
=
NO_ERROR
;
}
else
ret
=
ERROR_INVALID_DATA
;
return
ret
;
}
static
DWORD
getIPAddrRowByName
(
PMIB_IPADDRROW
ipAddrRow
,
const
char
*
ifName
,
const
struct
sockaddr
*
sa
)
{
...
...
dlls/iphlpapi/ifenum.h
View file @
d044171b
...
...
@@ -87,13 +87,6 @@ DWORD getInterfaceIndexByName(const char *name, IF_INDEX *index) DECLSPEC_HIDDEN
DWORD
getInterfacePhysicalByIndex
(
IF_INDEX
index
,
PDWORD
len
,
PBYTE
addr
,
PDWORD
type
)
DECLSPEC_HIDDEN
;
/* Fills in the MIB_IFROW by name. Doesn't fill in interface statistics,
* see ipstats.h for that.
* Returns ERROR_INVALID_PARAMETER if name is NULL, ERROR_INVALID_DATA
* if name isn't valid, and NO_ERROR otherwise.
*/
DWORD
getInterfaceEntryByName
(
const
char
*
name
,
PMIB_IFROW
entry
)
DECLSPEC_HIDDEN
;
DWORD
getNumIPAddresses
(
void
)
DECLSPEC_HIDDEN
;
/* Gets the configured IP addresses for the system, and sets *ppIpAddrTable to
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
d044171b
...
...
@@ -1821,26 +1821,25 @@ static void if_row_fill( MIB_IFROW *row, struct nsi_ndis_ifinfo_rw *rw, struct n
* Success: NO_ERROR
* Failure: error code from winerror.h
*/
DWORD
WINAPI
GetIfEntry
(
PMIB_IFROW
pIfRow
)
DWORD
WINAPI
GetIfEntry
(
MIB_IFROW
*
row
)
{
DWORD
ret
;
char
nameBuf
[
MAX_ADAPTER_NAME
];
char
*
name
;
struct
nsi_ndis_ifinfo_rw
rw
;
struct
nsi_ndis_ifinfo_dynamic
dyn
;
struct
nsi_ndis_ifinfo_static
stat
;
NET_LUID
luid
;
DWORD
err
;
TRACE
(
"pIfRow %p
\n
"
,
pIfRow
);
if
(
!
pIfRow
)
return
ERROR_INVALID_PARAMETER
;
TRACE
(
"row %p
\n
"
,
row
);
if
(
!
row
)
return
ERROR_INVALID_PARAMETER
;
name
=
getInterfaceNameByIndex
(
pIfRow
->
dwIndex
,
nameBuf
);
if
(
name
)
{
ret
=
getInterfaceEntryByName
(
name
,
pIfRow
);
if
(
ret
==
NO_ERROR
)
ret
=
getInterfaceStatsByName
(
name
,
pIfRow
);
}
else
ret
=
ERROR_INVALID_DATA
;
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
err
=
ConvertInterfaceIndexToLuid
(
row
->
dwIndex
,
&
luid
);
if
(
err
)
return
err
;
err
=
NsiGetAllParameters
(
1
,
&
NPI_MS_NDIS_MODULEID
,
NSI_NDIS_IFINFO_TABLE
,
&
luid
,
sizeof
(
luid
),
&
rw
,
sizeof
(
rw
),
&
dyn
,
sizeof
(
dyn
),
&
stat
,
sizeof
(
stat
)
);
if
(
!
err
)
if_row_fill
(
row
,
&
rw
,
&
dyn
,
&
stat
);
return
err
;
}
static
int
ifrow_cmp
(
const
void
*
a
,
const
void
*
b
)
...
...
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