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
d292c471
Commit
d292c471
authored
Aug 27, 2018
by
Guillaume Charifi
Committed by
Alexandre Julliard
Aug 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Add tests for GetUdp6Table().
Signed-off-by:
Guillaume Charifi
<
guillaume.charifi@sfr.fr
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
88e44332
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+55
-0
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
d292c471
...
...
@@ -74,6 +74,7 @@ static DWORD (WINAPI *pGetTcpStatisticsEx)(PMIB_TCPSTATS,DWORD);
static
DWORD
(
WINAPI
*
pGetUdpStatisticsEx
)(
PMIB_UDPSTATS
,
DWORD
);
static
DWORD
(
WINAPI
*
pGetTcpTable
)(
PMIB_TCPTABLE
,
PDWORD
,
BOOL
);
static
DWORD
(
WINAPI
*
pGetUdpTable
)(
PMIB_UDPTABLE
,
PDWORD
,
BOOL
);
static
DWORD
(
WINAPI
*
pGetUdp6Table
)(
PMIB_UDP6TABLE
,
PDWORD
,
BOOL
);
static
DWORD
(
WINAPI
*
pGetPerAdapterInfo
)(
ULONG
,
PIP_PER_ADAPTER_INFO
,
PULONG
);
static
DWORD
(
WINAPI
*
pGetAdaptersAddresses
)(
ULONG
,
ULONG
,
PVOID
,
PIP_ADAPTER_ADDRESSES
,
PULONG
);
static
DWORD
(
WINAPI
*
pGetUnicastIpAddressEntry
)(
MIB_UNICASTIPADDRESS_ROW
*
);
...
...
@@ -129,6 +130,7 @@ static void loadIPHlpApi(void)
pGetUdpStatisticsEx
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetUdpStatisticsEx"
);
pGetTcpTable
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetTcpTable"
);
pGetUdpTable
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetUdpTable"
);
pGetUdp6Table
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetUdp6Table"
);
pGetPerAdapterInfo
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetPerAdapterInfo"
);
pGetAdaptersAddresses
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetAdaptersAddresses"
);
pGetUnicastIpAddressEntry
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetUnicastIpAddressEntry"
);
...
...
@@ -171,6 +173,23 @@ static const char *ntoa( DWORD ip )
return
buffer
;
}
static
const
char
*
ntoa6
(
IN6_ADDR
*
ip
)
{
static
char
buffer
[
40
];
char
*
buf
=
buffer
;
unsigned
short
*
p
=
ip
->
u
.
Word
;
unsigned
int
i
=
0
;
while
(
i
<
8
)
{
if
(
i
>
0
)
*
buf
++
=
':'
;
buf
+=
sprintf
(
buf
,
"%x"
,
htons
(
p
[
i
])
);
i
++
;
}
return
buffer
;
}
/*
still-to-be-tested 98-only functions:
GetUniDirectionalAdapterInfo
...
...
@@ -2220,6 +2239,41 @@ static void test_ConvertLengthToIpv4Mask(void)
ok
(
mask
==
INADDR_NONE
,
"ConvertLengthToIpv4Mask mask value 0x%08x, expected 0x%08x
\n
"
,
mask
,
INADDR_NONE
);
}
static
void
test_GetUdp6Table
(
void
)
{
if
(
pGetUdp6Table
)
{
DWORD
apiReturn
;
ULONG
dwSize
=
0
;
apiReturn
=
pGetUdp6Table
(
NULL
,
&
dwSize
,
FALSE
);
if
(
apiReturn
==
ERROR_NOT_SUPPORTED
)
{
skip
(
"GetUdp6Table is not supported
\n
"
);
return
;
}
ok
(
apiReturn
==
ERROR_INSUFFICIENT_BUFFER
,
"GetUdp6Table(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER
\n
"
,
apiReturn
);
if
(
apiReturn
==
ERROR_INSUFFICIENT_BUFFER
)
{
PMIB_UDP6TABLE
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
apiReturn
=
pGetUdp6Table
(
buf
,
&
dwSize
,
FALSE
);
ok
(
apiReturn
==
NO_ERROR
,
"GetUdp6Table(buf, &dwSize, FALSE) returned %d, expected NO_ERROR
\n
"
,
apiReturn
);
if
(
apiReturn
==
NO_ERROR
&&
winetest_debug
>
1
)
{
DWORD
i
;
trace
(
"UDP6 table: %u entries
\n
"
,
buf
->
dwNumEntries
);
for
(
i
=
0
;
i
<
buf
->
dwNumEntries
;
i
++
)
trace
(
"%u: %s%%%u:%u
\n
"
,
i
,
ntoa6
(
&
buf
->
table
[
i
].
dwLocalAddr
),
ntohs
(
buf
->
table
[
i
].
dwLocalScopeId
),
ntohs
(
buf
->
table
[
i
].
dwLocalPort
)
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
}
}
START_TEST
(
iphlpapi
)
{
...
...
@@ -2248,6 +2302,7 @@ START_TEST(iphlpapi)
test_GetUnicastIpAddressEntry
();
test_GetUnicastIpAddressTable
();
test_ConvertLengthToIpv4Mask
();
test_GetUdp6Table
();
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