36#ifndef __WINE_WINTERNL_H
59#define htons(s) ((USHORT)(s))
63 return (
s >> 8) | (
s << 8);
65#define htons(s) __my_ushort_swap(s)
90static NTSTATUS (
WINAPI *pRtlAllocateAndInitializeSid)(
PSID_IDENTIFIER_AUTHORITY,
BYTE,
DWORD,
DWORD,
DWORD,
DWORD,
DWORD,
DWORD,
DWORD,
DWORD,
PSID*);
116static NTSTATUS (
WINAPI *pLdrEnumerateLoadedModules)(
void *,
void *,
void *);
128static const char*
src_src =
"This is a test!";
129static WCHAR ws2_32dllW[] = {
'w',
's',
'2',
'_',
'3',
'2',
'.',
'd',
'l',
'l',0};
130static WCHAR wintrustdllW[] = {
'w',
'i',
'n',
't',
'r',
'u',
's',
't',
'.',
'd',
'l',
'l',0};
131static WCHAR crypt32dllW[] = {
'c',
'r',
'y',
'p',
't',
'3',
'2',
'.',
'd',
'l',
'l',0};
140 ok(
hntdll != 0,
"LoadLibrary failed\n");
179 pRtlGetCompressionWorkSpaceSize = (
void *)
GetProcAddress(
hntdll,
"RtlGetCompressionWorkSpaceSize");
184 pRtlIsCriticalSectionLockedByThread = (
void *)
GetProcAddress(
hntdll,
"RtlIsCriticalSectionLockedByThread");
185 pRtlInitializeCriticalSectionEx = (
void *)
GetProcAddress(
hntdll,
"RtlInitializeCriticalSectionEx");
199 ok(
strlen(
src) == 15,
"Source must be 16 bytes long!\n");
202#define COMP(str1,str2,cmplen,len) size = pRtlCompareMemory(str1, str2, cmplen); \
203 ok(size == len, "Expected %ld, got %ld\n", size, (SIZE_T)len)
209 if (!pRtlCompareMemory)
211 win_skip(
"RtlCompareMemory is not available\n");
228 if (!pRtlCompareMemoryUlong)
230 win_skip(
"RtlCompareMemoryUlong is not available\n");
238 result = pRtlCompareMemoryUlong(
a, 0, 0x0123);
239 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 0, 0x0123) returns %u, expected 0\n",
a,
result);
240 result = pRtlCompareMemoryUlong(
a, 3, 0x0123);
241 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0\n",
a,
result);
242 result = pRtlCompareMemoryUlong(
a, 4, 0x0123);
243 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4\n",
a,
result);
244 result = pRtlCompareMemoryUlong(
a, 5, 0x0123);
245 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4\n",
a,
result);
246 result = pRtlCompareMemoryUlong(
a, 7, 0x0123);
247 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4\n",
a,
result);
248 result = pRtlCompareMemoryUlong(
a, 8, 0x0123);
249 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 4\n",
a,
result);
250 result = pRtlCompareMemoryUlong(
a, 9, 0x0123);
251 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 4\n",
a,
result);
252 result = pRtlCompareMemoryUlong(
a, 4, 0x0127);
253 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 4, 0x0127) returns %u, expected 0\n",
a,
result);
254 result = pRtlCompareMemoryUlong(
a, 4, 0x7123);
255 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 4, 0x7123) returns %u, expected 0\n",
a,
result);
256 result = pRtlCompareMemoryUlong(
a, 16, 0x4567);
257 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 16, 0x4567) returns %u, expected 0\n",
a,
result);
260 result = pRtlCompareMemoryUlong(
a, 3, 0x0123);
261 ok(
result == 0,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0\n",
a,
result);
262 result = pRtlCompareMemoryUlong(
a, 4, 0x0123);
263 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4\n",
a,
result);
264 result = pRtlCompareMemoryUlong(
a, 5, 0x0123);
265 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4\n",
a,
result);
266 result = pRtlCompareMemoryUlong(
a, 7, 0x0123);
267 ok(
result == 4,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4\n",
a,
result);
268 result = pRtlCompareMemoryUlong(
a, 8, 0x0123);
269 ok(
result == 8,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 8\n",
a,
result);
270 result = pRtlCompareMemoryUlong(
a, 9, 0x0123);
271 ok(
result == 8,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 8\n",
a,
result);
274#define COPY(len) memset(dest,0,sizeof(dest_aligned_block)); pRtlMoveMemory(dest, src, len)
275#define CMP(str) ok(strcmp(dest,str) == 0, "Expected '%s', got '%s'\n", str, dest)
281 win_skip(
"RtlMoveMemory is not available\n");
301 CMP(
"his is a test!!");
303 CMP(
"TThis is a test!");
306#define FILL(len) memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemory(dest,len,'x')
312 win_skip(
"RtlFillMemory is not available\n");
319 FILL(0);
CMP(
"This is a test!");
320 FILL(1);
CMP(
"xhis is a test!");
321 FILL(2);
CMP(
"xxis is a test!");
322 FILL(3);
CMP(
"xxxs is a test!");
323 FILL(4);
CMP(
"xxxx is a test!");
324 FILL(5);
CMP(
"xxxxxis a test!");
325 FILL(6);
CMP(
"xxxxxxs a test!");
326 FILL(7);
CMP(
"xxxxxxx a test!");
327 FILL(8);
CMP(
"xxxxxxxxa test!");
328 FILL(9);
CMP(
"xxxxxxxxx test!");
331#define LFILL(len) memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemoryUlong(dest,len,val)
335 ULONG val = (
'x' << 24) | (
'x' << 16) | (
'x' << 8) |
'x';
336 if (!pRtlFillMemoryUlong)
338 win_skip(
"RtlFillMemoryUlong is not available\n");
357#define ZERO(len) memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlZeroMemory(dest,len)
358#define MCMP(str) ok(memcmp(dest,str,LEN) == 0, "Memcmp failed\n")
364 win_skip(
"RtlZeroMemory is not available\n");
372 ZERO(3);
MCMP(
"\0\0\0s is a test!");
373 ZERO(4);
MCMP(
"\0\0\0\0 is a test!");
374 ZERO(5);
MCMP(
"\0\0\0\0\0is a test!");
375 ZERO(6);
MCMP(
"\0\0\0\0\0\0s a test!");
376 ZERO(7);
MCMP(
"\0\0\0\0\0\0\0 a test!");
377 ZERO(8);
MCMP(
"\0\0\0\0\0\0\0\0a test!");
378 ZERO(9);
MCMP(
"\0\0\0\0\0\0\0\0\0 test!");
385 if ( !pRtlUlonglongByteSwap )
387 win_skip(
"RtlUlonglongByteSwap is not available\n");
391 if ( pRtlUlonglongByteSwap( 0 ) != 0 )
393 win_skip(
"Broken RtlUlonglongByteSwap in win2k\n");
397 result = pRtlUlonglongByteSwap( ((
ULONGLONG)0x76543210 << 32) | 0x87654321 );
399 "RtlUlonglongByteSwap(0x7654321087654321) returns 0x%s, expected 0x2143658710325476\n",
414 win_skip(
"RtlUniform is not available\n");
438 result = pRtlUniform(&seed);
440 "RtlUniform(&seed (seed == 0)) returns %x, expected %x\n",
458 expected = seed * 0xffffffed + 0x7fffffc3 + 1;
459 result = pRtlUniform(&seed);
461 "RtlUniform(&seed (seed == 1)) returns %x, expected %x\n",
467 expected = seed * 0xffffffed + 0x7fffffc3;
468 result = pRtlUniform(&seed);
475 if (
result == 0x7fffff9f) {
476 skip(
"Most likely running on Windows Vista which uses a different algorithm\n");
481 "RtlUniform(&seed (seed == 2)) returns %x, expected %x\n",
488 expected = seed * 0xffffffed + 0x7fffffc3 + (seed & 1);
489 result = pRtlUniform(&seed);
491 "RtlUniform(&seed (seed == 3)) returns %x, expected %x\n",
495 expected = seed * 0xffffffed + 0x7fffffc3;
496 result = pRtlUniform(&seed);
498 "RtlUniform(&seed (seed == 0x6bca1aa)) returns %x, expected %x\n",
502 expected = seed * 0xffffffed + 0x7fffffc3 + 1;
503 result = pRtlUniform(&seed);
505 "RtlUniform(&seed (seed == 0x6bca1ab)) returns %x, expected %x\n",
511 expected = seed * 0xffffffed + 0x7fffffc3 + 2;
512 result = pRtlUniform(&seed);
514 "RtlUniform(&seed (seed == 0x6bca1ac)) returns %x, expected %x\n",
524 result = pRtlUniform(&seed);
526 "RtlUniform(&seed (seed == 0x6bca1ad)) returns %x, expected %x\n",
531 result = pRtlUniform(&seed);
533 "RtlUniform(&seed (seed == 0x6bca1ae)) returns %x, expected %x\n",
552 expected = seed * 0xffffffed + 0x7fffffc3;
553 if (seed < 0x6bca1ac) {
555 }
else if (seed == 0x6bca1ac) {
557 }
else if (seed < 0xd79435c) {
559 }
else if (seed < 0x1435e50b) {
561 }
else if (seed < 0x1af286ba) {
563 }
else if (seed < 0x21af2869) {
565 }
else if (seed < 0x286bca18) {
567 }
else if (seed < 0x2f286bc7) {
569 }
else if (seed < 0x35e50d77) {
571 }
else if (seed < 0x3ca1af26) {
573 }
else if (seed < 0x435e50d5) {
575 }
else if (seed < 0x4a1af284) {
577 }
else if (seed < 0x50d79433) {
579 }
else if (seed < 0x579435e2) {
581 }
else if (seed < 0x5e50d792) {
583 }
else if (seed < 0x650d7941) {
585 }
else if (seed < 0x6bca1af0) {
587 }
else if (seed < 0x7286bc9f) {
589 }
else if (seed < 0x79435e4e) {
591 }
else if (seed < 0x7ffffffd) {
593 }
else if (seed < 0x86bca1ac) {
595 }
else if (seed == 0x86bca1ac) {
597 }
else if (seed < 0x8d79435c) {
599 }
else if (seed < 0x9435e50b) {
601 }
else if (seed < 0x9af286ba) {
603 }
else if (seed < 0xa1af2869) {
605 }
else if (seed < 0xa86bca18) {
607 }
else if (seed < 0xaf286bc7) {
609 }
else if (seed == 0xaf286bc7) {
611 }
else if (seed < 0xb5e50d77) {
613 }
else if (seed < 0xbca1af26) {
615 }
else if (seed < 0xc35e50d5) {
617 }
else if (seed < 0xca1af284) {
619 }
else if (seed < 0xd0d79433) {
621 }
else if (seed < 0xd79435e2) {
623 }
else if (seed < 0xde50d792) {
625 }
else if (seed < 0xe50d7941) {
627 }
else if (seed < 0xebca1af0) {
629 }
else if (seed < 0xf286bc9f) {
631 }
else if (seed < 0xf9435e4e) {
633 }
else if (seed < 0xfffffffd) {
639 result = pRtlUniform(&seed);
641 "test: 0x%s RtlUniform(&seed (seed == %x)) returns %x, expected %x\n",
644 "test: 0x%s RtlUniform(&seed (seed == %x)) sets seed to %x, expected %x\n",
684 expected = (seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff;
686 result = pRtlUniform(&seed);
688 "test: 0x%s RtlUniform(&seed (seed == %x)) returns %x, expected %x\n",
691 "test: 0x%s RtlUniform(&seed (seed == %x)) sets seed to %x, expected %x\n",
710 win_skip(
"RtlRandom is not available\n");
715 for (
i = 0;
i <
sizeof(
res) /
sizeof(
res[0]);
i++)
717 res[
i] = pRtlRandom(&seed);
718 ok(seed !=
res[
i],
"%i: seed is same as res %x\n",
i, seed);
719 for (
j = 0;
j <
i;
j++)
732 {0xFEDCBA76, 0xFEDCBA76, 1},
733 {0x00000000, 0xFEDCBA76, 0},
734 {0xFEDCBA76, 0x00000000, 1},
735 {0x00000000, 0x00000000, 1},
736 {0xFEDCBA76, 0xFEDCBA70, 1},
737 {0xFEDCBA70, 0xFEDCBA76, 0},
738 {0xFEDCBA76, 0xFEDC8A76, 1},
739 {0xFEDC8A76, 0xFEDCBA76, 0},
740 {0xFEDCBA76, 0xC8C4B242, 1},
741 {0xC8C4B242, 0xFEDCBA76, 0},
743#define NB_ALL_ACCESSES (sizeof(all_accesses)/sizeof(*all_accesses))
748 unsigned int test_num;
751 if (!pRtlAreAllAccessesGranted)
753 win_skip(
"RtlAreAllAccessesGranted is not available\n");
761 "(test %d): RtlAreAllAccessesGranted(%08x, %08x) returns %d, expected %d\n",
776 {0xFEDCBA76, 0xFEDCBA76, 1},
777 {0x00000000, 0xFEDCBA76, 0},
778 {0xFEDCBA76, 0x00000000, 0},
779 {0x00000000, 0x00000000, 0},
780 {0xFEDCBA76, 0x01234589, 0},
781 {0x00040000, 0xFEDCBA76, 1},
782 {0x00040000, 0xFED8BA76, 0},
783 {0xFEDCBA76, 0x00040000, 1},
784 {0xFED8BA76, 0x00040000, 0},
786#define NB_ANY_ACCESSES (sizeof(any_accesses)/sizeof(*any_accesses))
791 unsigned int test_num;
794 if (!pRtlAreAnyAccessesGranted)
796 win_skip(
"RtlAreAnyAccessesGranted is not available\n");
804 "(test %d): RtlAreAnyAccessesGranted(%08x, %08x) returns %d, expected %d\n",
815 if (!pRtlComputeCrc32)
817 win_skip(
"RtlComputeCrc32 is not available\n");
821 crc = pRtlComputeCrc32(crc, (
const BYTE *)
src,
LEN);
822 ok(crc == 0x40861dc2,
"Expected 0x40861dc2, got %8x\n", crc);
835 *AllocatedBit = *AllocatedBit | 1;
846 if (!pRtlInitializeHandleTable)
848 win_skip(
"RtlInitializeHandleTable is not available\n");
854 ok(MyHandle !=
NULL,
"RtlAllocateHandle failed\n");
858 ok(
result,
"Handle %p wasn't valid\n", MyHandle);
860 ok(
result,
"Couldn't free handle %p\n", MyHandle);
871 if (!pRtlAllocateAndInitializeSid)
873 win_skip(
"RtlAllocateAndInitializeSid is not available\n");
877 ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
878 ok(!
ret,
"RtlAllocateAndInitializeSid error %08x\n",
ret);
879 ret = pRtlFreeSid(psid);
880 ok(!
ret,
"RtlFreeSid error %08x\n",
ret);
885 pRtlAllocateAndInitializeSid(
NULL, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
886 pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8,
NULL);
889 ret = pRtlAllocateAndInitializeSid(&sia, 9, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
897 if (!pRtlDeleteTimer)
899 win_skip(
"RtlDeleteTimer is not available\n");
906 "expected STATUS_INVALID_PARAMETER_1 or STATUS_INVALID_PARAMETER, got %x\n",
ret);
916 if (!pRtlGetThreadErrorMode || !pRtlSetThreadErrorMode)
918 win_skip(
"RtlGetThreadErrorMode and/or RtlSetThreadErrorMode not available\n");
925 oldmode = pRtlGetThreadErrorMode();
930 "RtlSetThreadErrorMode failed with error 0x%08x\n",
status);
932 "RtlSetThreadErrorMode returned mode 0x%x, expected 0x%x\n",
934 ok(pRtlGetThreadErrorMode() == 0x70,
935 "RtlGetThreadErrorMode returned 0x%x, expected 0x%x\n",
mode, 0x70);
939 "The TEB contains 0x%x, expected 0x%x\n",
946 "RtlSetThreadErrorMode failed with error 0x%08x\n",
status);
948 "RtlSetThreadErrorMode returned mode 0x%x, expected 0x%x\n",
950 ok(pRtlGetThreadErrorMode() == 0,
951 "RtlGetThreadErrorMode returned 0x%x, expected 0x%x\n",
mode, 0);
955 "The TEB contains 0x%x, expected 0x%x\n",
965 "RtlSetThreadErrorMode(%x,NULL) failed with error 0x%08x\n",
969 "RtlSetThreadErrorMode(%x,NULL) returns 0x%08x, "
970 "expected STATUS_INVALID_PARAMETER_1\n",
974 pRtlSetThreadErrorMode(oldmode,
NULL);
985 win_skip(
"LdrProcessRelocationBlock not available\n");
992 ok((
USHORT*)
ret == &reloc+1,
"ret = %p, expected %p\n",
ret, &reloc+1);
993 ok(addr32 == 0x550055,
"addr32 = %x, expected 0x550055\n", addr32);
998 ok((
USHORT*)
ret == &reloc+1,
"ret = %p, expected %p\n",
ret, &reloc+1);
999 ok(addr16 == 0x555,
"addr16 = %x, expected 0x555\n", addr16);
1004 ok((
USHORT*)
ret == &reloc+1,
"ret = %p, expected %p\n",
ret, &reloc+1);
1005 ok(addr16 == 0x565,
"addr16 = %x, expected 0x565\n", addr16);
1017 win_skip(
"RtlIpv4AddressToStringA not available\n");
1021 ip.S_un.S_un_b.s_b1 = 1;
1022 ip.S_un.S_un_b.s_b2 = 2;
1023 ip.S_un.S_un_b.s_b3 = 3;
1024 ip.S_un.S_un_b.s_b4 = 4;
1033 ok( (
res == (
char *)~0) ||
1035 "got %p (expected ~0)\n",
res);
1054 CHAR ip_1234[] =
"1.2.3.4";
1055 CHAR ip_1234_80[] =
"1.2.3.4:80";
1064 if (!pRtlIpv4AddressToStringExA)
1066 win_skip(
"RtlIpv4AddressToStringExA not available\n");
1070 ip.S_un.S_un_b.s_b1 = 1;
1071 ip.S_un.S_un_b.s_b2 = 2;
1072 ip.S_un.S_un_b.s_b3 = 3;
1073 ip.S_un.S_un_b.s_b4 = 4;
1100 "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1108 "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1138 "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1146 "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1155 "got 0x%x with '%s' (expected STATUS_INVALID_PARAMETER)\n",
res,
buffer);
1160 "got 0x%x and size %d (expected STATUS_INVALID_PARAMETER)\n",
res,
size);
1167 "got 0x%x and size %d with '%s' (expected STATUS_INVALID_PARAMETER)\n",
1177 enum { normal_4, strict_diff_4 = 1, ex_fail_4 = 2 }
flags;
1187 {
"255.255.255.255",
STATUS_SUCCESS, 15, { 255, 255, 255, 255 } },
1188 {
"255.255.255.255:123",
STATUS_SUCCESS, 15, { 255, 255, 255, 255 } },
1194 {
"1.1.1.0xaA",
STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, strict_diff_4,
1196 {
"1.1.1.0XaA",
STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, strict_diff_4,
1199 {
"1.1.1.0xff",
STATUS_SUCCESS, 10, { 1, 1, 1, 255 }, strict_diff_4,
1214 {
"1.1.1.008",
STATUS_SUCCESS, 8, { 1, 1, 1, 0 }, strict_diff_4 | ex_fail_4,
1223 {
"203569230",
STATUS_SUCCESS, 9, { 12, 34, 56, 78 }, strict_diff_4,
1225 {
"1.223756",
STATUS_SUCCESS, 8, { 1, 3, 106, 12 }, strict_diff_4,
1254 if (!
src ||
src[0] == -1)
1256 addr->S_un.S_addr = 0xabababab;
1260 addr->S_un.S_un_b.s_b1 =
src[0];
1261 addr->S_un.S_un_b.s_b2 =
src[1];
1262 addr->S_un.S_un_b.s_b3 =
src[2];
1263 addr->S_un.S_un_b.s_b4 =
src[3];
1275 if (!pRtlIpv4StringToAddressA)
1277 skip(
"RtlIpv4StringToAddress not available\n");
1286 res = pRtlIpv4StringToAddressA(
"1.1.1.1",
FALSE, &terminator,
NULL);
1298 terminator = &
dummy;
1299 ip.S_un.S_addr = 0xabababab;
1302 "[%s] res = 0x%08x, expected 0x%08x\n",
1305 "[%s] terminator = %p, expected %p\n",
1310 "[%s] ip = %08x, expected %08x\n",
1323 terminator = &
dummy;
1324 ip.S_un.S_addr = 0xabababab;
1327 "[%s] res = 0x%08x, expected 0x%08x\n",
1330 "[%s] terminator = %p, expected %p\n",
1335 "[%s] ip = %08x, expected %08x\n",
1372 const unsigned int ipv4_ex_testcount =
sizeof(ipv4_ex_tests) /
sizeof(ipv4_ex_tests[0]);
1376 if (!pRtlIpv4StringToAddressExA)
1378 skip(
"RtlIpv4StringToAddressEx not available\n");
1383 ip.S_un.S_addr = 0xabababab;
1388 ok(
ip.S_un.S_addr == 0xabababab,
"RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n",
ip.S_un.S_addr);
1389 ok(
port == 0xdead,
"RtlIpv4StringToAddressExA should not touch the port!, port == %x\n",
port);
1395 ok(
port == 0xdead,
"RtlIpv4StringToAddressExA should not touch the port!, port == %x\n",
port);
1397 ip.S_un.S_addr = 0xabababab;
1402 ok(
ip.S_un.S_addr == 0xabababab,
"RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n",
ip.S_un.S_addr);
1403 ok(
port == 0xdead,
"RtlIpv4StringToAddressExA should not touch the port!, port == %x\n",
port);
1412 ip.S_un.S_addr = 0xabababab;
1414 ok(
res == expect_res,
"[%s] res = 0x%08x, expected 0x%08x\n",
1418 ok(
ip.S_un.S_addr == expected_ip.
S_un.
S_addr,
"[%s] ip = %08x, expected %08x\n",
1433 ip.S_un.S_addr = 0xabababab;
1435 ok(
res == expect_res,
"[%s] res = 0x%08x, expected 0x%08x\n",
1439 ok(
ip.S_un.S_addr == expected_ip.
S_un.
S_addr,
"[%s] ip = %08x, expected %08x\n",
1444 for (
i = 0;
i < ipv4_ex_testcount;
i++)
1449 ip.S_un.S_addr = 0xabababab;
1452 ok(
res == ipv4_ex_tests[
i].
res,
"[%s] res = 0x%08x, expected 0x%08x\n",
1456 ok(
ip.S_un.S_addr == expected_ip.
S_un.
S_addr,
"[%s] ip = %08x, expected %08x\n",
1457 ipv4_ex_tests[
i].address,
ip.S_un.S_addr, expected_ip.
S_un.
S_addr);
1458 ok(
port == ipv4_ex_tests[
i].
port,
"[%s] port = %u, expected %u\n",
1474 enum { normal_6, win_broken_6 = 1, ex_fail_6 = 2, ex_skip_6 = 4 }
flags;
1478 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1480 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1482 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1484 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1486 { 0, 0, 0, 0, 0, 0, 0, 0 }, win_broken_6 },
1488 { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1490 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1492 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1494 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
1496 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1498 { 0, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 } },
1500 { 0x8010, 0, 0, 0, 0x800, 0x8, 0x0c20, 0x7a41 } },
1502 { 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00, 0xf00, 0 }, win_broken_6 },
1503 {
"1111:2222:3333:4444:5555:6666:123.123.123.123",
STATUS_SUCCESS, 45,
1504 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1506 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1508 { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } },
1510 { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } },
1512 { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } },
1514 { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } },
1516 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0 }, win_broken_6 },
1518 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0 } },
1520 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } },
1522 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } },
1523 {
"1111:2222:3333:4444:5555::123.123.123.123",
STATUS_SUCCESS, 41,
1524 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7b7b, 0x7b7b } },
1525 {
"1111:2222:3333:4444:5555::0x1.123.123.123",
STATUS_SUCCESS, 27,
1526 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x100 }, ex_fail_6 },
1528 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 },
1530 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 },
1532 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 }, ex_fail_6 },
1534 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 },
1536 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 }, ex_fail_6 },
1538 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } },
1540 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } },
1542 { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } },
1544 { 0x1111, 0x2222, 0x3333, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1546 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7777, 0x8888 } },
1548 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 } },
1550 { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1552 { 0x1111, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1553 {
"1111::3333:4444:5555:6666:123.123.123.123",
STATUS_SUCCESS, 41,
1554 { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1556 { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1558 { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1560 { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1562 { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1564 { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7777, 0x8888 } },
1566 { 0x1111, 0, 0, 0, 0, 0x6666, 0x7b7b, 0x7b7b } },
1568 { 0x1111, 0, 0, 0, 0, 0x6666, 0x7777, 0x8888 } },
1570 { 0x1111, 0, 0, 0, 0, 0, 0x7777, 0x8888 } },
1572 { 0x1111, 0, 0, 0, 0, 0, 0, 0x8888 } },
1574 { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x201, 0x403 } },
1576 { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800 } },
1578 { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0 } },
1580 { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0x800 } },
1582 { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
1584 { 0x120, 0, 0x3641, 0x78e3, 0x80, 0xbf63, 0xff3f, 0xd2fd } },
1586 { 0x120, 0xb80d, 0, 0, 0, 0, 0x2814, 0xab57 } },
1588 { 0x120, 0xb80d, 0x3412, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1590 { 0x120, 0, 0x49ce, 0x176, 0xad2c, 0xffdf, 0x947c, 0xfeff } },
1592 { 0x120, 0xb80d, 0xa385, 0, 0, 0x2e8a, 0x7003, 0x3473 } },
1594 { 0xfe3f, 0xb, 0, 0, 0x100, 0, 0, 0xa00 } },
1596 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1598 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1600 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1602 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1604 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1606 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1608 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1610 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1612 { 0, 0, 0, 0, 0, 0, 0, 0 } },
1616 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1618 { 0, 0, 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00 }, ex_fail_6 },
1620 { 0, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1622 { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1631 { 0x120, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1633 { 0x120, 0, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1635 { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1637 { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1639 { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1647 { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1649 { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1651 { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1653 { 0x1111, 0x2222, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab } },
1655 { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1656 {
"1111:2222:3333:4444:5555:6666:7777:1.2.3.4",
STATUS_SUCCESS, 36,
1657 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 }, ex_fail_6 },
1658 {
"1111:2222:3333:4444:5555:6666:7777:8888:",
STATUS_SUCCESS, 39,
1659 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 },
1660 {
"1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4",
STATUS_SUCCESS, 39,
1661 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 },
1662 {
"1111:2222:3333:4444:5555:6666:7777:8888:9999",
STATUS_SUCCESS, 39,
1663 { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 },
1665 { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1667 { 0x1111, 0x5555, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1669 { 0x1111, 0, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777 }, ex_fail_6 },
1671 { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1673 { 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 }, ex_fail_6 },
1677 { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1679 { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1681 { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1683 { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1685 { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 }, ex_fail_6 },
1687 { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1689 { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1691 { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1693 { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1695 { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1697 { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 } },
1699 { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1701 { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1703 { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1705 { 0x100, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1707 { 0x100, 0, 0, 0, 0, 0, 0, 0x200 }, ex_fail_6 },
1709 { 0x120, 0, 0x3412, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
1710 {
"2001:0000:1234:0000:0000:C1C0:ABCD:0876 0",
STATUS_SUCCESS, 39,
1711 { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 }, ex_fail_6 },
1713 { 0x120, 0x100, 0x100, 0x100, 0x100, 0x100, 0xabab, 0xabab } },
1715 { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff }, ex_fail_6 },
1725 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1727 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1729 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1731 { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
1735 { -1 }, ex_skip_6 },
1742 if (!
src ||
src[0] == -1)
1744 for (
j = 0;
j < 8; ++
j)
1745 addr->s6_words[
j] = 0xabab;
1749 for (
j = 0;
j < 8; ++
j)
1767 {
"::13.1.68.3", { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1768 {
"::ffff:13.1.68.3", { 0, 0, 0, 0, 0, 0xffff, 0x10d, 0x344 } },
1769 {
"::feff:d01:4403", { 0, 0, 0, 0, 0, 0xfffe, 0x10d, 0x344 } },
1770 {
"::fffe:d01:4403", { 0, 0, 0, 0, 0, 0xfeff, 0x10d, 0x344 } },
1771 {
"::100:d01:4403", { 0, 0, 0, 0, 0, 1, 0x10d, 0x344 } },
1772 {
"::1:d01:4403", { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1773 {
"::ffff:0:4403", { 0, 0, 0, 0, 0, 0xffff, 0, 0x344 } },
1774 {
"::ffff:13.1.0.0", { 0, 0, 0, 0, 0, 0xffff, 0x10d, 0 } },
1775 {
"::ffff:0:0", { 0, 0, 0, 0, 0, 0xffff, 0, 0 } },
1776 {
"::ffff:0:13.1.68.3", { 0, 0, 0, 0, 0xffff, 0, 0x10d, 0x344 } },
1777 {
"::ffff:ffff:d01:4403", { 0, 0, 0, 0, 0xffff, 0xffff, 0x10d, 0x344 } },
1778 {
"::ffff:0:0:d01:4403", { 0, 0, 0, 0xffff, 0, 0, 0x10d, 0x344 } },
1779 {
"::ffff:255.255.255.255", { 0, 0, 0, 0, 0, 0xffff, 0xffff, 0xffff } },
1780 {
"::ffff:129.144.52.38", { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
1781 {
"::5efe:129.144.52.38", { 0, 0, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1782 {
"1111:2222:3333:4444:0:5efe:129.144.52.38", { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1783 {
"1111:2222:3333::5efe:129.144.52.38", { 0x1111, 0x2222, 0x3333, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1784 {
"1111:2222::5efe:129.144.52.38", { 0x1111, 0x2222, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1785 {
"1111::5efe:129.144.52.38", { 0x1111, 0, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1786 {
"::200:5efe:129.144.52.38", { 0, 0, 0, 0, 2, 0xfe5e, 0x9081, 0x2634 } },
1787 {
"::100:5efe:8190:3426", { 0, 0, 0, 0, 1, 0xfe5e, 0x9081, 0x2634 } },
1789 {
"::1", { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1790 {
"0:1:2:3:4:5:6:7", { 0, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 } },
1791 {
"1080::8:800:200c:417a", { 0x8010, 0, 0, 0, 0x800, 0x8, 0x0c20, 0x7a41 } },
1792 {
"1111:2222:3333:4444:5555:6666:7b7b:7b7b", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1793 {
"1111:2222:3333:4444:5555:6666:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1794 {
"1111:2222:3333:4444:5555:6666::", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0 } },
1795 {
"1111:2222:3333:4444:5555:6666:0:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } },
1796 {
"1111:2222:3333:4444:5555::", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } },
1797 {
"1111:2222:3333:4444:5555:0:7b7b:7b7b", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7b7b, 0x7b7b } },
1798 {
"1111:2222:3333:4444:5555:0:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7777, 0x8888 } },
1799 {
"1111:2222:3333:4444:5555::8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 } },
1800 {
"1111::", { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1801 {
"1111::7b7b:7b7b", { 0x1111, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1802 {
"1111:0:3333:4444:5555:6666:7b7b:7b7b", { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1803 {
"1111:0:3333:4444:5555:6666:7777:8888", { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1804 {
"1111::4444:5555:6666:7b7b:7b7b", { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1805 {
"1111::4444:5555:6666:7777:8888", { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1806 {
"1111::5555:6666:7b7b:7b7b", { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1807 {
"1111::5555:6666:7777:8888", { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7777, 0x8888 } },
1808 {
"1111::6666:7b7b:7b7b", { 0x1111, 0, 0, 0, 0, 0x6666, 0x7b7b, 0x7b7b } },
1809 {
"1111::6666:7777:8888", { 0x1111, 0, 0, 0, 0, 0x6666, 0x7777, 0x8888 } },
1810 {
"1111::7777:8888", { 0x1111, 0, 0, 0, 0, 0, 0x7777, 0x8888 } },
1811 {
"1111::8888", { 0x1111, 0, 0, 0, 0, 0, 0, 0x8888 } },
1812 {
"1:2:3:4:5:6:102:304", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x201, 0x403 } },
1813 {
"1:2:3:4:5:6:7:8", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800 } },
1814 {
"1:2:3:4:5:6::", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0 } },
1815 {
"1:2:3:4:5:6:0:8", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0x800 } },
1816 {
"2001:0:1234::c1c0:abcd:876", { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
1817 {
"2001:0:4136:e378:8000:63bf:3fff:fdd2", { 0x120, 0, 0x3641, 0x78e3, 0x80, 0xbf63, 0xff3f, 0xd2fd } },
1818 {
"2001:db8::1428:57ab", { 0x120, 0xb80d, 0, 0, 0, 0, 0x2814, 0xab57 } },
1819 {
"2001:db8:1234:ffff:ffff:ffff:ffff:ffff", { 0x120, 0xb80d, 0x3412, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1820 {
"2001:0:ce49:7601:2cad:dfff:7c94:fffe", { 0x120, 0, 0x49ce, 0x176, 0xad2c, 0xffdf, 0x947c, 0xfeff } },
1821 {
"2001:db8:85a3::8a2e:370:7334", { 0x120, 0xb80d, 0xa385, 0, 0, 0x2e8a, 0x7003, 0x3473 } },
1822 {
"3ffe:b00::1:0:0:a", { 0xfe3f, 0xb, 0, 0, 0x100, 0, 0, 0xa00 } },
1823 {
"::a:b:c:d:e", { 0, 0, 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00 } },
1824 {
"::123.123.123.123", { 0, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1825 {
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1826 {
"1111:2222:3333:4444:5555:6666:7777:1", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 } },
1827 {
"1111:2222:3333:4444:5555:6666:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1828 {
"1111:2222::", { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 } },
1829 {
"1111::3333:4444:5555:6666:7777", { 0x1111, 0, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777 } },
1830 {
"1111:2222::", { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 } },
1831 {
"1111::3333", { 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 } },
1832 {
"2001:0:1234::c1c0:abcd:876", { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
1833 {
"2001::ffd3", { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1835 const size_t testcount =
sizeof(
tests) /
sizeof(
tests[0]);
1840 skip(
"RtlIpv6AddressToStringA not available\n");
1857 for (
i = 0;
i < testcount;
i++)
1869 "expected data at buffer[45] to always be NULL\n");
1870 ok(
buffer[46] ==
'#',
"expected data at buffer[46] not to change\n");
1889 {
"::13.1.68.3", 0, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1890 {
"::13.1.68.3%1", 1, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1891 {
"::13.1.68.3%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1892 {
"[::13.1.68.3%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1893 {
"[::13.1.68.3%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1894 {
"[::13.1.68.3]:256", 0, 1, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1896 {
"::1:d01:4403", 0, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1897 {
"::1:d01:4403%1", 1, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1898 {
"::1:d01:4403%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1899 {
"[::1:d01:4403%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1900 {
"[::1:d01:4403%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1901 {
"[::1:d01:4403]:256", 0, 1, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1903 {
"1111:2222:3333:4444:0:5efe:129.144.52.38", 0, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1904 {
"1111:2222:3333:4444:0:5efe:129.144.52.38%1", 1, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1905 {
"1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819", 0xffffbbbb, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1906 {
"[1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819]:65518",0xffffbbbb, 0xeeff, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1907 {
"[1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1908 {
"[1111:2222:3333:4444:0:5efe:129.144.52.38]:256", 0, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1910 {
"::1", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1911 {
"::1%1", 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1912 {
"::1%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1913 {
"[::1%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1914 {
"[::1%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1915 {
"[::1]:256", 0, 1, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1917 {
"1111:2222:3333:4444:5555:6666:7b7b:7b7b", 0, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1918 {
"1111:2222:3333:4444:5555:6666:7b7b:7b7b%1", 1, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1919 {
"1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819", 0xffffbbbb, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1920 {
"[1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1921 {
"[1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1922 {
"[1111:2222:3333:4444:5555:6666:7b7b:7b7b]:256", 0, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1924 {
"1111::", 0, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1925 {
"1111::%1", 1, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1926 {
"1111::%4294949819", 0xffffbbbb, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1927 {
"[1111::%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1928 {
"[1111::%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1929 {
"[1111::]:256", 0, 1, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1931 {
"2001::ffd3", 0, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1932 {
"2001::ffd3%1", 1, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1933 {
"2001::ffd3%4294949819", 0xffffbbbb, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1934 {
"[2001::ffd3%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1935 {
"[2001::ffd3%4294949819]:256", 0xffffbbbb, 1, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1936 {
"[2001::ffd3]:256", 0, 1, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1938 const size_t testcount =
sizeof(
tests) /
sizeof(
tests[0]);
1941 if (!pRtlIpv6AddressToStringExA)
1943 skip(
"RtlIpv6AddressToStringExA not available\n");
1955 "got len %d with '%s' (expected 3 with '::')\n",
len,
buffer);
1965 res = pRtlIpv6AddressToStringExA(&
ip, 0, 0,
NULL, &
len);
1976 ok(
buffer[0] ==
'#',
"got first char %c (expected '#')\n",
buffer[0]);
1977 ok(
len == 3,
"got len %d (expected len 3)\n",
len);
1979 for (
i = 0;
i < testcount;
i++)
2002 if (!pRtlIpv6StringToAddressW)
2008 terminator = (
void *)0xdeadbeef;
2009 res = pRtlIpv6StringToAddressW(
name, &terminator, &
ip);
2010 ok(
res == res_a,
"[W:%s] res = 0x%08x, expected 0x%08x\n", name_a,
res, res_a);
2012 if (terminator_offset_a < 0)
2014 ok(terminator == (
void *)0xdeadbeef,
2015 "[W:%s] terminator = %p, expected it not to change\n",
2016 name_a, terminator);
2020 ok(terminator ==
name + terminator_offset_a,
2021 "[W:%s] terminator = %p, expected %p\n",
2022 name_a, terminator,
name + terminator_offset_a);
2026 "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2028 ip.s6_words[0],
ip.s6_words[1],
ip.s6_words[2],
ip.s6_words[3],
2029 ip.s6_words[4],
ip.s6_words[5],
ip.s6_words[6],
ip.s6_words[7],
2030 addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3],
2031 addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]);
2041 if (!pRtlIpv6StringToAddressW)
2043 skip(
"RtlIpv6StringToAddressW not available\n");
2047 if (!pRtlIpv6StringToAddressA)
2049 skip(
"RtlIpv6StringToAddressA not available\n");
2053 res = pRtlIpv6StringToAddressA(
"::", &terminator, &
ip);
2058 res = pRtlIpv6StringToAddressA(
NULL, &terminator, &
ip);
2060 res = pRtlIpv6StringToAddressA(
"::",
NULL, &
ip);
2062 res = pRtlIpv6StringToAddressA(
"::", &terminator,
NULL);
2067 ok(
sizeof(
ip) ==
sizeof(
USHORT)* 8,
"sizeof(ip)\n");
2072 terminator = (
void *)0xdeadbeef;
2080 "[%s] res = 0x%08x, expected 0x%08x\n",
2089 "[%s] res = 0x%08x, expected 0x%08x\n",
2095 ok(terminator == (
void *)0xdeadbeef,
2096 "[%s] terminator = %p, expected it not to change\n",
2103 "[%s] terminator = %p, expected %p\n",
2109 "[%s] terminator = %p, expected %p\n",
2115 "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2117 ip.s6_words[0],
ip.s6_words[1],
ip.s6_words[2],
ip.s6_words[3],
2118 ip.s6_words[4],
ip.s6_words[5],
ip.s6_words[6],
ip.s6_words[7],
2119 expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3],
2120 expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]);
2129 ULONG scope = 0xbadf00d;
2132 if (!pRtlIpv6StringToAddressExW)
2140 ok(
res == res_a,
"[W:%s] res = 0x%08x, expected 0x%08x\n", name_a,
res, res_a);
2141 ok(scope == scope_a,
"[W:%s] scope = 0x%08x, expected 0x%08x\n", name_a, scope, scope_a);
2142 ok(
port == port_a,
"[W:%s] port = 0x%08x, expected 0x%08x\n", name_a,
port, port_a);
2145 "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2147 ip.s6_words[0],
ip.s6_words[1],
ip.s6_words[2],
ip.s6_words[3],
2148 ip.s6_words[4],
ip.s6_words[5],
ip.s6_words[6],
ip.s6_words[7],
2149 addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3],
2150 addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]);
2169 { 0, 0, 0, 0, 0, 0, 0, 0 } },
2171 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2173 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2175 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2177 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2179 { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2180 {
"[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80",
STATUS_SUCCESS, 0, 0x5000,
2181 { 0xdcfe, 0x98ba, 0x5476, 0x1032, 0xdcfe, 0x98ba, 0x5476, 0x1032 } },
2182 {
"[1080:0:0:0:8:800:200C:417A]:1234",
STATUS_SUCCESS, 0, 0xd204,
2183 { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2185 { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } },
2189 { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } },
2191 { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } },
2193 { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2195 { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2197 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
2199 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
2201 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
2203 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
2205 { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
2209 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2210 {
"[ff01::8:800:200C:417A%100]:8080",
STATUS_SUCCESS, 100, 0x901f,
2211 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2212 {
"[ff01::8:800:200C:417A%1000]:8080",
STATUS_SUCCESS, 1000, 0x901f,
2213 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2214 {
"[ff01::8:800:200C:417A%10000]:8080",
STATUS_SUCCESS, 10000, 0x901f,
2215 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2216 {
"[ff01::8:800:200C:417A%1000000]:8080",
STATUS_SUCCESS, 1000000, 0x901f,
2217 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2218 {
"[ff01::8:800:200C:417A%4294967295]:8080",
STATUS_SUCCESS, 0xffffffff, 0x901f,
2219 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2221 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2223 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2225 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2227 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2229 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2231 { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2233 const unsigned int ipv6_ex_testcount =
sizeof(ipv6_ex_tests) /
sizeof(ipv6_ex_tests[0]);
2234 const char *simple_ip =
"::";
2237 if (!pRtlIpv6StringToAddressExW)
2239 skip(
"RtlIpv6StringToAddressExW not available\n");
2243 if (!pRtlIpv6StringToAddressExA)
2245 skip(
"RtlIpv6StringToAddressExA not available\n");
2249 res = pRtlIpv6StringToAddressExA(simple_ip, &
ip, &scope, &
port);
2258 "[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n",
res);
2259 ok(scope == 0xbadf00d,
"[null string] scope = 0x%08x, expected 0xbadf00d\n", scope);
2260 ok(
port == 0xbeef,
"[null string] port = 0x%08x, expected 0xbeef\n",
port);
2262 "[null string] ip is changed, expected it not to change\n");
2268 res = pRtlIpv6StringToAddressExA(simple_ip,
NULL, &scope, &
port);
2270 "[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n",
res);
2271 ok(scope == 0xbadf00d,
"[null result] scope = 0x%08x, expected 0xbadf00d\n", scope);
2272 ok(
port == 0xbeef,
"[null result] port = 0x%08x, expected 0xbeef\n",
port);
2274 "[null result] ip is changed, expected it not to change\n");
2279 res = pRtlIpv6StringToAddressExA(simple_ip, &
ip,
NULL, &
port);
2281 "[null scope] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n",
res);
2282 ok(scope == 0xbadf00d,
"[null scope] scope = 0x%08x, expected 0xbadf00d\n", scope);
2283 ok(
port == 0xbeef,
"[null scope] port = 0x%08x, expected 0xbeef\n",
port);
2285 "[null scope] ip is changed, expected it not to change\n");
2290 res = pRtlIpv6StringToAddressExA(simple_ip, &
ip, &scope,
NULL);
2292 "[null port] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n",
res);
2293 ok(scope == 0xbadf00d,
"[null port] scope = 0x%08x, expected 0xbadf00d\n", scope);
2294 ok(
port == 0xbeef,
"[null port] port = 0x%08x, expected 0xbeef\n",
port);
2296 "[null port] ip is changed, expected it not to change\n");
2299 ok(
sizeof(
ip) ==
sizeof(
USHORT)* 8,
"sizeof(ip)\n");
2304 ULONG scope = 0xbadf00d;
2318 ok(scope == 0xbadf00d,
"[%s] scope = 0x%08x, expected 0xbadf00d\n",
2320 ok(
port == 0xbeef,
"[%s] port = 0x%08x, expected 0xbeef\n",
2325 ok(scope != 0xbadf00d,
"[%s] scope = 0x%08x, not expected 0xbadf00d\n",
2327 ok(
port != 0xbeef,
"[%s] port = 0x%08x, not expected 0xbeef\n",
2341 ok(
res == expect_ret,
"[%s] res = 0x%08x, expected 0x%08x\n",
2347 if (
res == expect_ret)
2351 "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2353 ip.s6_words[0],
ip.s6_words[1],
ip.s6_words[2],
ip.s6_words[3],
2354 ip.s6_words[4],
ip.s6_words[5],
ip.s6_words[6],
ip.s6_words[7],
2355 expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3],
2356 expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]);
2361 for (
i = 0;
i < ipv6_ex_testcount;
i++)
2369 ok(
res == ipv6_ex_tests[
i].
res,
"[%s] res = 0x%08x, expected 0x%08x\n",
2371 ok(scope == ipv6_ex_tests[
i].scope,
"[%s] scope = 0x%08x, expected 0x%08x\n",
2372 ipv6_ex_tests[
i].
address, scope, ipv6_ex_tests[
i].scope);
2373 ok(
port == ipv6_ex_tests[
i].
port,
"[%s] port = 0x%08x, expected 0x%08x\n",
2378 "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2380 ip.s6_words[0],
ip.s6_words[1],
ip.s6_words[2],
ip.s6_words[3],
2381 ip.s6_words[4],
ip.s6_words[5],
ip.s6_words[6],
ip.s6_words[7],
2382 expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3],
2383 expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]);
2395 win_skip(
"LdrAddRefDll not supported\n" );
2448 if (!pLdrLockLoaderLock)
2450 win_skip(
"LdrLockLoaderLock() is not available\n");
2491 pLdrUnlockLoaderLock(0,
magic);
2496 ULONG compress_workspace, decompress_workspace;
2498 static UCHAR buf1[0x1000], buf2[0x1000];
2499 ULONG final_size, buf_size;
2503 if (!pRtlCompressBuffer || !pRtlDecompressBuffer || !pRtlGetCompressionWorkSpaceSize)
2505 win_skip(
"skipping RtlCompressBuffer tests, required functions not available\n");
2509 compress_workspace = decompress_workspace = 0xdeadbeef;
2511 &decompress_workspace);
2513 ok(compress_workspace != 0,
"got wrong compress_workspace %u\n", compress_workspace);
2518 final_size = 0xdeadbeef;
2520 buf1,
sizeof(buf1) - 1, 4096, &final_size, workspace);
2522 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2524 final_size = 0xdeadbeef;
2526 buf1,
sizeof(buf1) - 1, 4096, &final_size, workspace);
2528 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2530 final_size = 0xdeadbeef;
2532 buf1,
sizeof(buf1) - 1, 4096, &final_size, workspace);
2534 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2537 final_size = 0xdeadbeef;
2538 memset(buf1, 0x11,
sizeof(buf1));
2540 buf1,
sizeof(buf1), 4096, &final_size, workspace);
2542 ok((*(
WORD *)buf1 & 0x7000) == 0x3000,
"no chunk signature found %04x\n", *(
WORD *)buf1);
2544 ok(final_size <
sizeof(
test_buffer),
"got wrong final_size %u\n", final_size);
2547 buf_size = final_size;
2548 final_size = 0xdeadbeef;
2549 memset(buf2, 0x11,
sizeof(buf2));
2551 buf1, buf_size, &final_size);
2553 ok(final_size ==
sizeof(
test_buffer),
"got wrong final_size %u\n", final_size);
2555 ok(buf2[
sizeof(
test_buffer)] == 0x11,
"too many bytes written\n");
2558 final_size = 0xdeadbeef;
2559 memset(buf1, 0x11,
sizeof(buf1));
2561 buf1, 4, 4096, &final_size, workspace);
2569 ULONG compress_workspace, decompress_workspace;
2572 if (!pRtlGetCompressionWorkSpaceSize)
2574 win_skip(
"RtlGetCompressionWorkSpaceSize is not available\n");
2580 &decompress_workspace);
2584 &decompress_workspace);
2587 status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace);
2591 compress_workspace = decompress_workspace = 0xdeadbeef;
2593 &decompress_workspace);
2595 ok(compress_workspace != 0,
"got wrong compress_workspace %u\n", compress_workspace);
2596 ok(decompress_workspace == 0x1000,
"got wrong decompress_workspace %u\n", decompress_workspace);
2598 compress_workspace = decompress_workspace = 0xdeadbeef;
2600 &compress_workspace, &decompress_workspace);
2602 ok(compress_workspace != 0,
"got wrong compress_workspace %u\n", compress_workspace);
2603 ok(decompress_workspace == 0x1000,
"got wrong decompress_workspace %u\n", decompress_workspace);
2611 if (compressed_size <=
sizeof(
WORD))
2614 while (compressed_size >=
sizeof(
WORD))
2616 chunk_size = (*(
WORD *)compressed & 0xFFF) + 1;
2617 if (compressed_size <
sizeof(
WORD) + chunk_size)
2621 compressed +=
sizeof(
WORD) + chunk_size;
2622 compressed_size -=
sizeof(
WORD) + chunk_size;
2628#define DECOMPRESS_BROKEN_FRAGMENT 1
2629#define DECOMPRESS_BROKEN_TRUNCATED 2
2635 UCHAR compressed[32];
2636 ULONG compressed_size;
2639 ULONG uncompressed_size;
2646 {0x03, 0x30,
'W',
'i',
'n',
'e'},
2655 {0x07, 0x30,
'W',
'i',
'n',
'e',
'W',
'i',
'n',
'e'},
2664 {0x04, 0xB0, 0x00,
'W',
'i',
'n',
'e'},
2672 {0x08, 0xB0, 0x00,
'W',
'i',
'n',
'e',
'W',
'i',
'n',
'e'},
2680 {0x06, 0xB0, 0x10,
'W',
'i',
'n',
'e', 0x01, 0x30},
2689 {0x06, 0xB0, 0x10,
'W',
'i',
'n',
'e', 0x05, 0x30},
2698 {0x06, 0xB0, 0x30,
'W',
'i',
'n',
'e', 0x01, 0x30},
2707 {0x01, 0xB0, 0x02,
'W'},
2715 {0x03, 0x30,
'W',
'i',
'n',
'e', 0x00, 0x00, 0x03, 0x30,
'W',
'i',
'n',
'e'},
2724 {0x14, 0xB0, 0x00,
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
2725 0x00,
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
2729 "ABCDEFGHIJKLMNOPABCD",
2735 {0x15, 0xB0, 0x00,
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
2736 0x00,
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
2737 0x02,
'A', 0x00, 0x78},
2740 "ABCDEFGHIJKLMNOPABCD",
2746 {0x03, 0x20,
'W',
'i',
'n',
'e'},
2755 {0x04, 0xA0, 0x00,
'W',
'i',
'n',
'e'},
2763 {0x00, 0xB0, 0x02, 0x01},
2805 {0x06, 0xB0, 0x10,
'W',
'i',
'n',
'e', 0x05, 0x40},
2811 {0x05, 0xB0, 0x10,
'W',
'i',
'n',
'e', 0x05},
2817 {0x07, 0x30,
'W',
'i',
'n',
'e'},
2823 {0x08, 0xB0, 0x00,
'W',
'i',
'n',
'e'},
2829 {0x00, 0xB0, 0x02, 0x00, 0xB0},
2835 static UCHAR buf[0x2000], workspace[0x1000];
2840 if (!pRtlDecompressBuffer || !pRtlDecompressFragment)
2842 win_skip(
"RtlDecompressBuffer or RtlDecompressFragment is not available\n");
2847 final_size = 0xdeadbeef;
2849 test_lznt[0].compressed_size, &final_size);
2851 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2853 final_size = 0xdeadbeef;
2855 test_lznt[0].compressed_size, &final_size);
2857 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2859 final_size = 0xdeadbeef;
2860 status = pRtlDecompressBuffer(0xFF,
buf,
sizeof(
buf), test_lznt[0].compressed,
2861 test_lznt[0].compressed_size, &final_size);
2863 ok(final_size == 0xdeadbeef,
"got wrong final_size %u\n", final_size);
2866 for (
i = 0;
i <
sizeof(test_lznt) /
sizeof(test_lznt[0]);
i++)
2868 trace(
"Running test %d (compressed_size=%u, uncompressed_size=%u, status=0x%08x)\n",
2869 i, test_lznt[
i].compressed_size, test_lznt[
i].uncompressed_size, test_lznt[
i].
status);
2872 final_size = 0xdeadbeef;
2875 test_lznt[
i].compressed_size, &final_size);
2880 ok(final_size == test_lznt[
i].uncompressed_size,
2881 "%d: got wrong final_size %u\n",
i, final_size);
2883 "%d: got wrong decoded data\n",
i);
2884 ok(
buf[test_lznt[
i].uncompressed_size] == 0x11,
2885 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size);
2889 final_size = 0xdeadbeef;
2892 test_lznt[
i].compressed, test_lznt[
i].compressed_size, &final_size);
2897 ok(final_size == test_lznt[
i].uncompressed_size,
2898 "%d: got wrong final_size %u\n",
i, final_size);
2900 "%d: got wrong decoded data\n",
i);
2901 ok(
buf[test_lznt[
i].uncompressed_size] == 0x11,
2902 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size);
2906 if (test_lznt[
i].uncompressed_size > 0)
2908 final_size = 0xdeadbeef;
2911 test_lznt[
i].compressed, test_lznt[
i].compressed_size, &final_size);
2915 ok(final_size == test_lznt[
i].uncompressed_size,
2916 "%d: got wrong final_size %u\n",
i, final_size);
2918 "%d: got wrong decoded data\n",
i);
2919 ok(
buf[test_lznt[
i].uncompressed_size] == 0x11,
2920 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size);
2925 if (test_lznt[
i].uncompressed_size > 1)
2927 final_size = 0xdeadbeef;
2930 test_lznt[
i].compressed, test_lznt[
i].compressed_size, &final_size);
2938 ok(final_size == test_lznt[
i].uncompressed_size - 1,
2939 "%d: got wrong final_size %u\n",
i, final_size);
2941 "%d: got wrong decoded data\n",
i);
2942 ok(
buf[test_lznt[
i].uncompressed_size - 1] == 0x11,
2943 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size - 1);
2948 final_size = 0xdeadbeef;
2951 test_lznt[
i].compressed_size, &final_size);
2957 ok(final_size == 0,
"%d: got wrong final_size %u\n",
i, final_size);
2958 ok(
buf[0] == 0x11,
"%d: buf[0] was modified\n",
i);
2962 final_size = 0xdeadbeef;
2965 test_lznt[
i].compressed_size, 0, &final_size, workspace);
2973 ok(final_size == test_lznt[
i].uncompressed_size,
2974 "%d: got wrong final_size %u\n",
i, final_size);
2976 "%d: got wrong decoded data\n",
i);
2977 ok(
buf[test_lznt[
i].uncompressed_size] == 0x11,
2978 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size);
2982 final_size = 0xdeadbeef;
2985 test_lznt[
i].compressed_size, 1, &final_size, workspace);
2993 if (test_lznt[
i].uncompressed_size == 0)
2996 ok(final_size == 4095,
"%d: got wrong final_size %u\n",
i, final_size);
2998 ok(
buf[4095] == 0x11,
"%d: buf[4095] was modified\n",
i);
3002 ok(final_size == test_lznt[
i].uncompressed_size - 1,
3003 "%d: got wrong final_size %u\n",
i, final_size);
3005 "%d: got wrong decoded data\n",
i);
3006 ok(
buf[test_lznt[
i].uncompressed_size - 1] == 0x11,
3007 "%d: buf[%u] was modified\n",
i, test_lznt[
i].uncompressed_size - 1);
3012 final_size = 0xdeadbeef;
3015 test_lznt[
i].compressed_size, 4095, &final_size, workspace);
3024 ok(final_size == 1,
"%d: got wrong final_size %u\n",
i, final_size);
3026 ok(
buf[0] == 0,
"%d: padding is not zero\n",
i);
3027 ok(
buf[1] == 0x11,
"%d: buf[1] was modified\n",
i);
3031 final_size = 0xdeadbeef;
3034 test_lznt[
i].compressed_size, 4096, &final_size, workspace);
3037 ok(
status == expected_status,
"%d: got wrong status 0x%08x, expected 0x%08x\n",
i,
status, expected_status);
3040 ok(final_size == 0,
"%d: got wrong final_size %u\n",
i, final_size);
3041 ok(
buf[0] == 0x11,
"%d: buf[4096] was modified\n",
i);
3046#undef DECOMPRESS_BROKEN_FRAGMENT
3047#undef DECOMPRESS_BROKEN_TRUNCATED
3060 ret = pRtlIsCriticalSectionLocked(&
info->crit);
3062 ret = pRtlIsCriticalSectionLockedByThread(&
info->crit);
3069 ret = pRtlIsCriticalSectionLocked(&
info->crit);
3071 ret = pRtlIsCriticalSectionLockedByThread(&
info->crit);
3076 ret = pRtlIsCriticalSectionLocked(&
info->crit);
3078 ret = pRtlIsCriticalSectionLockedByThread(&
info->crit);
3095 if (!pRtlIsCriticalSectionLocked || !pRtlIsCriticalSectionLockedByThread)
3097 win_skip(
"skipping RtlIsCriticalSectionLocked tests, required functions not available\n");
3107 ret = pRtlIsCriticalSectionLocked(&
info.crit);
3109 ret = pRtlIsCriticalSectionLockedByThread(&
info.crit);
3114 ret = pRtlIsCriticalSectionLocked(&
info.crit);
3116 ret = pRtlIsCriticalSectionLockedByThread(&
info.crit);
3130 ret = pRtlIsCriticalSectionLocked(&
info.crit);
3132 ret = pRtlIsCriticalSectionLockedByThread(&
info.crit);
3150 if (!pRtlInitializeCriticalSectionEx)
3152 win_skip(
"RtlInitializeCriticalSectionEx is not available\n");
3157 pRtlInitializeCriticalSectionEx(&
cs, 0, 0);
3158 ok((
cs.DebugInfo !=
NULL &&
cs.DebugInfo != no_debug) ||
broken(
cs.DebugInfo == no_debug) ,
3159 "expected DebugInfo != NULL and DebugInfo != ~0, got %p\n",
cs.DebugInfo);
3160 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3161 ok(
cs.RecursionCount == 0,
"expected RecursionCount == 0, got %d\n",
cs.RecursionCount);
3162 ok(
cs.LockSemaphore ==
NULL,
"expected LockSemaphore == NULL, got %p\n",
cs.LockSemaphore);
3164 "expected SpinCount == 0, got %ld\n",
cs.SpinCount);
3170 ok(
cs.DebugInfo == no_debug,
"expected DebugInfo == ~0, got %p\n",
cs.DebugInfo);
3171 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3172 ok(
cs.RecursionCount == 0,
"expected RecursionCount == 0, got %d\n",
cs.RecursionCount);
3173 ok(
cs.LockSemaphore ==
NULL,
"expected LockSemaphore == NULL, got %p\n",
cs.LockSemaphore);
3175 "expected SpinCount == 0, got %ld\n",
cs.SpinCount);
3184 if (!pRtlInitializeCriticalSectionEx)
3188 ok(!
status,
"RtlInitializeCriticalSection failed: %x\n",
status);
3193 ok(
cs.LockCount == -2,
"expected LockCount == -2, got %d\n",
cs.LockCount);
3194 ok(
cs.RecursionCount == 1,
"expected RecursionCount == 1, got %d\n",
cs.RecursionCount);
3199 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3200 ok(
cs.RecursionCount == 0,
"expected RecursionCount == 0, got %d\n",
cs.RecursionCount);
3201 ok(!
cs.OwningThread,
"unexpected OwningThread %p\n",
cs.OwningThread);
3209 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3210 ok(
cs.RecursionCount == -1,
"expected RecursionCount == -1, got %d\n",
cs.RecursionCount);
3211 ok(!
cs.OwningThread,
"unexpected OwningThread %p\n",
cs.OwningThread);
3216 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3217 ok(
cs.RecursionCount == -2,
"expected RecursionCount == -2, got %d\n",
cs.RecursionCount);
3218 ok(!
cs.OwningThread,
"unexpected OwningThread %p\n",
cs.OwningThread);
3224 ok(
cs.LockCount == -2,
"expected LockCount == -2, got %d\n",
cs.LockCount);
3225 ok(
cs.RecursionCount == 1,
"expected RecursionCount == 1, got %d\n",
cs.RecursionCount);
3230 ok(
cs.LockCount == -1,
"expected LockCount == -1, got %d\n",
cs.LockCount);
3231 ok(
cs.RecursionCount == 0,
"expected RecursionCount == 0, got %d\n",
cs.RecursionCount);
3232 ok(!
cs.OwningThread,
"unexpected OwningThread %p\n",
cs.OwningThread);
3247 static const WCHAR ntdllW[] = {
'n',
't',
'd',
'l',
'l',
'.',
'd',
'l',
'l',0};
3262 if (!pLdrEnumerateLoadedModules)
3264 win_skip(
"LdrEnumerateLoadedModules not available\n");
3273 ok(
ctx.count > 1,
"Expected more than one module, got %d\n",
ctx.count);
3274 ok(
ctx.found,
"Could not find ntdll in list of modules\n");
3280 ok(
ctx.count == 1,
"Expected exactly one module, got %d\n",
ctx.count);
3288 status = pLdrEnumerateLoadedModules(
NULL,
NULL, (
void *)0xdeadbeef);
3300 if (!pRtlMakeSelfRelativeSD || !pRtlAbsoluteToSelfRelativeSD)
3302 win_skip(
"RtlMakeSelfRelativeSD/RtlAbsoluteToSelfRelativeSD not available\n" );
3312 ok(
len ==
sizeof(*sd_rel),
"got %u\n",
len );
3315 status = pRtlMakeSelfRelativeSD( &
sd, sd_rel, &
len );
3317 ok(
len ==
sizeof(*sd_rel) + 4,
"got %u\n",
len );
3322 ok(
len ==
sizeof(*sd_rel),
"got %u\n",
len );
3325 status = pRtlAbsoluteToSelfRelativeSD( &
sd, sd_rel, &
len );
3327 ok(
len ==
sizeof(*sd_rel) + 4,
"got %u\n",
len );
3330 status = pRtlMakeSelfRelativeSD( &
sd, sd_rel, &
len );
3332 ok(
len ==
sizeof(*sd_rel) + 4,
"got %u\n",
len );
3334 status = pRtlAbsoluteToSelfRelativeSD( &
sd, sd_rel, &
len );
3340 const WCHAR programW[] = {
'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
't',
'.',
'W',
'i',
'n',
'd',
'o',
'w',
's',
'.',
3341 'P',
'h',
'o',
't',
'o',
's',
'_',
'8',
'w',
'e',
'k',
'y',
'b',
'3',
'd',
'8',
'b',
'b',
'w',
'e',
'!',
'A',
'p',
'p',0};
3342 const WCHAR fullnameW[] = {
'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
't',
'.',
'W',
'i',
'n',
'd',
'o',
'w',
's',
'.',
3343 'P',
'h',
'o',
't',
'o',
's', 0};
3344 const WCHAR appidW[] = {
'A',
'p',
'p',0};
3354 if (!pRtlQueryPackageIdentity)
3356 win_skip(
"RtlQueryPackageIdentity not available\n");
3366 &IID_IApplicationActivationManager, (
void **)&manager);
3373 hr = IApplicationActivationManager_ActivateApplication(manager, programW,
NULL,
3378 IApplicationActivationManager_Release(manager);
3388 status = pRtlQueryPackageIdentity(
token, buf1, &size1, buf2, &size2,
NULL);
3391 ok(!
memcmp(buf1, fullnameW,
sizeof(fullnameW) -
sizeof(
WCHAR)),
3393 ok(size1 >=
sizeof(
WCHAR) && !(size1 %
sizeof(
WCHAR)),
"Unexpected size1 = %lu\n", size1);
3394 ok(buf1[size1 /
sizeof(
WCHAR) - 1] == 0,
"Expected buf1[%lu] == 0\n", size1 /
sizeof(
WCHAR) - 1);
3397 ok(size2 >=
sizeof(
WCHAR) && !(size2 %
sizeof(
WCHAR)),
"Unexpected size2 = %lu\n", size2);
3398 ok(buf2[size2 /
sizeof(
WCHAR) - 1] == 0,
"Expected buf2[%lu] == 0\n", size2 /
sizeof(
WCHAR) - 1);
3413 return (
void *)((
char *)
module + va);
3430 ok(
data->Loaded.Flags == 0,
"Expected flags 0, got %x\n",
data->Loaded.Flags);
3433 ok(!!
data->Loaded.DllBase,
"Expected non zero base address\n");
3434 ok(
data->Loaded.SizeOfImage,
"Expected non zero image size\n");
3437 mark = &
NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
3439 ok(
mod->BaseAddress ==
data->Loaded.DllBase,
"Expected base address %p, got %p\n",
3440 data->Loaded.DllBase,
mod->BaseAddress);
3446 ok(!!imports,
"Expected dll to have imports\n");
3448 for (
i = 0; imports[
i].
Name;
i++)
3451 if (imports[
i].OriginalFirstThunk)
3454 import_list = thunk_list;
3459 "Import has not been resolved: %p\n", (
void*)thunk_list[
j].
u1.
Function);
3498 mark = &
NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;