mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 13:11:43 +00:00
[DNSAPI][DNSAPI_APITEST] Fix DnsQuery_UTF8 function and add tests
CORE-11634
This commit is contained in:
parent
db4b34a046
commit
ab2c90f1b9
2 changed files with 405 additions and 42 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Test for DnsQuery_A
|
||||
* PURPOSE: Test for DnsQuery_A, DnsQuery_UTF8
|
||||
* PROGRAMMER: Victor Martinez Calvo <victor.martinez@reactos.org>
|
||||
*/
|
||||
|
||||
|
@ -19,6 +19,8 @@ void TestHostName(void)
|
|||
DNS_STATUS dns_status;
|
||||
char host_name[255];
|
||||
char test_name[255];
|
||||
char host_nameUTF8[255];
|
||||
char test_nameUTF8[255];
|
||||
PDNS_RECORD dp;
|
||||
WCHAR host_nameW[255];
|
||||
WCHAR test_nameW[255];
|
||||
|
@ -51,6 +53,7 @@ void TestHostName(void)
|
|||
}
|
||||
HeapFree(GetProcessHeap(), 0, network_info);
|
||||
mbstowcs(host_nameW, host_name, 255);
|
||||
wcstombs(host_nameUTF8, host_nameW, 255);
|
||||
}
|
||||
|
||||
//DnsQuery_A:
|
||||
|
@ -266,6 +269,246 @@ void TestHostName(void)
|
|||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
//DnsQuery_UTF8:
|
||||
//NULL
|
||||
dp = InvalidPointer;
|
||||
dns_status = DnsQuery_UTF8(NULL, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == ERROR_INVALID_PARAMETER, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
ok(dp == InvalidPointer, "dp = %p\n", dp);
|
||||
|
||||
//NULL dp
|
||||
dns_status = DnsQuery_UTF8(host_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, NULL, 0);
|
||||
ok(dns_status == ERROR_INVALID_PARAMETER, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
|
||||
//Testing HostName
|
||||
dp = InvalidPointer;
|
||||
dns_status = DnsQuery_UTF8(host_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
ok(strcmp(dp->pName, host_name) == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, host_name);
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
//127.0.0.1
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"127.0.0.1");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
ok(strcmp(dp->pName, "127.0.0.1") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "127.0.0.1");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
//Localhost strings
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"LocalHost");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
/* On Windows 7 is unchanged on XP is lowercased */
|
||||
ok(strcmp(dp->pName, "localhost") == 0 || broken(strcmp(dp->pName, "LocalHost") == 0), "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"Localhost");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
/* On Windows 7 is unchanged on XP is lowercased */
|
||||
ok(strcmp(dp->pName, "localhost") == 0 || broken(strcmp(dp->pName, "Localhost") == 0), "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"localhost");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
ok(strcmp(dp->pName, "localhost") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
/* On Windows 7 is the host on XP is dot ??? */
|
||||
ok(strcmp(dp->pName, ".") == 0 || broken(strcmp(dp->pName, host_name) == 0), "DnsQuery_UTF8 returned wrong answer '%s' expected '%s' or '.'\n", dp->pName, host_name);
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L" ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
/* On Windows 7 is DNS_ERROR_INVALID_NAME_CHAR on XP is ERROR_TIMEOUT on Win 2k3 is ERROR_INVALID_NAME*/
|
||||
ok(dns_status == ERROR_INVALID_NAME || broken(dns_status == ERROR_TIMEOUT) || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 failed with error %lu expected %u or %u or %u\n", dns_status, ERROR_INVALID_NAME, ERROR_TIMEOUT, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, host_name) == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, host_name);
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"0.0.0.0");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_UTF8 failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
{
|
||||
ok(strcmp(dp->pName, "0.0.0.0") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "0.0.0.0");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_ANY), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_ANY));
|
||||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"0.0.0.0 ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
/* On windows 7 fails with DNS_ERROR_INVALID_NAME_CHAR on XP no error */
|
||||
ok(dns_status == NO_ERROR || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u\n", dns_status, NO_ERROR, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "0.0.0.0") == 0 || broken(strcmp(dp->pName, "0.0.0.0 ") == 0), "DnsQuery_UTF8 returned wrong answer '%s' expected '%s' or '%s'\n", dp->pName, "0.0.0.0", "0.0.0.0 ");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_ANY), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_ANY));
|
||||
}
|
||||
ok(dp != InvalidPointer || broken(dp == InvalidPointer) || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"127.0.0.1 ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
/* On windows 7 fails with DNS_ERROR_INVALID_NAME_CHAR on XP no error */
|
||||
ok(dns_status == NO_ERROR || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u\n", dns_status, NO_ERROR, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "127.0.0.1") == 0 || strcmp(dp->pName, "127.0.0.1 ") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s' or '%s'\n", dp->pName, "127.0.0.1", "127.0.0.1 ");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp != InvalidPointer || broken(dp == InvalidPointer) || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L" 127.0.0.1 ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == DNS_ERROR_RCODE_NAME_ERROR || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u\n", dns_status, DNS_ERROR_RCODE_NAME_ERROR, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "127.0.0.1") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "127.0.0.1");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L" 127.0. 0.1 ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == DNS_ERROR_RCODE_NAME_ERROR || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u\n", dns_status, DNS_ERROR_RCODE_NAME_ERROR, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp == InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "127.0.0.1") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "127.0.0.1");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L"localhost ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == ERROR_INVALID_NAME || broken(dns_status == ERROR_TIMEOUT) || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u or %u\n", dns_status, ERROR_INVALID_NAME, ERROR_TIMEOUT, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "localhost") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L" localhost");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == ERROR_INVALID_NAME || broken(dns_status == ERROR_TIMEOUT) || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u or %u\n", dns_status, ERROR_INVALID_NAME, ERROR_TIMEOUT, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "localhost") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
dp = InvalidPointer;
|
||||
wcscpy(test_nameW, L" local host ");
|
||||
wcstombs(test_nameUTF8, test_nameW, 255);
|
||||
dns_status = DnsQuery_UTF8(test_nameUTF8, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == ERROR_INVALID_NAME || broken(dns_status == ERROR_TIMEOUT) || broken(dns_status == DNS_ERROR_INVALID_NAME_CHAR), "DnsQuery_UTF8 wrong status %lu expected %u or %u or %u\n", dns_status, ERROR_INVALID_NAME, ERROR_TIMEOUT, DNS_ERROR_INVALID_NAME_CHAR);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR)
|
||||
{
|
||||
ok(strcmp(dp->pName, "localhost") == 0, "DnsQuery_UTF8 returned wrong answer '%s' expected '%s'\n", dp->pName, "localhost");
|
||||
ok(dp->wType == DNS_TYPE_A, "DnsQuery_UTF8 returned wrong type %d expected %d\n", dp->wType, DNS_TYPE_A);
|
||||
ok(dp->wDataLength == sizeof(IP4_ADDRESS), "DnsQuery_UTF8 returned wrong data size %d\n", dp->wDataLength);
|
||||
ok(dp->Data.A.IpAddress == ntohl(INADDR_LOOPBACK), "DnsQuery_UTF8 returned wrong data %ld expected %ld\n", dp->Data.A.IpAddress, ntohl(INADDR_LOOPBACK));
|
||||
}
|
||||
ok(dp == InvalidPointer || broken(dp == NULL), "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer && dns_status == NO_ERROR) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
//DnsQuery_W:
|
||||
//NULL
|
||||
dp = InvalidPointer;
|
||||
|
@ -288,7 +531,7 @@ void TestHostName(void)
|
|||
dns_status = DnsQuery_W(host_nameW, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, NULL, 0);
|
||||
ok(dns_status == ERROR_INVALID_PARAMETER, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||
|
||||
//Testing HostName
|
||||
//Testing HostName
|
||||
dns_status = DnsQuery_W(host_nameW, DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||
if (dp != InvalidPointer)
|
||||
|
@ -299,7 +542,7 @@ void TestHostName(void)
|
|||
}
|
||||
ok(dp != InvalidPointer && dp != NULL, "dp = %p\n", dp);
|
||||
if (dp != InvalidPointer) DnsRecordListFree(dp, DnsFreeRecordList);
|
||||
|
||||
|
||||
//127.0.0.1
|
||||
dns_status = DnsQuery_W(L"127.0.0.1", DNS_TYPE_A, DNS_QUERY_STANDARD, 0, &dp, 0);
|
||||
ok(dns_status == NO_ERROR, "DnsQuery_W failed with error %lu\n", dns_status);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue