https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fbf4660f468fb2be2368f…
commit fbf4660f468fb2be2368f783556690e16e1c0f99
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Sat Dec 28 23:52:18 2019 +0300
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Wed Jan 1 18:53:40 2020 +0200
[WS2_32_APITEST] Add some tests for GetAddrInfoW
Test results proves WSAStartup call should precede GetAddrInfoW calls.
---
modules/rostests/apitests/ws2_32/getaddrinfo.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/modules/rostests/apitests/ws2_32/getaddrinfo.c
b/modules/rostests/apitests/ws2_32/getaddrinfo.c
index 369c5b3e694..068881a07f5 100644
--- a/modules/rostests/apitests/ws2_32/getaddrinfo.c
+++ b/modules/rostests/apitests/ws2_32/getaddrinfo.c
@@ -199,7 +199,9 @@ START_TEST(getaddrinfo)
WSADATA WsaData;
int Error;
PADDRINFOA AddrInfo;
+ PADDRINFOW AddrInfoW;
ADDRINFOA Hints;
+ ADDRINFOW HintsW;
CHAR LocalHostName[128];
struct hostent *Hostent;
@@ -218,6 +220,9 @@ START_TEST(getaddrinfo)
Error = getaddrinfo("127.0.0.1", "80", NULL, &AddrInfo);
ok_dec(Error, WSANOTINITIALISED);
+ Error = GetAddrInfoW(L"127.0.0.1", L"80", NULL, &AddrInfoW);
+ ok_dec(Error, WSANOTINITIALISED);
+
Error = WSAStartup(MAKEWORD(2, 2), &WsaData);
ok_dec(Error, 0);
@@ -239,7 +244,7 @@ START_TEST(getaddrinfo)
"Could not determine local address. Following test results may be
wrong.\n");
ZeroMemory(&Hints, sizeof(Hints));
- /* parameter tests */
+ /* parameter tests for getaddrinfo */
StartSeh() getaddrinfo(NULL, NULL, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() getaddrinfo("", "", &Hints, NULL);
EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh()
@@ -250,6 +255,17 @@ START_TEST(getaddrinfo)
ok_ptr(AddrInfo, NULL);
EndSeh(STATUS_SUCCESS);
+ /* parameter tests for GetAddrInfoW */
+ StartSeh() GetAddrInfoW(NULL, NULL, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION);
+ StartSeh() GetAddrInfoW(L"", L"", &HintsW, NULL);
EndSeh(STATUS_ACCESS_VIOLATION);
+ StartSeh()
+ AddrInfo = InvalidPointer;
+ Error = GetAddrInfoW(NULL, NULL, NULL, &AddrInfoW);
+ ok_dec(Error, WSAHOST_NOT_FOUND);
+ ok_dec(WSAGetLastError(), WSAHOST_NOT_FOUND);
+ ok_ptr(AddrInfo, InvalidPointer); /* differs from getaddrinfo */
+ EndSeh(STATUS_SUCCESS);
+
TestNodeName();
TestServiceName();
/* TODO: test passing both node name and service name */
@@ -262,4 +278,7 @@ START_TEST(getaddrinfo)
/* not initialized anymore */
Error = getaddrinfo("127.0.0.1", "80", NULL, &AddrInfo);
ok_dec(Error, WSANOTINITIALISED);
+
+ Error = GetAddrInfoW(L"127.0.0.1", L"80", NULL, &AddrInfoW);
+ ok_dec(Error, WSANOTINITIALISED);
}