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
fabd9e1f
Commit
fabd9e1f
authored
Aug 03, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Aug 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Add more tests for GetAdaptersInfo().
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1f2adbb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
43 deletions
+40
-43
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+40
-43
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
fabd9e1f
...
@@ -1118,53 +1118,50 @@ todo_wine_if( row.dwType == IF_TYPE_SOFTWARE_LOOPBACK)
...
@@ -1118,53 +1118,50 @@ todo_wine_if( row.dwType == IF_TYPE_SOFTWARE_LOOPBACK)
static
void
testGetAdaptersInfo
(
void
)
static
void
testGetAdaptersInfo
(
void
)
{
{
DWORD
apiReturn
;
IP_ADAPTER_INFO
*
ptr
,
*
buf
;
NET_LUID
luid
;
GUID
guid
;
char
name
[
ARRAY_SIZE
(
ptr
->
AdapterName
)];
DWORD
err
;
ULONG
len
=
0
;
ULONG
len
=
0
;
MIB_IFROW
row
;
apiReturn
=
GetAdaptersInfo
(
NULL
,
NULL
);
err
=
GetAdaptersInfo
(
NULL
,
NULL
);
if
(
apiReturn
==
ERROR_NOT_SUPPORTED
)
{
ok
(
err
==
ERROR_INVALID_PARAMETER
,
"got %d
\n
"
,
err
);
skip
(
"GetAdaptersInfo is not supported
\n
"
);
err
=
GetAdaptersInfo
(
NULL
,
&
len
);
return
;
ok
(
err
==
ERROR_NO_DATA
||
err
==
ERROR_BUFFER_OVERFLOW
,
"got %d
\n
"
,
err
);
}
if
(
err
==
ERROR_NO_DATA
)
return
;
ok
(
apiReturn
==
ERROR_INVALID_PARAMETER
,
"GetAdaptersInfo returned %d, expected ERROR_INVALID_PARAMETER
\n
"
,
apiReturn
);
apiReturn
=
GetAdaptersInfo
(
NULL
,
&
len
);
ok
(
apiReturn
==
ERROR_NO_DATA
||
apiReturn
==
ERROR_BUFFER_OVERFLOW
,
"GetAdaptersInfo returned %d, expected ERROR_NO_DATA or ERROR_BUFFER_OVERFLOW
\n
"
,
apiReturn
);
if
(
apiReturn
==
ERROR_NO_DATA
)
;
/* no adapter's, that's okay */
else
if
(
apiReturn
==
ERROR_BUFFER_OVERFLOW
)
{
PIP_ADAPTER_INFO
ptr
,
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
NET_LUID
luid
;
GUID
guid
;
char
AdapterName
[
ARRAY_SIZE
(
ptr
->
AdapterName
)];
apiReturn
=
GetAdaptersInfo
(
buf
,
&
len
);
buf
=
malloc
(
len
);
ok
(
apiReturn
==
NO_ERROR
,
err
=
GetAdaptersInfo
(
buf
,
&
len
);
"GetAdaptersInfo(buf, &dwSize) returned %d, expected NO_ERROR
\n
"
,
ok
(
!
err
,
"got %d
\n
"
,
err
);
apiReturn
);
ptr
=
buf
;
ptr
=
buf
;
while
(
ptr
)
while
(
ptr
)
{
{
ConvertInterfaceIndexToLuid
(
ptr
->
Index
,
&
luid
);
trace
(
"adapter '%s', address %s/%s gateway %s/%s
\n
"
,
ptr
->
AdapterName
,
ConvertInterfaceLuidToGuid
(
&
luid
,
&
guid
);
ptr
->
IpAddressList
.
IpAddress
.
String
,
ptr
->
IpAddressList
.
IpMask
.
String
,
sprintf
(
AdapterName
,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"
,
ptr
->
GatewayList
.
IpAddress
.
String
,
ptr
->
GatewayList
.
IpMask
.
String
);
guid
.
Data1
,
guid
.
Data2
,
guid
.
Data3
,
guid
.
Data4
[
0
],
guid
.
Data4
[
1
],
row
.
dwIndex
=
ptr
->
Index
;
guid
.
Data4
[
2
],
guid
.
Data4
[
3
],
guid
.
Data4
[
4
],
guid
.
Data4
[
5
],
GetIfEntry
(
&
row
);
guid
.
Data4
[
6
],
guid
.
Data4
[
7
]);
ConvertInterfaceIndexToLuid
(
ptr
->
Index
,
&
luid
);
ok
(
!
strcmp
(
ptr
->
AdapterName
,
AdapterName
),
"expected '%s' got '%s'
\n
"
,
ptr
->
AdapterName
,
AdapterName
);
ConvertInterfaceLuidToGuid
(
&
luid
,
&
guid
);
ok
(
ptr
->
IpAddressList
.
IpAddress
.
String
[
0
],
"A valid IP address must be present
\n
"
);
sprintf
(
name
,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"
,
ok
(
ptr
->
IpAddressList
.
IpMask
.
String
[
0
],
"A valid mask must be present
\n
"
);
guid
.
Data1
,
guid
.
Data2
,
guid
.
Data3
,
guid
.
Data4
[
0
],
guid
.
Data4
[
1
],
ok
(
ptr
->
GatewayList
.
IpAddress
.
String
[
0
],
"A valid IP address must be present
\n
"
);
guid
.
Data4
[
2
],
guid
.
Data4
[
3
],
guid
.
Data4
[
4
],
guid
.
Data4
[
5
],
ok
(
ptr
->
GatewayList
.
IpMask
.
String
[
0
],
"A valid mask must be present
\n
"
);
guid
.
Data4
[
6
],
guid
.
Data4
[
7
]
);
trace
(
"adapter '%s', address %s/%s gateway %s/%s
\n
"
,
ptr
->
AdapterName
,
ok
(
!
strcmp
(
ptr
->
AdapterName
,
name
),
"expected '%s' got '%s'
\n
"
,
ptr
->
AdapterName
,
name
);
ptr
->
IpAddressList
.
IpAddress
.
String
,
ptr
->
IpAddressList
.
IpMask
.
String
,
ok
(
!
strcmp
(
ptr
->
Description
,
(
char
*
)
row
.
bDescr
),
"got %s vs %s
\n
"
,
ptr
->
Description
,
(
char
*
)
row
.
bDescr
);
ptr
->
GatewayList
.
IpAddress
.
String
,
ptr
->
GatewayList
.
IpMask
.
String
);
ok
(
ptr
->
AddressLength
==
row
.
dwPhysAddrLen
,
"got %d vs %d
\n
"
,
ptr
->
AddressLength
,
row
.
dwPhysAddrLen
);
ptr
=
ptr
->
Next
;
ok
(
!
memcmp
(
ptr
->
Address
,
row
.
bPhysAddr
,
ptr
->
AddressLength
),
"mismatch
\n
"
);
}
ok
(
ptr
->
Type
==
row
.
dwType
,
"got %d vs %d
\n
"
,
ptr
->
Type
,
row
.
dwType
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
ok
(
ptr
->
Type
!=
MIB_IF_TYPE_LOOPBACK
,
"shouldn't get loopback
\n
"
);
ok
(
ptr
->
IpAddressList
.
IpAddress
.
String
[
0
],
"A valid IP address must be present
\n
"
);
ok
(
ptr
->
IpAddressList
.
IpMask
.
String
[
0
],
"A valid mask must be present
\n
"
);
ok
(
ptr
->
GatewayList
.
IpAddress
.
String
[
0
],
"A valid IP address must be present
\n
"
);
ok
(
ptr
->
GatewayList
.
IpMask
.
String
[
0
],
"A valid mask must be present
\n
"
);
ptr
=
ptr
->
Next
;
}
}
free
(
buf
);
}
}
static
void
testGetNetworkParams
(
void
)
static
void
testGetNetworkParams
(
void
)
...
...
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