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
46e3f259
Commit
46e3f259
authored
Sep 13, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Call GetExtendedTcp/UdpTable() in a loop.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54588
parent
c2c0fefb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
56 deletions
+47
-56
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+47
-56
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
46e3f259
...
@@ -1866,9 +1866,27 @@ static void test_GetAdaptersAddresses(void)
...
@@ -1866,9 +1866,27 @@ static void test_GetAdaptersAddresses(void)
free
(
ptr
);
free
(
ptr
);
}
}
static
DWORD
get_extended_tcp_table
(
ULONG
family
,
TCP_TABLE_CLASS
class
,
void
**
table
)
{
DWORD
ret
,
size
=
0
;
*
table
=
NULL
;
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
family
,
class
,
0
);
if
(
ret
!=
ERROR_INSUFFICIENT_BUFFER
)
return
ret
;
*
table
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
*
table
,
&
size
,
TRUE
,
family
,
class
,
0
);
while
(
ret
==
ERROR_INSUFFICIENT_BUFFER
)
{
*
table
=
realloc
(
*
table
,
size
);
ret
=
pGetExtendedTcpTable
(
*
table
,
&
size
,
TRUE
,
family
,
class
,
0
);
}
return
ret
;
}
static
void
test_GetExtendedTcpTable
(
void
)
static
void
test_GetExtendedTcpTable
(
void
)
{
{
DWORD
ret
,
size
;
DWORD
ret
;
MIB_TCPTABLE
*
table
;
MIB_TCPTABLE
*
table
;
MIB_TCPTABLE_OWNER_PID
*
table_pid
;
MIB_TCPTABLE_OWNER_PID
*
table_pid
;
MIB_TCPTABLE_OWNER_MODULE
*
table_module
;
MIB_TCPTABLE_OWNER_MODULE
*
table_module
;
...
@@ -1881,57 +1899,27 @@ static void test_GetExtendedTcpTable(void)
...
@@ -1881,57 +1899,27 @@ static void test_GetExtendedTcpTable(void)
ret
=
pGetExtendedTcpTable
(
NULL
,
NULL
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_ALL
,
0
);
ret
=
pGetExtendedTcpTable
(
NULL
,
NULL
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_ALL
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %lu
\n
"
,
ret
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_BASIC_ALL
,
(
void
**
)
&
table
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_ALL
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_ALL
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table
);
free
(
table
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_BASIC_LISTENER
,
(
void
**
)
&
table
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_LISTENER
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_BASIC_LISTENER
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table
);
free
(
table
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_OWNER_PID_ALL
,
(
void
**
)
&
table_pid
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_PID_ALL
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_pid
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table_pid
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_PID_ALL
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_pid
);
free
(
table_pid
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_OWNER_PID_LISTENER
,
(
void
**
)
&
table_pid
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_PID_LISTENER
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_pid
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table_pid
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_PID_LISTENER
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_pid
);
free
(
table_pid
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_OWNER_MODULE_ALL
,
(
void
**
)
&
table_module
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_MODULE_ALL
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_module
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table_module
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_MODULE_ALL
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_module
);
free
(
table_module
);
size
=
0
;
ret
=
get_extended_tcp_table
(
AF_INET
,
TCP_TABLE_OWNER_MODULE_LISTENER
,
(
void
**
)
&
table_module
);
ret
=
pGetExtendedTcpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_MODULE_LISTENER
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_module
=
malloc
(
size
);
ret
=
pGetExtendedTcpTable
(
table_module
,
&
size
,
TRUE
,
AF_INET
,
TCP_TABLE_OWNER_MODULE_LISTENER
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_module
);
free
(
table_module
);
}
}
...
@@ -1985,9 +1973,27 @@ static void test_AllocateAndGetTcpExTableFromStack(void)
...
@@ -1985,9 +1973,27 @@ static void test_AllocateAndGetTcpExTableFromStack(void)
ok
(
ret
==
ERROR_NOT_SUPPORTED
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_NOT_SUPPORTED
,
"got %lu
\n
"
,
ret
);
}
}
static
DWORD
get_extended_udp_table
(
ULONG
family
,
UDP_TABLE_CLASS
class
,
void
**
table
)
{
DWORD
ret
,
size
=
0
;
*
table
=
NULL
;
ret
=
pGetExtendedUdpTable
(
NULL
,
&
size
,
TRUE
,
family
,
class
,
0
);
if
(
ret
!=
ERROR_INSUFFICIENT_BUFFER
)
return
ret
;
*
table
=
malloc
(
size
);
ret
=
pGetExtendedUdpTable
(
*
table
,
&
size
,
TRUE
,
family
,
class
,
0
);
while
(
ret
==
ERROR_INSUFFICIENT_BUFFER
)
{
*
table
=
realloc
(
*
table
,
size
);
ret
=
pGetExtendedUdpTable
(
*
table
,
&
size
,
TRUE
,
family
,
class
,
0
);
}
return
ret
;
}
static
void
test_GetExtendedUdpTable
(
void
)
static
void
test_GetExtendedUdpTable
(
void
)
{
{
DWORD
ret
,
size
;
DWORD
ret
;
MIB_UDPTABLE
*
table
;
MIB_UDPTABLE
*
table
;
MIB_UDPTABLE_OWNER_PID
*
table_pid
;
MIB_UDPTABLE_OWNER_PID
*
table_pid
;
MIB_UDPTABLE_OWNER_MODULE
*
table_module
;
MIB_UDPTABLE_OWNER_MODULE
*
table_module
;
...
@@ -2000,30 +2006,15 @@ static void test_GetExtendedUdpTable(void)
...
@@ -2000,30 +2006,15 @@ static void test_GetExtendedUdpTable(void)
ret
=
pGetExtendedUdpTable
(
NULL
,
NULL
,
TRUE
,
AF_INET
,
UDP_TABLE_BASIC
,
0
);
ret
=
pGetExtendedUdpTable
(
NULL
,
NULL
,
TRUE
,
AF_INET
,
UDP_TABLE_BASIC
,
0
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %lu
\n
"
,
ret
);
size
=
0
;
ret
=
get_extended_udp_table
(
AF_INET
,
UDP_TABLE_BASIC
,
(
void
**
)
&
table
);
ret
=
pGetExtendedUdpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_BASIC
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table
=
malloc
(
size
);
ret
=
pGetExtendedUdpTable
(
table
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_BASIC
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table
);
free
(
table
);
size
=
0
;
ret
=
get_extended_udp_table
(
AF_INET
,
UDP_TABLE_OWNER_PID
,
(
void
**
)
&
table_pid
);
ret
=
pGetExtendedUdpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_OWNER_PID
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_pid
=
malloc
(
size
);
ret
=
pGetExtendedUdpTable
(
table_pid
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_OWNER_PID
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_pid
);
free
(
table_pid
);
size
=
0
;
ret
=
get_extended_udp_table
(
AF_INET
,
UDP_TABLE_OWNER_MODULE
,
(
void
**
)
&
table_module
);
ret
=
pGetExtendedUdpTable
(
NULL
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_OWNER_MODULE
,
0
);
ok
(
ret
==
ERROR_INSUFFICIENT_BUFFER
,
"got %lu
\n
"
,
ret
);
table_module
=
malloc
(
size
);
ret
=
pGetExtendedUdpTable
(
table_module
,
&
size
,
TRUE
,
AF_INET
,
UDP_TABLE_OWNER_MODULE
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
ret
);
free
(
table_module
);
free
(
table_module
);
}
}
...
...
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