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
98e1560d
Commit
98e1560d
authored
Jan 07, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Jan 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi/tests: Add IcmpSendEcho tests.
parent
f1105d3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
0 deletions
+133
-0
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+133
-0
No files found.
dlls/iphlpapi/tests/iphlpapi.c
View file @
98e1560d
...
...
@@ -73,6 +73,8 @@ static BOOL (WINAPI *pCancelIPChangeNotify)(LPOVERLAPPED);
static
DWORD
(
WINAPI
*
pGetExtendedTcpTable
)(
PVOID
,
PDWORD
,
BOOL
,
ULONG
,
TCP_TABLE_CLASS
,
ULONG
);
static
DWORD
(
WINAPI
*
pGetExtendedUdpTable
)(
PVOID
,
PDWORD
,
BOOL
,
ULONG
,
UDP_TABLE_CLASS
,
ULONG
);
static
DWORD
(
WINAPI
*
pSetTcpEntry
)(
PMIB_TCPROW
);
static
HANDLE
(
WINAPI
*
pIcmpCreateFile
)(
VOID
);
static
DWORD
(
WINAPI
*
pIcmpSendEcho
)(
HANDLE
,
IPAddr
,
LPVOID
,
WORD
,
PIP_OPTION_INFORMATION
,
LPVOID
,
DWORD
,
DWORD
);
static
void
loadIPHlpApi
(
void
)
{
...
...
@@ -105,6 +107,8 @@ static void loadIPHlpApi(void)
pGetExtendedTcpTable
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetExtendedTcpTable"
);
pGetExtendedUdpTable
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"GetExtendedUdpTable"
);
pSetTcpEntry
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"SetTcpEntry"
);
pIcmpCreateFile
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"IcmpCreateFile"
);
pIcmpSendEcho
=
(
void
*
)
GetProcAddress
(
hLibrary
,
"IcmpSendEcho"
);
}
}
...
...
@@ -860,6 +864,134 @@ static void testSetTcpEntry(void)
"got %u, expected %u
\n
"
,
ret
,
ERROR_MR_MID_NOT_FOUND
);
}
static
void
testIcmpSendEcho
(
void
)
{
HANDLE
icmp
;
char
senddata
[
32
],
replydata
[
sizeof
(
senddata
)
+
sizeof
(
ICMP_ECHO_REPLY
)];
DWORD
ret
,
error
,
replysz
=
sizeof
(
replydata
);
IPAddr
address
;
if
(
!
pIcmpSendEcho
||
!
pIcmpCreateFile
)
{
win_skip
(
"ImcpSendEcho or IcmpCreateFile not available
\n
"
);
return
;
}
memset
(
senddata
,
0
,
sizeof
(
senddata
));
address
=
htonl
(
INADDR_LOOPBACK
);
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
INVALID_HANDLE_VALUE
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
1000
);
error
=
GetLastError
();
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_INVALID_HANDLE
)
/* <= 2003 */
,
"expected 87, got %d
\n
"
,
error
);
icmp
=
pIcmpCreateFile
();
if
(
icmp
==
INVALID_HANDLE_VALUE
)
{
error
=
GetLastError
();
if
(
error
==
ERROR_ACCESS_DENIED
)
{
skip
(
"ICMP is not available.
\n
"
);
return
;
}
}
ok
(
icmp
!=
INVALID_HANDLE_VALUE
,
"IcmpCreateFile failed unexpectedly with error %d
\n
"
,
GetLastError
());
address
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
1000
);
error
=
GetLastError
();
todo_wine
{
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
ok
(
error
==
ERROR_INVALID_NETNAME
||
broken
(
error
==
IP_BAD_DESTINATION
)
/* <= 2003 */
,
"expected 1214, got %d
\n
"
,
error
);
}
address
=
htonl
(
INADDR_LOOPBACK
);
if
(
0
)
/* crashes in XP */
{
ret
=
pIcmpSendEcho
(
icmp
,
address
,
NULL
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
1000
);
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
}
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
0
,
NULL
,
replydata
,
replysz
,
1000
);
error
=
GetLastError
();
ok
(
ret
,
"IcmpSendEcho failed unexpectedly with error %d
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
NULL
,
0
,
NULL
,
replydata
,
replysz
,
1000
);
error
=
GetLastError
();
ok
(
ret
,
"IcmpSendEcho failed unexpectedly with error %d
\n
"
,
error
);
if
(
0
)
/* crashes in wine, remove IF when fixed */
{
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
NULL
,
replysz
,
1000
);
error
=
GetLastError
();
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected 87, got %d
\n
"
,
error
);
}
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
0
,
1000
);
error
=
GetLastError
();
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_INSUFFICIENT_BUFFER
)
/* <= 2003 */
,
"expected 87, got %d
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
NULL
,
0
,
1000
);
error
=
GetLastError
();
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
ERROR_INSUFFICIENT_BUFFER
)
/* <= 2003 */
,
"expected 87, got %d
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
sizeof
(
replydata
)
-
1
,
1000
);
error
=
GetLastError
();
todo_wine
{
ok
(
!
ret
,
"IcmpSendEcho succeeded unexpectedly
\n
"
);
ok
(
error
==
IP_GENERAL_FAILURE
||
broken
(
error
==
IP_BUF_TOO_SMALL
)
/* <= 2003 */
,
"expected 11050, got %d
\n
"
,
error
);
}
/* in windows >= vista the timeout can't be invalid */
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
0
);
error
=
GetLastError
();
if
(
!
ret
)
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected 87, got %d
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
-
1
);
error
=
GetLastError
();
if
(
!
ret
)
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected 87, got %d
\n
"
,
error
);
/* real ping test */
SetLastError
(
0xdeadbeef
);
address
=
htonl
(
INADDR_LOOPBACK
);
ret
=
pIcmpSendEcho
(
icmp
,
address
,
senddata
,
sizeof
(
senddata
),
NULL
,
replydata
,
replysz
,
1000
);
error
=
GetLastError
();
if
(
ret
)
{
PICMP_ECHO_REPLY
pong
=
(
PICMP_ECHO_REPLY
)
replydata
;
trace
(
"ping roundtrip: %u ms
\n
"
,
pong
->
RoundTripTime
);
}
else
{
skip
(
"Failed to ping with error %d, is lo interface down?.
\n
"
,
error
);
}
}
/*
still-to-be-tested NT4-onward functions:
CreateIpForwardEntry
...
...
@@ -892,6 +1024,7 @@ static void testWinNT4Functions(void)
testGetTcpTable
();
testGetUdpTable
();
testSetTcpEntry
();
testIcmpSendEcho
();
}
static
void
testGetInterfaceInfo
(
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