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
5b428fe5
Commit
5b428fe5
authored
Apr 29, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Add tests for GetAdaptersAddresses.
parent
f0491f61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+69
-0
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
5b428fe5
...
...
@@ -63,6 +63,7 @@ typedef DWORD (WINAPI *GetUdpStatisticsFunc)(PMIB_UDPSTATS);
typedef
DWORD
(
WINAPI
*
GetTcpTableFunc
)(
PMIB_TCPTABLE
,
PDWORD
,
BOOL
);
typedef
DWORD
(
WINAPI
*
GetUdpTableFunc
)(
PMIB_UDPTABLE
,
PDWORD
,
BOOL
);
typedef
DWORD
(
WINAPI
*
GetPerAdapterInfoFunc
)(
ULONG
,
PIP_PER_ADAPTER_INFO
,
PULONG
);
typedef
DWORD
(
WINAPI
*
GetAdaptersAddressesFunc
)(
ULONG
,
ULONG
,
PVOID
,
PIP_ADAPTER_ADDRESSES
,
PULONG
);
static
GetNumberOfInterfacesFunc
gGetNumberOfInterfaces
=
NULL
;
static
GetIpAddrTableFunc
gGetIpAddrTable
=
NULL
;
...
...
@@ -81,6 +82,7 @@ static GetUdpStatisticsFunc gGetUdpStatistics = NULL;
static
GetTcpTableFunc
gGetTcpTable
=
NULL
;
static
GetUdpTableFunc
gGetUdpTable
=
NULL
;
static
GetPerAdapterInfoFunc
gGetPerAdapterInfo
=
NULL
;
static
GetAdaptersAddressesFunc
gGetAdaptersAddresses
=
NULL
;
static
void
loadIPHlpApi
(
void
)
{
...
...
@@ -119,6 +121,7 @@ static void loadIPHlpApi(void)
gGetUdpTable
=
(
GetUdpTableFunc
)
GetProcAddress
(
hLibrary
,
"GetUdpTable"
);
gGetPerAdapterInfo
=
(
GetPerAdapterInfoFunc
)
GetProcAddress
(
hLibrary
,
"GetPerAdapterInfo"
);
gGetAdaptersAddresses
=
(
GetAdaptersAddressesFunc
)
GetProcAddress
(
hLibrary
,
"GetAdaptersAddresses"
);
}
}
...
...
@@ -811,6 +814,71 @@ static void testWin2KFunctions(void)
testGetPerAdapterInfo
();
}
static
void
test_GetAdaptersAddresses
(
void
)
{
ULONG
ret
,
size
;
IP_ADAPTER_ADDRESSES
*
aa
;
IP_ADAPTER_UNICAST_ADDRESS
*
ua
;
if
(
!
gGetAdaptersAddresses
)
{
win_skip
(
"GetAdaptersAddresses not present
\n
"
);
return
;
}
ret
=
gGetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
ret
);
ret
=
gGetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
NULL
,
&
size
);
ok
(
ret
==
ERROR_BUFFER_OVERFLOW
,
"expected ERROR_BUFFER_OVERFLOW, got %u
\n
"
,
ret
);
if
(
ret
!=
ERROR_BUFFER_OVERFLOW
)
return
;
aa
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ret
=
gGetAdaptersAddresses
(
AF_UNSPEC
,
0
,
NULL
,
aa
,
&
size
);
ok
(
!
ret
,
"expected ERROR_SUCCESS got %u
\n
"
,
ret
);
while
(
!
ret
&&
winetest_debug
>
1
&&
aa
)
{
trace
(
"Length: %u
\n
"
,
aa
->
Length
);
trace
(
"IfIndex: %u
\n
"
,
aa
->
IfIndex
);
trace
(
"Next: %p
\n
"
,
aa
->
Next
);
trace
(
"AdapterName: %s
\n
"
,
aa
->
AdapterName
);
trace
(
"FirstUnicastAddress: %p
\n
"
,
aa
->
FirstUnicastAddress
);
ua
=
aa
->
FirstUnicastAddress
;
while
(
ua
)
{
trace
(
"
\t
Length: %u
\n
"
,
ua
->
Length
);
trace
(
"
\t
Flags: 0x%08x
\n
"
,
ua
->
Flags
);
trace
(
"
\t
Next: %p
\n
"
,
ua
->
Next
);
trace
(
"
\t
Address.lpSockaddr: %p
\n
"
,
ua
->
Address
.
lpSockaddr
);
trace
(
"
\t
Address.iSockaddrLength: %d
\n
"
,
ua
->
Address
.
iSockaddrLength
);
trace
(
"
\t
PrefixOrigin: %u
\n
"
,
ua
->
PrefixOrigin
);
trace
(
"
\t
SuffixOrigin: %u
\n
"
,
ua
->
SuffixOrigin
);
trace
(
"
\t
DadState: %u
\n
"
,
ua
->
DadState
);
trace
(
"
\t
ValidLifetime: 0x%08x
\n
"
,
ua
->
ValidLifetime
);
trace
(
"
\t
PreferredLifetime: 0x%08x
\n
"
,
ua
->
PreferredLifetime
);
trace
(
"
\t
LeaseLifetime: 0x%08x
\n
"
,
ua
->
LeaseLifetime
);
trace
(
"
\n
"
);
ua
=
ua
->
Next
;
}
trace
(
"FirstAnycastAddress: %p
\n
"
,
aa
->
FirstAnycastAddress
);
trace
(
"FirstMulticastAddress: %p
\n
"
,
aa
->
FirstMulticastAddress
);
trace
(
"FirstDnsServerAddress: %p
\n
"
,
aa
->
FirstDnsServerAddress
);
trace
(
"DnsSuffix: %p
\n
"
,
aa
->
DnsSuffix
);
trace
(
"Description: %p
\n
"
,
aa
->
Description
);
trace
(
"FriendlyName: %p
\n
"
,
aa
->
FriendlyName
);
trace
(
"PhysicalAddress: %02x
\n
"
,
aa
->
PhysicalAddress
[
0
]);
trace
(
"PhysicalAddressLength: %u
\n
"
,
aa
->
PhysicalAddressLength
);
trace
(
"Flags: 0x%08x
\n
"
,
aa
->
Flags
);
trace
(
"Mtu: %u
\n
"
,
aa
->
Mtu
);
trace
(
"IfType: %u
\n
"
,
aa
->
IfType
);
trace
(
"OperStatus: %u
\n
"
,
aa
->
OperStatus
);
trace
(
"
\n
"
);
aa
=
aa
->
Next
;
}
HeapFree
(
GetProcessHeap
(),
0
,
aa
);
}
START_TEST
(
iphlpapi
)
{
...
...
@@ -820,6 +888,7 @@ START_TEST(iphlpapi)
testWinNT4Functions
();
testWin98Functions
();
testWin2KFunctions
();
test_GetAdaptersAddresses
();
freeIPHlpApi
();
}
}
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