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
c77b11eb
Commit
c77b11eb
authored
Jan 16, 2017
by
André Hentschel
Committed by
Alexandre Julliard
Jan 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Add test for AllocateAndGetTcpExTableFromStack.
Signed-off-by:
André Hentschel
<
nerv@dawncrow.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fdf80ad7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+49
-0
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
c77b11eb
...
...
@@ -50,6 +50,7 @@
static
HMODULE
hLibrary
=
NULL
;
static
DWORD
(
WINAPI
*
pAllocateAndGetTcpExTableFromStack
)(
void
**
,
BOOL
,
HANDLE
,
DWORD
,
DWORD
);
static
DWORD
(
WINAPI
*
pGetNumberOfInterfaces
)(
PDWORD
);
static
DWORD
(
WINAPI
*
pGetIpAddrTable
)(
PMIB_IPADDRTABLE
,
PULONG
,
BOOL
);
static
DWORD
(
WINAPI
*
pGetIfEntry
)(
PMIB_IFROW
);
...
...
@@ -97,6 +98,7 @@ static void loadIPHlpApi(void)
{
hLibrary
=
LoadLibraryA
(
"iphlpapi.dll"
);
if
(
hLibrary
)
{
pAllocateAndGetTcpExTableFromStack
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"AllocateAndGetTcpExTableFromStack"
);
pGetNumberOfInterfaces
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetNumberOfInterfaces"
);
pGetIpAddrTable
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetIpAddrTable"
);
pGetIfEntry
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetIfEntry"
);
...
...
@@ -1562,6 +1564,52 @@ static void test_GetExtendedTcpTable(void)
HeapFree
(
GetProcessHeap
(),
0
,
table_module
);
}
static
void
test_AllocateAndGetTcpExTableFromStack
(
void
)
{
DWORD
ret
;
MIB_TCPTABLE_OWNER_PID
*
table_ex
=
NULL
;
if
(
!
pAllocateAndGetTcpExTableFromStack
)
{
skip
(
"AllocateAndGetTcpExTableFromStack not available
\n
"
);
return
;
}
if
(
0
)
{
/* crashes on native */
ret
=
pAllocateAndGetTcpExTableFromStack
(
NULL
,
FALSE
,
INVALID_HANDLE_VALUE
,
0
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
ret
);
ret
=
pAllocateAndGetTcpExTableFromStack
(
(
void
**
)
&
table_ex
,
FALSE
,
INVALID_HANDLE_VALUE
,
0
,
AF_INET
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
ret
);
ret
=
pAllocateAndGetTcpExTableFromStack
(
(
void
**
)
NULL
,
FALSE
,
GetProcessHeap
(),
0
,
AF_INET
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
ret
);
}
ret
=
pAllocateAndGetTcpExTableFromStack
(
(
void
**
)
&
table_ex
,
FALSE
,
GetProcessHeap
(),
0
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
||
broken
(
ERROR_NOT_SUPPORTED
)
/* win2k */
,
"got %u
\n
"
,
ret
);
ret
=
pAllocateAndGetTcpExTableFromStack
(
(
void
**
)
&
table_ex
,
FALSE
,
GetProcessHeap
(),
0
,
AF_INET
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %u
\n
"
,
ret
);
if
(
ret
==
NO_ERROR
&&
winetest_debug
>
1
)
{
DWORD
i
;
trace
(
"AllocateAndGetTcpExTableFromStack table: %u entries
\n
"
,
table_ex
->
dwNumEntries
);
for
(
i
=
0
;
i
<
table_ex
->
dwNumEntries
;
i
++
)
{
trace
(
"%u: local %s:%u remote %s:%u state %u pid %u
\n
"
,
i
,
ntoa
(
table_ex
->
table
[
i
].
dwLocalAddr
),
ntohs
(
table_ex
->
table
[
i
].
dwLocalPort
),
ntoa
(
table_ex
->
table
[
i
].
dwRemoteAddr
),
ntohs
(
table_ex
->
table
[
i
].
dwRemotePort
),
U
(
table_ex
->
table
[
i
]).
dwState
,
table_ex
->
table
[
i
].
dwOwningPid
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
table_ex
);
ret
=
pAllocateAndGetTcpExTableFromStack
(
(
void
**
)
&
table_ex
,
FALSE
,
GetProcessHeap
(),
0
,
AF_INET6
);
ok
(
ret
==
ERROR_NOT_SUPPORTED
,
"got %u
\n
"
,
ret
);
}
static
void
test_GetExtendedUdpTable
(
void
)
{
DWORD
ret
,
size
;
...
...
@@ -1923,6 +1971,7 @@ START_TEST(iphlpapi)
test_GetAdaptersAddresses
();
test_GetExtendedTcpTable
();
test_GetExtendedUdpTable
();
test_AllocateAndGetTcpExTableFromStack
();
test_CreateSortedAddressPairs
();
test_interface_identifier_conversion
();
test_GetIfEntry2
();
...
...
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