[PATCH 2/3] ntdll/tests: Add tests for RtlIpv6StringToAddress (try 3)
Mark Jansen
learn0more+wine at gmail.com
Thu Feb 19 16:38:11 CST 2015
---
dlls/ntdll/tests/rtl.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 225 insertions(+)
-------------- next part --------------
From 9649f397daffb218d8097c24f4730e94e86cea76 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more+wine at gmail.com>
Date: Sun, 15 Feb 2015 16:22:53 +0100
Subject: [PATCH 2/3] Add test for RtlIpv6StringToAddress
---
dlls/ntdll/tests/rtl.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 225 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 8fdd80d..3e42c93 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -25,6 +25,7 @@
#include "ntdll_test.h"
#include "inaddr.h"
+#include "in6addr.h"
#ifndef __WINE_WINTERNL_H
@@ -90,6 +91,7 @@ static CHAR * (WINAPI *pRtlIpv4AddressToStringA)(const IN_ADDR *, LPSTR);
static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, LPSTR, PULONG);
static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ADDR *);
static NTSTATUS (WINAPI *pRtlIpv4StringToAddressExA)(PCSTR, BOOLEAN, IN_ADDR *, PUSHORT);
+static NTSTATUS (WINAPI *pRtlIpv6StringToAddressA)(PCSTR, PCSTR *, struct in6_addr *);
static NTSTATUS (WINAPI *pLdrAddRefDll)(ULONG, HMODULE);
static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG_PTR*);
static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR);
@@ -138,6 +140,7 @@ static void InitFunctionPtrs(void)
pRtlIpv4AddressToStringExA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringExA");
pRtlIpv4StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressA");
pRtlIpv4StringToAddressExA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressExA");
+ pRtlIpv6StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressA");
pLdrAddRefDll = (void *)GetProcAddress(hntdll, "LdrAddRefDll");
pLdrLockLoaderLock = (void *)GetProcAddress(hntdll, "LdrLockLoaderLock");
pLdrUnlockLoaderLock = (void *)GetProcAddress(hntdll, "LdrUnlockLoaderLock");
@@ -1594,6 +1597,227 @@ static void test_RtlIpv4StringToAddressEx(void)
}
}
+
+/* ipv6 addresses from https://github.com/beaugunderson/javascript-ipv6/tree/master/test/data */
+static const struct
+{
+ PCSTR address;
+ NTSTATUS res;
+ int terminator_offset;
+ int ip[8];
+ int broken;
+ int ex_fails; /* 1 means ex should fail, 2 means skip for ex */
+} ipv6_tests[] =
+{
+ /* according to the github, all these should succeed */
+ { "0000:0000:0000:0000:0000:0000:0000:0000", STATUS_SUCCESS, 39, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "0000:0000:0000:0000:0000:0000:0000:0001", STATUS_SUCCESS, 39, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
+ { "0:0:0:0:0:0:0:0", STATUS_SUCCESS, 15, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "0:0:0:0:0:0:0:1", STATUS_SUCCESS, 15, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
+ { "0:0:0:0:0:0:0::", STATUS_SUCCESS, 13, { 0, 0, 0, 0, 0, 0, 0, 0 }, 1 },
+ { "0:0:0:0:0:0:13.1.68.3", STATUS_SUCCESS, 21, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
+ { "0:0:0:0:0:0::", STATUS_SUCCESS, 13, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "0:0:0:0:0::", STATUS_SUCCESS, 11, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "0:0:0:0:0:FFFF:129.144.52.38", STATUS_SUCCESS, 28, { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
+ { "0::", STATUS_SUCCESS, 3, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "0:1:2:3:4:5:6:7", STATUS_SUCCESS, 15, { 0, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 } },
+ { "1080:0:0:0:8:800:200c:417a", STATUS_SUCCESS, 26, { 0x8010, 0, 0, 0, 0x800, 0x8, 0x0c20, 0x7a41 } },
+ { "0:a:b:c:d:e:f::", STATUS_SUCCESS, 13, { 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00, 0xf00, 0 }, 1 },
+ { "1111:2222:3333:4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 45, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
+ { "1111:2222:3333:4444:5555:6666:7777:8888", STATUS_SUCCESS, 39, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
+ { "1111:2222:3333:4444:5555:6666:7777::", STATUS_SUCCESS, 34, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0 }, 1 },
+ { "1111:2222:3333:4444:5555:6666::", STATUS_SUCCESS, 31, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0 } },
+ { "1111:2222:3333:4444:5555:6666::8888", STATUS_SUCCESS, 35, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } },
+ { "1111:2222:3333:4444:5555::", STATUS_SUCCESS, 26, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } },
+ { "1111:2222:3333:4444:5555::123.123.123.123", STATUS_SUCCESS, 41, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7b7b, 0x7b7b } },
+ { "1111:2222:3333:4444:5555::7777:8888", STATUS_SUCCESS, 35, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7777, 0x8888 } },
+ { "1111:2222:3333:4444:5555::8888", STATUS_SUCCESS, 30, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 } },
+ { "1111::", STATUS_SUCCESS, 6, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
+ { "1111::123.123.123.123", STATUS_SUCCESS, 21, { 0x1111, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
+ { "1111::3333:4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 41, { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
+ { "1111::3333:4444:5555:6666:7777:8888", STATUS_SUCCESS, 35, { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
+ { "1111::4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 36, { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
+ { "1111::4444:5555:6666:7777:8888", STATUS_SUCCESS, 30, { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
+ { "1111::5555:6666:123.123.123.123", STATUS_SUCCESS, 31, { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
+ { "1111::5555:6666:7777:8888", STATUS_SUCCESS, 25, { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7777, 0x8888 } },
+ { "1111::6666:123.123.123.123", STATUS_SUCCESS, 26, { 0x1111, 0, 0, 0, 0, 0x6666, 0x7b7b, 0x7b7b } },
+ { "1111::6666:7777:8888", STATUS_SUCCESS, 20, { 0x1111, 0, 0, 0, 0, 0x6666, 0x7777, 0x8888 } },
+ { "1111::7777:8888", STATUS_SUCCESS, 15, { 0x1111, 0, 0, 0, 0, 0, 0x7777, 0x8888 } },
+ { "1111::8888", STATUS_SUCCESS, 10, { 0x1111, 0, 0, 0, 0, 0, 0, 0x8888 } },
+ { "1:2:3:4:5:6:1.2.3.4", STATUS_SUCCESS, 19, { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x201, 0x403 } },
+ { "1:2:3:4:5:6:7:8", STATUS_SUCCESS, 15, { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800 } },
+ { "1:2:3:4:5:6::", STATUS_SUCCESS, 13, { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0 } },
+ { "1:2:3:4:5:6::8", STATUS_SUCCESS, 14, { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0x800 } },
+ { "2001:0000:1234:0000:0000:C1C0:ABCD:0876", STATUS_SUCCESS, 39, { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
+ { "2001:0000:4136:e378:8000:63bf:3fff:fdd2", STATUS_SUCCESS, 39, { 0x120, 0, 0x3641, 0x78e3, 0x80, 0xbf63, 0xff3f, 0xd2fd } },
+ { "2001:0db8:0:0:0:0:1428:57ab", STATUS_SUCCESS, 27, { 0x120, 0xb80d, 0, 0, 0, 0, 0x2814, 0xab57 } },
+ { "2001:0db8:1234:ffff:ffff:ffff:ffff:ffff", STATUS_SUCCESS, 39, { 0x120, 0xb80d, 0x3412, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
+ { "2001::CE49:7601:2CAD:DFFF:7C94:FFFE", STATUS_SUCCESS, 35, { 0x120, 0, 0x49ce, 0x176, 0xad2c, 0xffdf, 0x947c, 0xfeff } },
+ { "2001:db8:85a3::8a2e:370:7334", STATUS_SUCCESS, 28, { 0x120, 0xb80d, 0xa385, 0, 0, 0x2e8a, 0x7003, 0x3473 } },
+ { "3ffe:0b00:0000:0000:0001:0000:0000:000a", STATUS_SUCCESS, 39, { 0xfe3f, 0xb, 0, 0, 0x100, 0, 0, 0xa00 } },
+ { "::", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::%16", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::/16", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "::0", STATUS_SUCCESS, 3, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0", STATUS_SUCCESS, 5, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0:0", STATUS_SUCCESS, 7, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0:0:0", STATUS_SUCCESS, 9, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0:0:0:0", STATUS_SUCCESS, 11, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0:0:0:0:0", STATUS_SUCCESS, 13, { 0, 0, 0, 0, 0, 0, 0, 0 } },
+ { "::0:0:0:0:0:0:0", STATUS_SUCCESS, 13, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "::0:a:b:c:d:e:f", STATUS_SUCCESS, 13, { 0, 0, 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00 }, 0, 1 },
+ { "::123.123.123.123", STATUS_SUCCESS, 17, { 0, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
+ { "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", STATUS_SUCCESS, 39, { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
+
+ /* and all these should fail */
+ { "':10.0.0.1", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { "-1", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { "02001:0000:1234:0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, -1, { -1 } },
+ { "1.2.3.4", STATUS_INVALID_PARAMETER, 7, { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1.2.3.4:1111::5555", STATUS_INVALID_PARAMETER, 7, { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1.2.3.4::5555", STATUS_INVALID_PARAMETER, 7, { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "11112222:3333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, -1, { -1 } },
+ { "11112222:3333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1, { -1 } },
+ { "1111", STATUS_INVALID_PARAMETER, 4, { -1 } },
+ { "1111:22223333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, -1, { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:22223333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1, { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:", STATUS_INVALID_PARAMETER, 10, { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:1.2.3.4", STATUS_INVALID_PARAMETER, 17, { 0x1111, 0x2222, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:3333", STATUS_INVALID_PARAMETER, 14, { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:3333:4444:5555:6666:7777:1.2.3.4", STATUS_SUCCESS, 36, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 }, 0, 1 },
+ { "1111:2222:3333:4444:5555:6666:7777:8888:", STATUS_SUCCESS, 39, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, 0, 1 },
+ { "1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4",STATUS_SUCCESS, 39, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, 0, 1 },
+ { "1111:2222:3333:4444:5555:6666:7777:8888:9999", STATUS_SUCCESS, 39, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, 0, 1 },
+ { "1111:2222:::", STATUS_SUCCESS, 11, { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "1111::5555:", STATUS_INVALID_PARAMETER, 11, { 0x1111, 0x5555, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111::3333:4444:5555:6666:7777::", STATUS_SUCCESS, 30, { 0x1111, 0, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777 }, 0, 1 },
+ { "1111:2222:::4444:5555:6666:1.2.3.4", STATUS_SUCCESS, 11, { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "1111::3333::5555:6666:1.2.3.4", STATUS_SUCCESS, 10, { 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 }, 0, 1 },
+ { "12345::6:7:8", STATUS_INVALID_PARAMETER, -1, { -1 } },
+ { "1::1.2.256.4", STATUS_INVALID_PARAMETER, -1, { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.3.256", STATUS_INVALID_PARAMETER, 12, { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.3.300", STATUS_INVALID_PARAMETER, 12, { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.3.900", STATUS_INVALID_PARAMETER, 12, { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.300.4", STATUS_INVALID_PARAMETER, -1, { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.256.3.4", STATUS_INVALID_PARAMETER, -1, { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::256.2.3.4", STATUS_INVALID_PARAMETER, -1, { 0x100, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::2::3", STATUS_SUCCESS, 4, { 0x100, 0, 0, 0, 0, 0, 0, 0x200 }, 0, 1 },
+ { "2001:0000:1234: 0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, 15, { 0x120, 0, 0x3412, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "2001:0000:1234:0000:0000:C1C0:ABCD:0876 0", STATUS_SUCCESS, 39, { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 }, 0, 1 },
+ { "2001:1:1:1:1:1:255Z255X255Y255", STATUS_INVALID_PARAMETER, 18, { 0x120, 0x100, 0x100, 0x100, 0x100, 0x100, 0xabab, 0xabab } },
+ { "2001::FFD3::57ab", STATUS_SUCCESS, 10, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff }, 0, 1 },
+ { ":", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { ":1111:2222:3333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { ":1111:2222:3333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { ":1111::", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { "::-1", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "::.", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "::..", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "::...", STATUS_SUCCESS, 2, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1 },
+ { "XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4", STATUS_INVALID_PARAMETER, 0, { -1 } },
+ { "[::]", STATUS_INVALID_PARAMETER, 0, { -1 }, 0, 2 },
+
+ /* windows disagrees with that...
+ it also seems to directly operate on the ipv6 struct, and sometimes forgets to update the terminator. */
+};
+const unsigned int ipv6_testcount = sizeof(ipv6_tests) / sizeof(ipv6_tests[0]);
+
+
+static void test_RtlIpv6StringToAddress(void)
+{
+ NTSTATUS res;
+ IN6_ADDR ip, expected_ip;
+ PCSTR terminator;
+ CHAR dummy;
+ unsigned int i, j;
+
+ if (!pRtlIpv6StringToAddressA)
+ {
+ skip("RtlIpv6StringToAddress not available\n");
+ return;
+ }
+
+ res = pRtlIpv6StringToAddressA("::", &terminator, &ip);
+ ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res);
+ if (0) {
+ /* any of these crash */
+ res = pRtlIpv6StringToAddressA(NULL, &terminator, &ip);
+ ok(res == STATUS_INVALID_PARAMETER, "[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
+ res = pRtlIpv6StringToAddressA("::", NULL, &ip);
+ ok(res == STATUS_INVALID_PARAMETER, "[null terminator] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
+ res = pRtlIpv6StringToAddressA("::", &terminator, NULL);
+ ok(res == STATUS_INVALID_PARAMETER, "[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
+ }
+
+
+ /* sanity check */
+ ok(sizeof(ip._S6_un) == (sizeof(USHORT)* 8), "sizeof(ip._S6_un)\n");
+
+ for (i = 0; i < ipv6_testcount; i++)
+ {
+ terminator = &dummy;
+ for (j = 0; j < 8; ++j)
+ ip.s6_words[j] = 0xabab;
+ res = pRtlIpv6StringToAddressA(ipv6_tests[i].address, &terminator, &ip);
+
+ if (ipv6_tests[i].broken)
+ {
+ ok(res == ipv6_tests[i].res || broken(res == STATUS_INVALID_PARAMETER),
+ "[%s] res = 0x%08x, expected 0x%08x\n",
+ ipv6_tests[i].address, res, ipv6_tests[i].res);
+
+ if (res == STATUS_INVALID_PARAMETER)
+ continue;
+ }
+ else
+ {
+ ok(res == ipv6_tests[i].res,
+ "[%s] res = 0x%08x, expected 0x%08x\n",
+ ipv6_tests[i].address, res, ipv6_tests[i].res);
+ }
+
+ if (ipv6_tests[i].terminator_offset < 0)
+ {
+ ok(terminator == &dummy,
+ "[%s] terminator = %p, expected it not to change\n",
+ ipv6_tests[i].address, terminator);
+ }
+ else
+ {
+ if (ipv6_tests[i].broken)
+ {
+ PCSTR expected = ipv6_tests[i].address + ipv6_tests[i].terminator_offset;
+ ok(terminator == expected || broken(terminator == expected + 2),
+ "[%s] terminator = %p, expected %p\n",
+ ipv6_tests[i].address, terminator, expected);
+ }
+ else
+ {
+ ok(terminator == ipv6_tests[i].address + ipv6_tests[i].terminator_offset,
+ "[%s] terminator = %p, expected %p\n",
+ ipv6_tests[i].address, terminator, ipv6_tests[i].address + ipv6_tests[i].terminator_offset);
+ }
+ }
+ if (ipv6_tests[i].ip[0] == -1)
+ {
+ for (j = 0; j < 8; ++j)
+ expected_ip.s6_words[j] = 0xabab;
+ }
+ else
+ {
+ for (j = 0; j < 8; ++j)
+ expected_ip.s6_words[j] = ipv6_tests[i].ip[j];
+ }
+ ok(!memcmp(ip.s6_addr, expected_ip.s6_addr, sizeof(ip._S6_un)),
+ "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
+ ipv6_tests[i].address,
+ ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3],
+ ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7],
+ expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3],
+ expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]);
+ }
+}
+
static void test_LdrAddRefDll(void)
{
HMODULE mod, mod2;
@@ -1726,6 +1950,7 @@ START_TEST(rtl)
test_RtlIpv4AddressToStringEx();
test_RtlIpv4StringToAddress();
test_RtlIpv4StringToAddressEx();
+ test_RtlIpv6StringToAddress();
test_LdrAddRefDll();
test_LdrLockLoaderLock();
}
--
1.8.3.msysgit.0
More information about the wine-patches
mailing list