33#define HASH_STRING_ALGORITHM_X65599 1
34#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
108 ok(
hntdll != 0,
"LoadLibrary failed\n");
113 pRtlAppendUnicodeStringToString = (
void *)
GetProcAddress(
hntdll,
"RtlAppendUnicodeStringToString");
120 pRtlCreateUnicodeStringFromAsciiz = (
void *)
GetProcAddress(
hntdll,
"RtlCreateUnicodeStringFromAsciiz");
133 pRtlMultiAppendUnicodeStringBuffer = (
void *)
GetProcAddress(
hntdll,
"RtlMultiAppendUnicodeStringBuffer");
152 static const char teststring[] =
"Some Wild String";
156 str.MaximumLength = 0;
157 str.Buffer = (
void *)0xdeadbeef;
158 pRtlInitString(&
str, teststring);
159 ok(
str.Length ==
sizeof(teststring) -
sizeof(
char),
"Length uninitialized\n");
160 ok(
str.MaximumLength ==
sizeof(teststring),
"MaximumLength uninitialized\n");
161 ok(
str.Buffer == teststring,
"Buffer not equal to teststring\n");
162 ok(
strcmp(
str.Buffer,
"Some Wild String") == 0,
"Buffer written to\n");
164 ok(
str.Length == 0,
"Length uninitialized\n");
165 ok(
str.MaximumLength == 0,
"MaximumLength uninitialized\n");
166 ok(
str.Buffer ==
NULL,
"Buffer not equal to NULL\n");
173#define STRINGW {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}
181 uni.
Buffer = (
void *)0xdeadbeef;
182 pRtlInitUnicodeString(&uni, teststring);
183 ok(uni.
Length ==
sizeof(teststring) -
sizeof(
WCHAR),
"Length uninitialized\n");
184 ok(uni.
MaximumLength ==
sizeof(teststring),
"MaximumLength uninitialized\n");
185 ok(uni.
Buffer == teststring,
"Buffer not equal to teststring\n");
187 pRtlInitUnicodeString(&uni,
NULL);
188 ok(uni.
Length == 0,
"Length uninitialized\n");
195#define TESTSTRING2_LEN 1000000
201 static const WCHAR teststring[] = {
'S',
'o',
'm',
'e',
' ',
'W',
'i',
'l',
'd',
' ',
'S',
't',
'r',
'i',
'n',
'g',0};
206 if (!pRtlInitUnicodeStringEx)
208 win_skip(
"RtlInitUnicodeStringEx is not available\n");
218 uni.
Buffer = (
void *) 0xdeadbeef;
219 result = pRtlInitUnicodeStringEx(&uni, teststring);
221 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0\n",
224 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
227 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected %u\n",
230 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %p\n",
235 uni.
Buffer = (
void *) 0xdeadbeef;
236 pRtlInitUnicodeString(&uni, teststring);
238 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
241 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
244 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
249 uni.
Buffer = (
void *) 0xdeadbeef;
250 result = pRtlInitUnicodeStringEx(&uni, teststring2);
252 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected %x\n",
256 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected 12345 or 0\n",
260 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected 12345 or 0\n",
262 ok(uni.
Buffer == (
void *) 0xdeadbeef ||
263 uni.
Buffer == teststring2,
264 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %x or %p\n",
265 uni.
Buffer, 0xdeadbeef, teststring2);
269 uni.
Buffer = (
void *) 0xdeadbeef;
270 pRtlInitUnicodeString(&uni, teststring2);
272 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
275 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
278 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
281 "pRtlInitUnicodeString(&uni, 0) changes Buffer\n");
285 uni.
Buffer = (
void *) 0xdeadbeef;
286 result = pRtlInitUnicodeStringEx(&uni, 0);
288 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0\n",
291 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
294 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected %u\n",
297 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %p\n",
302 uni.
Buffer = (
void *) 0xdeadbeef;
303 pRtlInitUnicodeString(&uni, 0);
305 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
308 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
311 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
336 { 0, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 32, 32, 32,
"This is a string",
STATUS_SUCCESS},
337 { 0, 32, 32, 32,
"This is a string", 40, 42, 42,
"--------------------", 32, 32, 32,
"This is a string",
STATUS_SUCCESS},
338 { 0, 32, 30, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
339 { 0, 32, 34, 34,
"This is a string", 40, 42, 42,
NULL, 32, 32, 32,
"This is a string",
STATUS_SUCCESS},
340 { 0, 32, 32, 32,
"This is a string", 40, 42, 42,
NULL, 32, 32, 32,
"This is a string",
STATUS_SUCCESS},
341 { 0, 32, 30, 34,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
342 { 1, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
343 { 1, 32, 32, 32,
"This is a string", 40, 42, 42,
"--------------------", 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
344 { 1, 32, 30, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
345 { 1, 32, 34, 34,
"This is a string", 40, 42, 42,
NULL, 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
346 { 1, 32, 32, 32,
"This is a string", 40, 42, 42,
NULL, 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
347 { 1, 32, 30, 34,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
348 { 2, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
349 { 2, 32, 32, 32,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
350 { 2, 32, 30, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
351 { 2, 32, 34, 34,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
352 { 2, 32, 32, 32,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
353 { 2, 32, 30, 34,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
354 { 3, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
355 { 3, 32, 32, 32,
"This is a string", 40, 42, 42,
"--------------------", 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
356 { 3, 32, 30, 32,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
357 { 3, 32, 34, 34,
"This is a string", 40, 42, 42,
NULL, 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
358 { 3, 32, 32, 32,
"This is a string", 40, 42, 42,
NULL, 32, 34, 34,
"This is a string",
STATUS_SUCCESS},
359 { 3, 32, 30, 32,
"This is a string", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
360 { 4, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
361 { 5, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
362 { 6, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
363 { 7, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
364 { 8, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
365 { 9, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
366 {10, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
367 {11, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
368 {12, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
369 {13, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
370 {14, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
371 {15, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
372 {16, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
373 {-1, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
374 {-5, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
375 {-9, 32, 34, 34,
"This is a string", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
376 { 0, 0, 2, 2,
"", 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
377 { 0, 0, 0, 0,
"", 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
378 { 0, 0, 2, 2,
"", 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
379 { 0, 0, 0, 0,
"", 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
380 { 0, 0, 2, 2,
NULL, 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
381 { 0, 0, 0, 0,
NULL, 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
382 { 0, 0, 2, 2,
NULL, 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
383 { 0, 0, 0, 0,
NULL, 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
384 { 1, 0, 2, 2,
"", 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
385 { 1, 0, 0, 0,
"", 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
386 { 1, 0, 2, 2,
"", 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
387 { 1, 0, 0, 0,
"", 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
388 { 1, 0, 2, 2,
NULL, 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
389 { 1, 0, 0, 0,
NULL, 40, 42, 42,
"--------------------", 0, 0, 0,
NULL,
STATUS_SUCCESS},
390 { 1, 0, 2, 2,
NULL, 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
391 { 1, 0, 0, 0,
NULL, 40, 42, 42,
NULL, 0, 0, 0,
NULL,
STATUS_SUCCESS},
392 { 2, 0, 2, 2,
"", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
393 { 2, 0, 0, 0,
"", 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
394 { 2, 0, 2, 2,
"", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
395 { 2, 0, 0, 0,
"", 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
396 { 2, 0, 2, 2,
NULL, 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
397 { 2, 0, 0, 0,
NULL, 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
398 { 2, 0, 2, 2,
NULL, 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
399 { 2, 0, 0, 0,
NULL, 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
400 { 3, 0, 2, 2,
"", 40, 42, 42,
"--------------------", 0, 2, 2,
"",
STATUS_SUCCESS},
401 { 3, 0, 0, 0,
"", 40, 42, 42,
"--------------------", 0, 2, 2,
"",
STATUS_SUCCESS},
402 { 3, 0, 2, 2,
"", 40, 42, 42,
NULL, 0, 2, 2,
"",
STATUS_SUCCESS},
403 { 3, 0, 0, 0,
"", 40, 42, 42,
NULL, 0, 2, 2,
"",
STATUS_SUCCESS},
404 { 3, 0, 2, 2,
NULL, 40, 42, 42,
"--------------------", 40, 42, 42,
"--------------------",
STATUS_INVALID_PARAMETER},
405 { 3, 0, 0, 0,
NULL, 40, 42, 42,
"--------------------", 0, 2, 2,
"",
STATUS_SUCCESS},
406 { 3, 0, 2, 2,
NULL, 40, 42, 42,
NULL, 40, 42, 0,
NULL,
STATUS_INVALID_PARAMETER},
407 { 3, 0, 0, 0,
NULL, 40, 42, 42,
NULL, 0, 2, 2,
"",
STATUS_SUCCESS},
409#define NB_DUPL_USTR (sizeof(dupl_ustr)/sizeof(*dupl_ustr))
415 WCHAR source_buf[257];
421 CHAR dest_ansi_buf[257];
424 unsigned int test_num;
426 if (!pRtlDuplicateUnicodeString)
428 win_skip(
"RtlDuplicateUnicodeString is not available\n");
432 for (test_num = 0; test_num <
NB_DUPL_USTR; test_num++) {
439 source_str.
Buffer = source_buf;
449 dest_str.
Buffer = dest_buf;
463 result = pRtlDuplicateUnicodeString(
dupl_ustr[test_num].add_nul, &source_str, &dest_str);
464 dest_ansi_str.Length = dest_str.
Length /
sizeof(
WCHAR);
465 dest_ansi_str.MaximumLength = dest_ansi_str.Length + 1;
466 for (
pos = 0;
pos < dest_ansi_str.Length;
pos++) {
469 dest_ansi_buf[dest_ansi_str.Length] =
'\0';
470 dest_ansi_str.Buffer = dest_ansi_buf;
472 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has result %x, expected %x\n",
475 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination has Length %d, expected %d\n",
478 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination has MaximumLength %d, expected %d\n",
482 dest_str.
Buffer == dest_buf,
483 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination buffer changed %p expected %p\n",
487 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination buffer unchanged %p\n",
492 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination \"%s\" expected \"%s\"\n",
497 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination %p expected %p\n",
506 static const char teststring[] =
"Some Wild String";
507 char deststring[] =
" ";
511 pRtlInitString(&
str, teststring);
512 pRtlInitString(&deststr, deststring);
513 pRtlCopyString(&deststr, &
str);
514 ok(
strncmp(
str.Buffer, deststring,
str.Length) == 0,
"String not copied\n");
522 int expected_upper_ch;
525 for (ch = -1; ch <= 1024; ch++) {
526 upper_ch = pRtlUpperChar(ch);
528 if (byte_ch >=
'a' && byte_ch <=
'z') {
529 expected_upper_ch = (
CHAR) (byte_ch -
'a' +
'A');
531 expected_upper_ch = (
CHAR) byte_ch;
533 ok(upper_ch == expected_upper_ch,
534 "RtlUpperChar('%c'[=0x%x]) has result '%c'[=0x%x], expected '%c'[=0x%x]\n",
535 ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch);
546 char result_buf[257];
552 for (
i = 0;
i <= 255;
i++) {
554 if (ch >=
'a' && ch <=
'z') {
555 upper_ch = ch -
'a' +
'A';
560 result_buf[
i] =
'\0';
561 upper_buf[
i] = upper_ch;
564 result_buf[
i] =
'\0';
566 ascii_str.Length = 256;
567 ascii_str.MaximumLength = 256;
568 ascii_str.Buffer = ascii_buf;
569 result_str.Length = 256;
570 result_str.MaximumLength = 256;
571 result_str.Buffer = result_buf;
572 upper_str.Length = 256;
573 upper_str.MaximumLength = 256;
574 upper_str.Buffer = upper_buf;
576 pRtlUpperString(&result_str, &ascii_str);
577 ok(
memcmp(result_str.Buffer, upper_str.Buffer, 256) == 0,
578 "RtlUpperString does not work as expected\n");
587 WCHAR expected_upper_ch;
589 for (
i = 0;
i <= 255;
i++) {
591 upper_ch = pRtlUpcaseUnicodeChar(ch);
592 if (ch >=
'a' && ch <=
'z') {
593 expected_upper_ch = ch -
'a' +
'A';
594 }
else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) {
595 expected_upper_ch = ch - 0x20;
596 }
else if (ch == 0xff) {
597 expected_upper_ch = 0x178;
599 expected_upper_ch = ch;
601 ok(upper_ch == expected_upper_ch,
602 "RtlUpcaseUnicodeChar('%c'[=0x%x]) has result '%c'[=0x%x], expected: '%c'[=0x%x]\n",
603 ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch);
613 WCHAR ascii_buf[257];
614 WCHAR result_buf[257];
615 WCHAR upper_buf[257];
620 for (
i = 0;
i <= 255;
i++) {
622 if (ch >=
'a' && ch <=
'z') {
623 upper_ch = ch -
'a' +
'A';
624 }
else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) {
625 upper_ch = ch - 0x20;
626 }
else if (ch == 0xff) {
632 result_buf[
i] =
'\0';
633 upper_buf[
i] = upper_ch;
636 result_buf[
i] =
'\0';
640 ascii_str.
Buffer = ascii_buf;
643 result_str.
Buffer = result_buf;
646 upper_str.
Buffer = upper_buf;
648 pRtlUpcaseUnicodeString(&result_str, &ascii_str, 0);
649 for (
i = 0;
i <= 255;
i++) {
651 "RtlUpcaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]\n",
664 WCHAR source_buf[1025];
665 WCHAR result_buf[1025];
666 WCHAR lower_buf[1025];
671 for (
i = 0;
i < 1024;
i++) {
673 if (ch >=
'A' && ch <=
'Z') {
674 lower_ch = ch -
'A' +
'a';
675 }
else if (ch >= 0xc0 && ch <= 0xde && ch != 0xd7) {
676 lower_ch = ch + 0x20;
677 }
else if (ch >= 0x391 && ch <= 0x3ab && ch != 0x3a2) {
678 lower_ch = ch + 0x20;
681 case 0x178: lower_ch = 0xff;
break;
682 case 0x181: lower_ch = 0x253;
break;
683 case 0x186: lower_ch = 0x254;
break;
684 case 0x189: lower_ch = 0x256;
break;
685 case 0x18a: lower_ch = 0x257;
break;
686 case 0x18e: lower_ch = 0x1dd;
break;
687 case 0x18f: lower_ch = 0x259;
break;
688 case 0x190: lower_ch = 0x25b;
break;
689 case 0x193: lower_ch = 0x260;
break;
690 case 0x194: lower_ch = 0x263;
break;
691 case 0x196: lower_ch = 0x269;
break;
692 case 0x197: lower_ch = 0x268;
break;
693 case 0x19c: lower_ch = 0x26f;
break;
694 case 0x19d: lower_ch = 0x272;
break;
695 case 0x19f: lower_ch = 0x275;
break;
696 case 0x1a9: lower_ch = 0x283;
break;
697 case 0x1ae: lower_ch = 0x288;
break;
698 case 0x1b1: lower_ch = 0x28a;
break;
699 case 0x1b2: lower_ch = 0x28b;
break;
700 case 0x1b7: lower_ch = 0x292;
break;
701 case 0x1c4: lower_ch = 0x1c6;
break;
702 case 0x1c7: lower_ch = 0x1c9;
break;
703 case 0x1ca: lower_ch = 0x1cc;
break;
704 case 0x1f1: lower_ch = 0x1f3;
break;
705 case 0x386: lower_ch = 0x3ac;
break;
706 case 0x388: lower_ch = 0x3ad;
break;
707 case 0x389: lower_ch = 0x3ae;
break;
708 case 0x38a: lower_ch = 0x3af;
break;
709 case 0x38c: lower_ch = 0x3cc;
break;
710 case 0x38e: lower_ch = 0x3cd;
break;
711 case 0x38f: lower_ch = 0x3ce;
break;
712 default: lower_ch = ch;
break;
716 result_buf[
i] =
'\0';
717 lower_buf[
i] = lower_ch;
719 source_buf[
i] =
'\0';
720 result_buf[
i] =
'\0';
724 source_str.
Buffer = source_buf;
727 result_str.
Buffer = result_buf;
730 lower_str.
Buffer = lower_buf;
732 pRtlDowncaseUnicodeString(&result_str, &source_str, 0);
733 for (
i = 0;
i <= 1024;
i++) {
735 "RtlDowncaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]\n",
761 { 10, 12, 12,
"------------", 0, 0, 0,
"",
TRUE, 0, 1, 1,
"",
STATUS_SUCCESS},
762 { 10, 12, 12,
"------------", 12, 12, 12,
"abcdef",
TRUE, 6, 7, 7,
"abcdef",
STATUS_SUCCESS},
763 { 0, 2, 12,
"------------", 12, 12, 12,
"abcdef",
TRUE, 6, 7, 7,
"abcdef",
STATUS_SUCCESS},
764 { 10, 12, 12,
NULL, 12, 12, 12,
"abcdef",
TRUE, 6, 7, 7,
"abcdef",
STATUS_SUCCESS},
765 { 0, 0, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 6, 0, 0,
"",
STATUS_BUFFER_OVERFLOW},
766 { 0, 1, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 0, 1, 1,
"",
STATUS_BUFFER_OVERFLOW},
767 { 0, 2, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 1, 2, 2,
"a",
STATUS_BUFFER_OVERFLOW},
768 { 0, 3, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 2, 3, 3,
"ab",
STATUS_BUFFER_OVERFLOW},
769 { 0, 5, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 4, 5, 5,
"abcd",
STATUS_BUFFER_OVERFLOW},
770 { 8, 5, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 4, 5, 5,
"abcd",
STATUS_BUFFER_OVERFLOW},
771 { 8, 6, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 5, 6, 6,
"abcde",
STATUS_BUFFER_OVERFLOW},
772 { 8, 7, 12,
"------------", 12, 12, 12,
"abcdef",
FALSE, 6, 7, 7,
"abcdef",
STATUS_SUCCESS},
773 { 8, 7, 12,
"------------", 0, 12, 12,
NULL,
FALSE, 0, 7, 0,
"",
STATUS_SUCCESS},
776 { 0, 0, 12,
NULL, 10, 10, 12,
NULL,
FALSE, 5, 0, 0,
NULL,
STATUS_BUFFER_OVERFLOW},
779#define NB_USTR2ASTR (sizeof(ustr2astr)/sizeof(*ustr2astr))
790 unsigned int test_num;
792 for (test_num = 0; test_num <
NB_USTR2ASTR; test_num++) {
798 ansi_str.Buffer = ansi_buf;
800 ansi_str.Buffer =
NULL;
812 result = pRtlUnicodeStringToAnsiString(&ansi_str, &uni_str,
ustr2astr[test_num].doalloc);
814 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has result %x, expected %x\n",
817 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) ansi has Length %d, expected %d\n",
820 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) ansi has MaximumLength %d, expected %d\n",
823 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has ansi \"%s\" expected \"%s\"\n",
826 pRtlFreeAnsiString(&ansi_str);
845 { 5, 12, 15,
"TestS01234abcde",
"tring", 10, 12, 15,
"TestStringabcde",
STATUS_SUCCESS},
846 { 5, 11, 15,
"TestS01234abcde",
"tring", 10, 11, 15,
"TestStringabcde",
STATUS_SUCCESS},
847 { 5, 10, 15,
"TestS01234abcde",
"tring", 10, 10, 15,
"TestStringabcde",
STATUS_SUCCESS},
848 { 5, 9, 15,
"TestS01234abcde",
"tring", 5, 9, 15,
"TestS01234abcde",
STATUS_BUFFER_TOO_SMALL},
849 { 5, 0, 15,
"TestS01234abcde",
"tring", 5, 0, 15,
"TestS01234abcde",
STATUS_BUFFER_TOO_SMALL},
850 { 5, 14, 15,
"TestS01234abcde",
"tring", 10, 14, 15,
"TestStringabcde",
STATUS_SUCCESS},
851 { 5, 14, 15,
"TestS01234abcde",
NULL, 5, 14, 15,
"TestS01234abcde",
STATUS_SUCCESS},
852 { 5, 14, 15,
NULL,
NULL, 5, 14, 15,
NULL,
STATUS_SUCCESS},
853 { 5, 12, 15,
"Tst\0S01234abcde",
"tr\0i", 7, 12, 15,
"Tst\0Str234abcde",
STATUS_SUCCESS},
855#define NB_APP_ASC2STR (sizeof(app_asc2str)/sizeof(*app_asc2str))
863 unsigned int test_num;
871 dest_str.Buffer = dest_buf;
873 dest_str.Buffer =
NULL;
877 "(test %d): RtlAppendAsciizToString(dest, src) has result %x, expected %x\n",
880 "(test %d): RtlAppendAsciizToString(dest, src) dest has Length %d, expected %d\n",
883 "(test %d): RtlAppendAsciizToString(dest, src) dest has MaximumLength %d, expected %d\n",
885 if (dest_str.Buffer == dest_buf) {
887 "(test %d): RtlAppendAsciizToString(dest, src) has dest \"%s\" expected \"%s\"\n",
888 test_num, dest_buf,
app_asc2str[test_num].res_buf);
891 "(test %d): RtlAppendAsciizToString(dest, src) dest has Buffer %p expected %p\n",
915 { 5, 12, 15,
"TestS01234abcde", 5, 5, 7,
"tringZY", 10, 12, 15,
"TestStringabcde",
STATUS_SUCCESS},
916 { 5, 11, 15,
"TestS01234abcde", 5, 5, 7,
"tringZY", 10, 11, 15,
"TestStringabcde",
STATUS_SUCCESS},
917 { 5, 10, 15,
"TestS01234abcde", 5, 5, 7,
"tringZY", 10, 10, 15,
"TestStringabcde",
STATUS_SUCCESS},
918 { 5, 9, 15,
"TestS01234abcde", 5, 5, 7,
"tringZY", 5, 9, 15,
"TestS01234abcde",
STATUS_BUFFER_TOO_SMALL},
919 { 5, 0, 15,
"TestS01234abcde", 0, 0, 7,
"tringZY", 5, 0, 15,
"TestS01234abcde",
STATUS_SUCCESS},
920 { 5, 14, 15,
"TestS01234abcde", 0, 0, 7,
"tringZY", 5, 14, 15,
"TestS01234abcde",
STATUS_SUCCESS},
921 { 5, 14, 15,
"TestS01234abcde", 0, 0, 7,
NULL, 5, 14, 15,
"TestS01234abcde",
STATUS_SUCCESS},
922 { 5, 14, 15,
NULL, 0, 0, 7,
NULL, 5, 14, 15,
NULL,
STATUS_SUCCESS},
923 { 5, 12, 15,
"Tst\0S01234abcde", 4, 4, 7,
"tr\0iZY", 9, 12, 15,
"Tst\0Str\0i4abcde",
STATUS_SUCCESS},
925#define NB_APP_STR2STR (sizeof(app_str2str)/sizeof(*app_str2str))
935 unsigned int test_num;
943 dest_str.Buffer = dest_buf;
945 dest_str.Buffer =
NULL;
952 src_str.Buffer = src_buf;
954 src_str.Buffer =
NULL;
956 result = pRtlAppendStringToString(&dest_str, &src_str);
958 "(test %d): RtlAppendStringToString(dest, src) has result %x, expected %x\n",
961 "(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d\n",
964 "(test %d): RtlAppendStringToString(dest, src) dest has MaximumLength %d, expected %d\n",
966 if (dest_str.Buffer == dest_buf) {
968 "(test %d): RtlAppendStringToString(dest, src) has dest \"%s\" expected \"%s\"\n",
969 test_num, dest_buf,
app_str2str[test_num].res_buf);
972 "(test %d): RtlAppendStringToString(dest, src) dest has Buffer %p expected %p\n",
993 { 4, 12, 14,
"Fake0123abcdef",
"Ustr\0", 8, 12, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
994 { 4, 11, 14,
"Fake0123abcdef",
"Ustr\0", 8, 11, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
995 { 4, 10, 14,
"Fake0123abcdef",
"Ustr\0", 8, 10, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
999 { 4, 8, 14,
"Fake0123abcdef",
"Ustr\0", 8, 8, 14,
"FakeUstrabcdef",
STATUS_SUCCESS},
1000 { 4, 7, 14,
"Fake0123abcdef",
"Ustr\0", 4, 7, 14,
"Fake0123abcdef",
STATUS_BUFFER_TOO_SMALL},
1001 { 4, 0, 14,
"Fake0123abcdef",
"Ustr\0", 4, 0, 14,
"Fake0123abcdef",
STATUS_BUFFER_TOO_SMALL},
1002 { 4, 14, 14,
"Fake0123abcdef",
"Ustr\0", 8, 14, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
1003 { 4, 14, 14,
"Fake0123abcdef",
NULL, 4, 14, 14,
"Fake0123abcdef",
STATUS_SUCCESS},
1004 { 4, 14, 14,
NULL,
NULL, 4, 14, 14,
NULL,
STATUS_SUCCESS},
1005 { 4, 14, 14,
"Fake0123abcdef",
"U\0stri\0", 10, 14, 14,
"FakeU\0stri\0\0ef",
STATUS_SUCCESS},
1006 { 6, 14, 16,
"Te\0\0stabcdefghij",
"St\0\0ri", 8, 14, 16,
"Te\0\0stSt\0\0efghij",
STATUS_SUCCESS},
1008#define NB_APP_UNI2STR (sizeof(app_uni2str)/sizeof(*app_uni2str))
1013 WCHAR dest_buf[257];
1016 unsigned int test_num;
1024 dest_str.
Buffer = dest_buf;
1030 "(test %d): RtlAppendUnicodeToString(dest, src) has result %x, expected %x\n",
1033 "(test %d): RtlAppendUnicodeToString(dest, src) dest has Length %d, expected %d\n",
1036 "(test %d): RtlAppendUnicodeToString(dest, src) dest has MaximumLength %d, expected %d\n",
1038 if (dest_str.
Buffer == dest_buf) {
1040 "(test %d): RtlAppendUnicodeToString(dest, src) has dest \"%s\" expected \"%s\"\n",
1041 test_num, (
char *) dest_buf,
app_uni2str[test_num].res_buf);
1044 "(test %d): RtlAppendUnicodeToString(dest, src) dest has Buffer %p expected %p\n",
1068 { 4, 12, 14,
"Fake0123abcdef", 4, 6, 8,
"UstrZYXW", 8, 12, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
1069 { 4, 11, 14,
"Fake0123abcdef", 4, 6, 8,
"UstrZYXW", 8, 11, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
1070 { 4, 10, 14,
"Fake0123abcdef", 4, 6, 8,
"UstrZYXW", 8, 10, 14,
"FakeUstr\0\0cdef",
STATUS_SUCCESS},
1074 { 4, 8, 14,
"Fake0123abcdef", 4, 6, 8,
"UstrZYXW", 8, 8, 14,
"FakeUstrabcdef",
STATUS_SUCCESS},
1075 { 4, 7, 14,
"Fake0123abcdef", 4, 6, 8,
"UstrZYXW", 4, 7, 14,
"Fake0123abcdef",
STATUS_BUFFER_TOO_SMALL},
1076 { 4, 0, 14,
"Fake0123abcdef", 0, 0, 8,
"UstrZYXW", 4, 0, 14,
"Fake0123abcdef",
STATUS_SUCCESS},
1077 { 4, 14, 14,
"Fake0123abcdef", 0, 0, 8,
"UstrZYXW", 4, 14, 14,
"Fake0123abcdef",
STATUS_SUCCESS},
1078 { 4, 14, 14,
"Fake0123abcdef", 0, 0, 8,
NULL, 4, 14, 14,
"Fake0123abcdef",
STATUS_SUCCESS},
1079 { 4, 14, 14,
NULL, 0, 0, 8,
NULL, 4, 14, 14,
NULL,
STATUS_SUCCESS},
1080 { 6, 14, 16,
"Te\0\0stabcdefghij", 6, 8, 8,
"St\0\0riZY", 12, 14, 16,
"Te\0\0stSt\0\0ri\0\0ij",
STATUS_SUCCESS},
1082#define NB_APP_USTR2STR (sizeof(app_ustr2str)/sizeof(*app_ustr2str))
1087 WCHAR dest_buf[257];
1092 unsigned int test_num;
1100 dest_str.
Buffer = dest_buf;
1109 src_str.
Buffer = src_buf;
1113 result = pRtlAppendUnicodeStringToString(&dest_str, &src_str);
1115 "(test %d): RtlAppendStringToString(dest, src) has result %x, expected %x\n",
1118 "(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d\n",
1121 "(test %d): RtlAppendStringToString(dest, src) dest has MaximumLength %d, expected %d\n",
1123 if (dest_str.
Buffer == dest_buf) {
1125 "(test %d): RtlAppendStringToString(dest, src) has dest \"%s\" expected \"%s\"\n",
1126 test_num, (
char *) dest_buf,
app_ustr2str[test_num].res_buf);
1129 "(test %d): RtlAppendStringToString(dest, src) dest has Buffer %p expected %p\n",
1192#define NB_FIND_CH_IN_USTR (sizeof(find_ch_in_ustr)/sizeof(*find_ch_in_ustr))
1197 WCHAR main_str_buf[257];
1198 WCHAR search_chars_buf[257];
1204 unsigned int test_num;
1206 if (!pRtlFindCharInUnicodeString)
1208 win_skip(
"RtlFindCharInUnicodeString is not available\n");
1215 main_str.MaximumLength = main_str.Length +
sizeof(
WCHAR);
1219 main_str.Buffer = main_str_buf;
1227 search_chars.MaximumLength = search_chars.Length +
sizeof(
WCHAR);
1228 for (
idx = 0;
idx < search_chars.Length /
sizeof(
WCHAR);
idx++) {
1231 search_chars.Buffer = search_chars_buf;
1240 "(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) has result %x, expected %x\n",
1245 "(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) assigns %d to pos, expected %d\n",
1374#define NB_STR2INT (sizeof(str2int)/sizeof(*str2int))
1379 unsigned int test_num;
1385 for (test_num = 0; test_num <
NB_STR2INT; test_num++) {
1388 pRtlInitUnicodeString(&uni, wstr);
1392 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
1398 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
1402 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
1408 pRtlInitUnicodeString(&uni, wstr);
1411 "call failed: RtlUnicodeStringToInteger(\"%s\", %d, NULL) has result %x\n",
1413 result = pRtlUnicodeStringToInteger(&uni, 20,
NULL);
1415 "call failed: RtlUnicodeStringToInteger(\"%s\", 20, NULL) has result %x\n",
1421 "call failed: RtlUnicodeStringToInteger(\"12345\", %d, [out]) has result %x\n",
1424 "didn't return expected value (test a): expected: %d, got: %d\n",
1430 "call failed: RtlUnicodeStringToInteger(\"12\", %d, [out]) has result %x\n",
1433 ok(
value == 12,
"didn't return expected value (test b): expected: %d, got: %d\n", 12,
value);
1438 "call failed: RtlUnicodeStringToInteger(\"1\", %d, [out]) has result %x\n",
1441 "didn't return expected value (test c): expected: %d, got: %d\n",
1450 unsigned int test_num;
1454 for (test_num = 0; test_num <
NB_STR2INT; test_num++) {
1461 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
1466 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
1470 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
1477 "call failed: RtlCharToInteger(\"%s\", %d, NULL) has result %x\n",
1482 "call failed: RtlCharToInteger(\"%s\", 20, NULL) has result %x\n",
1487#define STRI_BUFFER_LENGTH 35
1499 {10, 123, 3, 11,
"123\0-------------------------------",
STATUS_SUCCESS},
1501 { 0, 0x80000000U, 10, 11,
"2147483648\0------------------------",
STATUS_SUCCESS},
1502 { 0, -2147483647, 10, 11,
"2147483649\0------------------------",
STATUS_SUCCESS},
1503 { 0, -2, 10, 11,
"4294967294\0------------------------",
STATUS_SUCCESS},
1504 { 0, -1, 10, 11,
"4294967295\0------------------------",
STATUS_SUCCESS},
1505 { 0, 0, 1, 11,
"0\0---------------------------------",
STATUS_SUCCESS},
1506 { 0, 1, 1, 11,
"1\0---------------------------------",
STATUS_SUCCESS},
1507 { 0, 12, 2, 11,
"12\0--------------------------------",
STATUS_SUCCESS},
1508 { 0, 123, 3, 11,
"123\0-------------------------------",
STATUS_SUCCESS},
1509 { 0, 1234, 4, 11,
"1234\0------------------------------",
STATUS_SUCCESS},
1510 { 0, 12345, 5, 11,
"12345\0-----------------------------",
STATUS_SUCCESS},
1511 { 0, 123456, 6, 11,
"123456\0----------------------------",
STATUS_SUCCESS},
1512 { 0, 1234567, 7, 11,
"1234567\0---------------------------",
STATUS_SUCCESS},
1513 { 0, 12345678, 8, 11,
"12345678\0--------------------------",
STATUS_SUCCESS},
1514 { 0, 123456789, 9, 11,
"123456789\0-------------------------",
STATUS_SUCCESS},
1515 { 0, 2147483646, 10, 11,
"2147483646\0------------------------",
STATUS_SUCCESS},
1516 { 0, 2147483647, 10, 11,
"2147483647\0------------------------",
STATUS_SUCCESS},
1517 { 0, 2147483648U, 10, 11,
"2147483648\0------------------------",
STATUS_SUCCESS},
1518 { 0, 2147483649U, 10, 11,
"2147483649\0------------------------",
STATUS_SUCCESS},
1519 { 0, 4294967294U, 10, 11,
"4294967294\0------------------------",
STATUS_SUCCESS},
1520 { 0, 4294967295U, 10, 11,
"4294967295\0------------------------",
STATUS_SUCCESS},
1522 { 2, 0x80000000U, 32, 33,
"10000000000000000000000000000000\0--",
STATUS_SUCCESS},
1523 { 2, -2147483647, 32, 33,
"10000000000000000000000000000001\0--",
STATUS_SUCCESS},
1524 { 2, -2, 32, 33,
"11111111111111111111111111111110\0--",
STATUS_SUCCESS},
1525 { 2, -1, 32, 33,
"11111111111111111111111111111111\0--",
STATUS_SUCCESS},
1526 { 2, 0, 1, 33,
"0\0---------------------------------",
STATUS_SUCCESS},
1527 { 2, 1, 1, 33,
"1\0---------------------------------",
STATUS_SUCCESS},
1528 { 2, 10, 4, 33,
"1010\0------------------------------",
STATUS_SUCCESS},
1529 { 2, 100, 7, 33,
"1100100\0---------------------------",
STATUS_SUCCESS},
1530 { 2, 1000, 10, 33,
"1111101000\0------------------------",
STATUS_SUCCESS},
1531 { 2, 10000, 14, 33,
"10011100010000\0--------------------",
STATUS_SUCCESS},
1532 { 2, 32767, 15, 33,
"111111111111111\0-------------------",
STATUS_SUCCESS},
1535 { 2, 65536, 17, 33,
"10000000000000000\0-----------------",
STATUS_SUCCESS},
1536 { 2, 100000, 17, 33,
"11000011010100000\0-----------------",
STATUS_SUCCESS},
1537 { 2, 1000000, 20, 33,
"11110100001001000000\0--------------",
STATUS_SUCCESS},
1538 { 2, 10000000, 24, 33,
"100110001001011010000000\0----------",
STATUS_SUCCESS},
1539 { 2, 100000000, 27, 33,
"101111101011110000100000000\0-------",
STATUS_SUCCESS},
1540 { 2, 1000000000, 30, 33,
"111011100110101100101000000000\0----",
STATUS_SUCCESS},
1541 { 2, 1073741823, 30, 33,
"111111111111111111111111111111\0----",
STATUS_SUCCESS},
1542 { 2, 2147483646, 31, 33,
"1111111111111111111111111111110\0---",
STATUS_SUCCESS},
1543 { 2, 2147483647, 31, 33,
"1111111111111111111111111111111\0---",
STATUS_SUCCESS},
1544 { 2, 2147483648U, 32, 33,
"10000000000000000000000000000000\0--",
STATUS_SUCCESS},
1545 { 2, 2147483649U, 32, 33,
"10000000000000000000000000000001\0--",
STATUS_SUCCESS},
1546 { 2, 4294967294U, 32, 33,
"11111111111111111111111111111110\0--",
STATUS_SUCCESS},
1547 { 2, 4294967295U, 32, 33,
"11111111111111111111111111111111\0--",
STATUS_SUCCESS},
1549 { 8, 0x80000000U, 11, 12,
"20000000000\0-----------------------",
STATUS_SUCCESS},
1550 { 8, -2147483647, 11, 12,
"20000000001\0-----------------------",
STATUS_SUCCESS},
1551 { 8, -2, 11, 12,
"37777777776\0-----------------------",
STATUS_SUCCESS},
1552 { 8, -1, 11, 12,
"37777777777\0-----------------------",
STATUS_SUCCESS},
1553 { 8, 0, 1, 12,
"0\0---------------------------------",
STATUS_SUCCESS},
1554 { 8, 1, 1, 12,
"1\0---------------------------------",
STATUS_SUCCESS},
1555 { 8, 2147483646, 11, 12,
"17777777776\0-----------------------",
STATUS_SUCCESS},
1556 { 8, 2147483647, 11, 12,
"17777777777\0-----------------------",
STATUS_SUCCESS},
1557 { 8, 2147483648U, 11, 12,
"20000000000\0-----------------------",
STATUS_SUCCESS},
1558 { 8, 2147483649U, 11, 12,
"20000000001\0-----------------------",
STATUS_SUCCESS},
1559 { 8, 4294967294U, 11, 12,
"37777777776\0-----------------------",
STATUS_SUCCESS},
1560 { 8, 4294967295U, 11, 12,
"37777777777\0-----------------------",
STATUS_SUCCESS},
1562 {10, 0x80000000U, 10, 11,
"2147483648\0------------------------",
STATUS_SUCCESS},
1563 {10, -2147483647, 10, 11,
"2147483649\0------------------------",
STATUS_SUCCESS},
1564 {10, -2, 10, 11,
"4294967294\0------------------------",
STATUS_SUCCESS},
1565 {10, -1, 10, 11,
"4294967295\0------------------------",
STATUS_SUCCESS},
1566 {10, 0, 1, 11,
"0\0---------------------------------",
STATUS_SUCCESS},
1567 {10, 1, 1, 11,
"1\0---------------------------------",
STATUS_SUCCESS},
1568 {10, 2147483646, 10, 11,
"2147483646\0------------------------",
STATUS_SUCCESS},
1569 {10, 2147483647, 10, 11,
"2147483647\0------------------------",
STATUS_SUCCESS},
1570 {10, 2147483648U, 10, 11,
"2147483648\0------------------------",
STATUS_SUCCESS},
1571 {10, 2147483649U, 10, 11,
"2147483649\0------------------------",
STATUS_SUCCESS},
1572 {10, 4294967294U, 10, 11,
"4294967294\0------------------------",
STATUS_SUCCESS},
1573 {10, 4294967295U, 10, 11,
"4294967295\0------------------------",
STATUS_SUCCESS},
1575 {16, 0x80000000U, 8, 9,
"80000000\0--------------------------",
STATUS_SUCCESS},
1576 {16, -2147483647, 8, 9,
"80000001\0--------------------------",
STATUS_SUCCESS},
1577 {16, -2, 8, 9,
"FFFFFFFE\0--------------------------",
STATUS_SUCCESS},
1578 {16, -1, 8, 9,
"FFFFFFFF\0--------------------------",
STATUS_SUCCESS},
1579 {16, 0, 1, 9,
"0\0---------------------------------",
STATUS_SUCCESS},
1580 {16, 1, 1, 9,
"1\0---------------------------------",
STATUS_SUCCESS},
1581 {16, 2147483646, 8, 9,
"7FFFFFFE\0--------------------------",
STATUS_SUCCESS},
1582 {16, 2147483647, 8, 9,
"7FFFFFFF\0--------------------------",
STATUS_SUCCESS},
1583 {16, 2147483648U, 8, 9,
"80000000\0--------------------------",
STATUS_SUCCESS},
1584 {16, 2147483649U, 8, 9,
"80000001\0--------------------------",
STATUS_SUCCESS},
1585 {16, 4294967294U, 8, 9,
"FFFFFFFE\0--------------------------",
STATUS_SUCCESS},
1586 {16, 4294967295U, 8, 9,
"FFFFFFFF\0--------------------------",
STATUS_SUCCESS},
1590 { 2, 65536, 17, 18,
"10000000000000000\0-----------------",
STATUS_SUCCESS},
1591 { 2, 65536, 17, 17,
"10000000000000000------------------",
STATUS_SUCCESS},
1592 { 2, 131072, 18, 19,
"100000000000000000\0----------------",
STATUS_SUCCESS},
1593 { 2, 131072, 18, 18,
"100000000000000000-----------------",
STATUS_SUCCESS},
1594 {16, 0xffffffff, 8, 9,
"FFFFFFFF\0--------------------------",
STATUS_SUCCESS},
1595 {16, 0xffffffff, 8, 8,
"FFFFFFFF---------------------------",
STATUS_SUCCESS},
1597 {16, 0xa, 1, 2,
"A\0---------------------------------",
STATUS_SUCCESS},
1598 {16, 0xa, 1, 1,
"A----------------------------------",
STATUS_SUCCESS},
1603#define NB_INT2STR (sizeof(int2str)/sizeof(*int2str))
1611 STRING expected_ansi_str;
1622 expected_unicode_string.
Buffer = expected_str_Buffer;
1623 pRtlUnicodeStringToAnsiString(&expected_ansi_str, &expected_unicode_string, 1);
1626 str_Buffer[
pos] =
'-';
1628 unicode_string.
Length = 0;
1630 unicode_string.
Buffer = str_Buffer;
1633 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
1637 expected_str_Buffer[
pos] =
'-';
1644 if (expected_unicode_string.
Length > 32 && unicode_string.
Length == 0) {
1646 expected_unicode_string.
Length = 0;
1650 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) has result %x, expected: %x\n",
1654 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string \"%s\" is not NULL terminated\n",
1659 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) assigns string \"%s\", expected: \"%s\"\n",
1662 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has Length %d, expected: %d\n",
1665 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has MaximumLength %d, expected: %d\n",
1667 pRtlFreeAnsiString(&expected_ansi_str);
1668 pRtlFreeAnsiString(&ansi_str);
1676 for (test_num = 0; test_num <
NB_INT2STR; test_num++)
1690 "(test %d): RtlIntegerToChar(%u, %d, %d, [out]) has result %x, expected: %x\n",
1693 "(test %d): RtlIntegerToChar(%u, %d, %d, [out]) assigns string \"%s\", expected: \"%s\"\n",
1703 for (test_num = 0; test_num <
NB_INT2STR; test_num++)
1708 "(test a): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1713 "(test b): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1718 "(test c): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1723 "(test d): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1729 char ascii[] =
"A simple string";
1730 char false_positive[] = {0x41, 0x0a, 0x0d, 0x1d};
1731 WCHAR false_negative = 0x0d0a;
1732 WCHAR unicode[] = {
'A',
' ',
'U',
'n',
'i',
'c',
'o',
'd',
'e',
' ',
's',
't',
'r',
'i',
'n',
'g',0};
1733 WCHAR unicode_no_controls[] = {
'A',
'U',
'n',
'i',
'c',
'o',
'd',
'e',
's',
't',
'r',
'i',
'n',
'g',0};
1735 WCHAR mixed_controls[] = {
'\t',0x9000,0x0d00,
'\n',0};
1737 WCHAR *be_unicode_no_controls;
1742 if (!pRtlIsTextUnicode)
1744 win_skip(
"RtlIsTextUnicode is not available\n");
1748 ok(!pRtlIsTextUnicode(ascii,
sizeof(ascii),
NULL),
"ASCII text detected as Unicode\n");
1750 res = pRtlIsTextUnicode(unicode,
sizeof(unicode),
NULL);
1753 "Text should be Unicode\n");
1755 ok(!pRtlIsTextUnicode(unicode,
sizeof(unicode) - 1,
NULL),
"Text should be Unicode\n");
1758 ok(pRtlIsTextUnicode(unicode,
sizeof(unicode), &
flags),
"Text should not pass a Unicode\n");
1760 "Expected flags 0x6, obtained %x\n",
flags);
1763 ok(!pRtlIsTextUnicode(unicode,
sizeof(unicode), &
flags),
"Text should not pass reverse Unicode tests\n");
1764 ok(
flags == 0,
"Expected flags 0, obtained %x\n",
flags);
1767 ok(!pRtlIsTextUnicode(unicode,
sizeof(unicode) - 1, &
flags),
"Odd length test should have passed\n");
1771 be_unicode[0] = 0xfffe;
1772 for (
i = 0;
i <
sizeof(unicode)/
sizeof(unicode[0]);
i++)
1774 be_unicode[
i + 1] = (unicode[
i] >> 8) | ((unicode[
i] & 0xff) << 8);
1776 ok(!pRtlIsTextUnicode(be_unicode,
sizeof(unicode) + 2,
NULL),
"Reverse endian should not be Unicode\n");
1777 ok(!pRtlIsTextUnicode(&be_unicode[1],
sizeof(unicode),
NULL),
"Reverse endian should not be Unicode\n");
1780 ok(!pRtlIsTextUnicode(&be_unicode[1],
sizeof(unicode), &
flags),
"Reverse endian should be Unicode\n");
1783 "Expected flags 0x70, obtained %x\n",
flags);
1786 ok(!pRtlIsTextUnicode(be_unicode,
sizeof(unicode) + 2, &
flags),
"Reverse endian should be Unicode\n");
1788 "Expected flags 0xc0, obtained %x\n",
flags);
1792 ok(be_unicode_no_controls !=
NULL,
"Expected HeapAlloc to succeed.\n");
1793 be_unicode_no_controls[0] = 0xfffe;
1794 for (
i = 0;
i <
sizeof(unicode_no_controls)/
sizeof(unicode_no_controls[0]);
i++)
1795 be_unicode_no_controls[
i + 1] = (unicode_no_controls[
i] >> 8) | ((unicode_no_controls[
i] & 0xff) << 8);
1806 ok(!pRtlIsTextUnicode(unicode_no_controls,
sizeof(unicode_no_controls), &
flags),
"Test should not pass on Unicode string lacking control characters.\n");
1807 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1810 ok(!pRtlIsTextUnicode(be_unicode_no_controls,
sizeof(unicode_no_controls), &
flags),
"Test should not pass on byte-reversed Unicode string lacking control characters.\n");
1811 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1814 ok(pRtlIsTextUnicode(unicode,
sizeof(unicode), &
flags),
"Test should pass on Unicode string lacking control characters.\n");
1818 ok(!pRtlIsTextUnicode(be_unicode_no_controls,
sizeof(unicode_no_controls) + 2, &
flags),
1819 "Test should not pass with standard Unicode string.\n");
1820 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1823 ok(pRtlIsTextUnicode(mixed_controls,
sizeof(mixed_controls), &
flags),
"Test should pass on a string containing control characters.\n");
1828 ok(!pRtlIsTextUnicode(be_unicode_no_controls,
sizeof(unicode_no_controls), &
flags),
"Test should not pass on Unicode string lacking control characters.\n");
1829 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1832 ok(!pRtlIsTextUnicode(unicode_no_controls,
sizeof(unicode_no_controls), &
flags),
"Test should not pass on Unicode string lacking control characters.\n");
1833 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1836 ok(!pRtlIsTextUnicode(unicode,
sizeof(unicode), &
flags),
"Test should not pass on Unicode string lacking control characters.\n");
1837 ok(
flags == 0,
"Expected flags 0x0, obtained %x\n",
flags);
1840 ok(!pRtlIsTextUnicode(be_unicode,
sizeof(unicode) + 2, &
flags),
1841 "Test should pass with byte-reversed Unicode string containing control characters.\n");
1845 ok(!pRtlIsTextUnicode(mixed_controls,
sizeof(mixed_controls), &
flags),
"Test should pass on a string containing byte-reversed control characters.\n");
1850 ok(!pRtlIsTextUnicode(mixed_controls,
sizeof(mixed_controls), &
flags),
"Test should pass on string containing both byte-reversed and standard control characters.\n");
1854 todo_wine ok(pRtlIsTextUnicode(false_positive,
sizeof(false_positive), &
flags),
"Test should pass on false positive.\n");
1856 ok(!pRtlIsTextUnicode(&false_negative,
sizeof(false_negative),
NULL),
"Test should fail on 0x0d0a (MALAYALAM LETTER UU).\n");
1871 for (ch1 = 0; ch1 < 512; ch1++)
1873 for (ch2 = 0; ch2 < 1024; ch2++)
1875 LONG res = pRtlCompareUnicodeString( &str1, &str2,
FALSE );
1876 ok(
res == (ch1 - ch2),
"wrong result %d %04x %04x\n",
res, ch1, ch2 );
1877 res = pRtlCompareUnicodeString( &str1, &str2,
TRUE );
1878 ok(
res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)),
1879 "wrong result %d %04x %04x\n",
res, ch1, ch2 );
1880 if (pRtlCompareUnicodeStrings)
1882 res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1,
FALSE );
1883 ok(
res == (ch1 - ch2),
"wrong result %d %04x %04x\n",
res, ch1, ch2 );
1884 res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1,
TRUE );
1885 ok(
res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)),
1886 "wrong result %d %04x %04x\n",
res, ch1, ch2 );
1892static const WCHAR szGuid[] = {
'{',
'0',
'1',
'0',
'2',
'0',
'3',
'0',
'4',
'-',
1893 '0',
'5',
'0',
'6',
'-' ,
'0',
'7',
'0',
'8',
'-',
'0',
'9',
'0',
'A',
'-',
1894 '0',
'B',
'0',
'C',
'0',
'D',
'0',
'E',
'0',
'F',
'0',
'A',
'}',
'\0' };
1895static const WCHAR szGuid2[] = {
'{',
'0',
'1',
'0',
'2',
'0',
'3',
'0',
'4',
'-',
1896 '0',
'5',
'0',
'6',
'-' ,
'0',
'7',
'0',
'8',
'-',
'0',
'9',
'0',
'A',
'-',
1897 '0',
'B',
'0',
'C',
'0',
'D',
'0',
'E',
'0',
'F',
'0',
'A',
']',
'\0' };
1898DEFINE_GUID(IID_Endianness, 0x01020304, 0x0506, 0x0708, 0x09, 0x0A, 0x0B,
1899 0x0C, 0x0D, 0x0E, 0x0F, 0x0A);
1907 if (!pRtlGUIDFromString)
1909 win_skip(
"RtlGUIDFromString is not available\n");
1917 ok(
ret == 0,
"expected ret=0, got 0x%0x\n",
ret);
1924 ok(
ret,
"expected ret!=0\n");
1932 if (!pRtlStringFromGUID)
1934 win_skip(
"RtlStringFromGUID is not available\n");
1938 str.Length =
str.MaximumLength = 0;
1941 ret = pRtlStringFromGUID(&IID_Endianness, &
str);
1942 ok(
ret == 0,
"expected ret=0, got 0x%0x\n",
ret);
1944 pRtlFreeUnicodeString(&
str);
1954 { {
'T',0},
FALSE, 0x00000054 },
1955 { {
'T',
'e',
's',
't',0},
FALSE, 0x766bb952 },
1956 { {
'T',
'e',
'S',
't',0},
FALSE, 0x764bb172 },
1957 { {
't',
'e',
's',
't',0},
FALSE, 0x4745d132 },
1958 { {
't',
'e',
's',
't',0},
TRUE, 0x6689c132 },
1959 { {
'T',
'E',
'S',
'T',0},
TRUE, 0x6689c132 },
1960 { {
'T',
'E',
'S',
'T',0},
FALSE, 0x6689c132 },
1961 { {
'a',
'b',
'c',
'd',
'e',
'f',0},
FALSE, 0x971318c3 },
1967 static const WCHAR strW[] = {
'T',
'e',
's',
't',0,
'1',0};
1973 if (!pRtlHashUnicodeString)
1975 win_skip(
"RtlHashUnicodeString is not available\n");
1992 str.MaximumLength =
sizeof(
strW);
1995 ok(
hash == 0x32803083,
"got 0x%08x\n",
hash);
2004 ok(
hash ==
ptr->hash,
"got wrong hash 0x%08x, expected 0x%08x, for %s, mode %d\n",
hash,
ptr->hash,
2021 { {
'-',0x7f,
'-',0x80,
'-',0xff,
'-',0x100,
'-',0 },
"-\x7F-\xC2\x80-\xC3\xBF-\xC4\x80-",
STATUS_SUCCESS },
2022 { {
'-',0x7ff,
'-',0x800,
'-',0 },
"-\xDF\xBF-\xE0\xA0\x80-",
STATUS_SUCCESS },
2023 { {
'-',0xd7ff,
'-',0xe000,
'-',0 },
"-\xED\x9F\xBF-\xEE\x80\x80-",
STATUS_SUCCESS },
2025 { {
'-',0xffff,
'-',0xd800,0xdc00,
'-',0 },
"-\xEF\xBF\xBF-\xF0\x90\x80\x80-",
STATUS_SUCCESS },
2027 { {
'-',0xd800,0xdfff,
'-',0xd801,0xdc00,
'-',0 },
"-\xF0\x90\x8F\xBF-\xF0\x90\x90\x80-",
STATUS_SUCCESS },
2029 { {
'-',0xdbff,0xdfff,
'-',0 },
"-\xF4\x8F\xBF\xBF-",
STATUS_SUCCESS },
2037 { {
'-',0xfeff,
'-',0xfffe,
'-',0 },
"-\xEF\xBB\xBF-\xEF\xBF\xBE-",
STATUS_SUCCESS },
2044 { {
'-',0x0107,0x0327,
'-',0 },
"-\xC4\x87\xCC\xA7-",
STATUS_SUCCESS },
2045 { {
'-',0x00e7,0x0301,
'-',0 },
"-\xC3\xA7\xCC\x81-",
STATUS_SUCCESS },
2046 { {
'-',0x0063,0x0327,0x0301,
'-',0 },
"-\x63\xCC\xA7\xCC\x81-",
STATUS_SUCCESS },
2047 { {
'-',0x0063,0x0301,0x0327,
'-',0 },
"-\x63\xCC\x81\xCC\xA7-",
STATUS_SUCCESS },
2057 unsigned char *
buf = (
unsigned char *)
buffer;
2060 if (buflen == (
ULONG)-1)
2062 bytes_out = 0x55555555;
2064 status = pRtlUnicodeToUTF8N(
2065 out_string ?
buffer :
NULL, buflen, &bytes_out,
2066 in_string, in_bytes);
2068 ok_(__FILE__,
line)(bytes_out == out_bytes,
"bytes_out = %u\n", bytes_out);
2071 for (
i = 0;
i < bytes_out;
i++)
2073 "buffer[%d] = 0x%x, expected 0x%x\n",
2074 i,
buf[
i], out_string[
i]);
2077 "buffer[%d] = 0x%x, expected 0x55\n",
2081#define utf8_expect(out_string, buflen, out_bytes, in_string, in_bytes, expect_status) \
2082 utf8_expect_(out_string, buflen, out_bytes, in_string, in_bytes, expect_status, __LINE__)
2088 ULONG bytes_out_array[2];
2089 void *
const invalid_pointer = (
void *)0x8;
2091 const WCHAR empty_string[] = { 0 };
2093 const WCHAR special_string[] = {
'X',0x80,0xd800,0 };
2094 const unsigned char special_expected[] = {
'X',0xc2,0x80,0xef,0xbf,0xbd,0 };
2095 unsigned int input_len;
2099 if (!pRtlUnicodeToUTF8N)
2101 skip(
"RtlUnicodeToUTF8N unavailable\n");
2106 memset(bytes_out_array, 0x55,
sizeof(bytes_out_array));
2107 status = pRtlUnicodeToUTF8N(
NULL, 0, bytes_out_array, empty_string, 0);
2109 ok(bytes_out_array[0] == 0x00000000,
"Got 0x%x\n", bytes_out_array[0]);
2110 ok(bytes_out_array[1] == 0x55555555,
"Got 0x%x\n", bytes_out_array[1]);
2119 bytes_out = 0x55555555;
2122 ok(bytes_out == 0x55555555,
"bytes_out = 0x%x\n", bytes_out);
2124 bytes_out = 0x55555555;
2125 status = pRtlUnicodeToUTF8N(
NULL, 0, &bytes_out, invalid_pointer, 0);
2127 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2129 bytes_out = 0x55555555;
2130 status = pRtlUnicodeToUTF8N(
NULL, 0, &bytes_out, empty_string, 0);
2132 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2134 bytes_out = 0x55555555;
2137 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2139 bytes_out = 0x55555555;
2140 status = pRtlUnicodeToUTF8N(
NULL, 0, &bytes_out, empty_string, 1);
2142 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2144 bytes_out = 0x55555555;
2145 status = pRtlUnicodeToUTF8N(invalid_pointer, 0, &bytes_out, empty_string, 1);
2147 ok(bytes_out == 0x55555555,
"bytes_out = 0x%x\n", bytes_out);
2149 bytes_out = 0x55555555;
2150 status = pRtlUnicodeToUTF8N(invalid_pointer, 8, &bytes_out, empty_string, 1);
2152 ok(bytes_out == 0x55555555,
"bytes_out = 0x%x\n", bytes_out);
2155#define length_expect(in_chars, out_bytes, expect_status) \
2156 utf8_expect_(NULL, 0, out_bytes, \
2157 special_string, in_chars * sizeof(WCHAR), \
2158 expect_status, __LINE__)
2168#define truncate_expect(buflen, out_bytes, expect_status) \
2169 utf8_expect_(special_expected, buflen, out_bytes, \
2170 special_string, sizeof(special_string), \
2171 expect_status, __LINE__)
2181#undef truncate_expect
2184 for (input_len = 0; input_len <=
sizeof(
test_string); input_len++) {
2190 bytes_out = 0x55555555;
2192 status = pRtlUnicodeToUTF8N(
2195 if (input_len %
sizeof(
WCHAR) == 0) {
2197 "(len %u): status = 0x%x\n", input_len,
status);
2198 ok(bytes_out == input_len /
sizeof(
WCHAR),
2199 "(len %u): bytes_out = 0x%x\n", input_len, bytes_out);
2200 for (
i = 0;
i < bytes_out;
i++) {
2202 "(len %u): buffer[%d] = 0x%x, expected 0x%x\n",
2207 "(len %u): buffer[%d] = 0x%x\n", input_len,
i,
buffer[
i]);
2211 "(len %u): status = 0x%x\n", input_len,
status);
2212 ok(bytes_out == 0x55555555,
2213 "(len %u): bytes_out = 0x%x\n", input_len, bytes_out);
2216 "(len %u): buffer[%d] = 0x%x\n", input_len,
i,
buffer[
i]);
2223 bytes_out = 0x55555555;
2225 status = pRtlUnicodeToUTF8N(
2229 "(test %d): status is 0x%x, expected 0x%x\n",
2232 "(test %d): bytes_out is %u, expected %u\n",
2235 "(test %d): got \"%.*s\", expected \"%s\"\n",
2238 "(test %d): behind string: 0x%x\n",
i,
buffer[bytes_out]);
2241 bytes_out = 0x55555555;
2243 status = pRtlUnicodeToUTF8N(
2247 "(test %d): status is 0x%x, expected 0x%x\n",
2250 "(test %d): bytes_out is %u, expected %u\n",
2253 "(test %d): got \"%.*s\", expected \"%s\"\n",
2256 "(test %d): behind string: 0x%x\n",
i,
buffer[bytes_out]);
2271 {
"-\x7F-\xC2\x80-\xC3\xBF-\xC4\x80-", {
'-',0x7f,
'-',0x80,
'-',0xff,
'-',0x100,
'-',0 },
STATUS_SUCCESS },
2272 {
"-\xDF\xBF-\xE0\xA0\x80-", {
'-',0x7ff,
'-',0x800,
'-',0 },
STATUS_SUCCESS },
2273 {
"-\xED\x9F\xBF-\xEE\x80\x80-", {
'-',0xd7ff,
'-',0xe000,
'-',0 },
STATUS_SUCCESS },
2275 {
"-\xEF\xBF\xBF-\xF0\x90\x80\x80-", {
'-',0xffff,
'-',0xd800,0xdc00,
'-',0 },
STATUS_SUCCESS },
2277 {
"-\xF0\x90\x8F\xBF-\xF0\x90\x90\x80-", {
'-',0xd800,0xdfff,
'-',0xd801,0xdc00,
'-',0 },
STATUS_SUCCESS },
2279 {
"-\xF4\x8F\xBF\xBF-", {
'-',0xdbff,0xdfff,
'-',0 },
STATUS_SUCCESS },
2282 {
"-\xED\xA0\x80-\xED\xAF\xBF-", {
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2284 {
"-\xED\xB0\x80-\xED\xBF\xBF-", {
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2297 {
"-\xFA\x80\x80\x80\x80-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2299 {
"-\xFB\xBF\xBF\xBF\xBF-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2301 {
"-\xFC\x84\x80\x80\x80\x80-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2303 {
"-\xFD\xBF\xBF\xBF\xBF\xBF-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2305 {
"-\xC0\xAD-\xC0\x80-\xC1\xBF-", {
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2306 {
"-\xE0\x80\xAD-\xE0\x80\x80-\xE0\x9F\xBF-", {
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2310 {
"-\xF8\x80\x80\x80\xAD-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2311 {
"-\xF8\x80\x80\x80\x80-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2312 {
"-\xF8\x87\xBF\xBF\xBF-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2313 {
"-\xFC\x80\x80\x80\x80\xAD-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2314 {
"-\xFC\x80\x80\x80\x80\x80-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2315 {
"-\xFC\x83\xBF\xBF\xBF\xBF-", {
'-',0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,
'-',0 },
STATUS_SOME_NOT_MAPPED },
2319 {
"\xFE\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF", { 0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0 },
STATUS_SOME_NOT_MAPPED },
2320 {
"\xFF\xBF\xBF\xBF\xBF\xBF\xBF\xBF\xBF", { 0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0 },
STATUS_SOME_NOT_MAPPED },
2321 {
"\xFF\x80\x80\x80\x80\x80\x80\x80\x80", { 0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0 },
STATUS_SOME_NOT_MAPPED },
2322 {
"\xFF\x40\x80\x80\x80\x80\x80\x80\x80", { 0xfffd,0x40,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0xfffd,0 },
STATUS_SOME_NOT_MAPPED },
2338 {
"-\xEF\xBB\xBF-\xEF\xBF\xBE-", {
'-',0xfeff,
'-',0xfffe,
'-',0 },
STATUS_SUCCESS },
2346 {
"-\xC4\x87\xCC\xA7-", {
'-',0x0107,0x0327,
'-',0 },
STATUS_SUCCESS },
2347 {
"-\xC3\xA7\xCC\x81-", {
'-',0x00e7,0x0301,
'-',0 },
STATUS_SUCCESS },
2348 {
"-\x63\xCC\xA7\xCC\x81-", {
'-',0x0063,0x0327,0x0301,
'-',0 },
STATUS_SUCCESS },
2349 {
"-\x63\xCC\x81\xCC\xA7-", {
'-',0x0063,0x0301,0x0327,
'-',0 },
STATUS_SUCCESS },
2353 const char *in_string,
ULONG in_chars,
2361 if (buflen == (
ULONG)-1)
2363 bytes_out = 0x55555555;
2365 status = pRtlUTF8ToUnicodeN(
2366 out_string ?
buffer :
NULL, buflen, &bytes_out,
2367 in_string, in_chars);
2369 ok_(__FILE__,
line)(bytes_out == out_chars *
sizeof(
WCHAR),
2370 "bytes_out = %u, expected %u\n", bytes_out, out_chars * (
ULONG)
sizeof(
WCHAR));
2373 for (
i = 0;
i < bytes_out /
sizeof(
WCHAR);
i++)
2375 "buffer[%d] = 0x%x, expected 0x%x\n",
2379 "buffer[%d] = 0x%x, expected 0x5555\n",
2383#define unicode_expect(out_string, buflen, out_chars, in_string, in_chars, expect_status) \
2384 unicode_expect_(out_string, buflen, out_chars, in_string, in_chars, expect_status, __LINE__)
2390 ULONG bytes_out_array[2];
2391 void *
const invalid_pointer = (
void *)0x8;
2393 const char empty_string[] =
"";
2395 const WCHAR test_stringW[] = {
'A',0,
'a',
'b',
'c',
'd',
'e',
'f',
'g',0 };
2396 const char special_string[] = {
'X',0xc2,0x80,0xF0,0x90,0x80,0x80,0 };
2397 const WCHAR special_expected[] = {
'X',0x80,0xd800,0xdc00,0 };
2398 unsigned int input_len;
2402 if (!pRtlUTF8ToUnicodeN)
2404 skip(
"RtlUTF8ToUnicodeN unavailable\n");
2409 memset(bytes_out_array, 0x55,
sizeof(bytes_out_array));
2410 status = pRtlUTF8ToUnicodeN(
NULL, 0, bytes_out_array, empty_string, 0);
2412 ok(bytes_out_array[0] == 0x00000000,
"Got 0x%x\n", bytes_out_array[0]);
2413 ok(bytes_out_array[1] == 0x55555555,
"Got 0x%x\n", bytes_out_array[1]);
2422 bytes_out = 0x55555555;
2425 ok(bytes_out == 0x55555555,
"bytes_out = 0x%x\n", bytes_out);
2427 bytes_out = 0x55555555;
2428 status = pRtlUTF8ToUnicodeN(
NULL, 0, &bytes_out, invalid_pointer, 0);
2430 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2432 bytes_out = 0x55555555;
2433 status = pRtlUTF8ToUnicodeN(
NULL, 0, &bytes_out, empty_string, 0);
2435 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2437 bytes_out = 0x55555555;
2440 ok(bytes_out == 0,
"bytes_out = 0x%x\n", bytes_out);
2442 bytes_out = 0x55555555;
2443 status = pRtlUTF8ToUnicodeN(
NULL, 0, &bytes_out, empty_string, 1);
2445 ok(bytes_out ==
sizeof(
WCHAR),
"bytes_out = 0x%x\n", bytes_out);
2448#define length_expect(in_chars, out_chars, expect_status) \
2449 unicode_expect_(NULL, 0, out_chars, special_string, in_chars, \
2450 expect_status, __LINE__)
2464#define truncate_expect(buflen, out_chars, expect_status) \
2465 unicode_expect_(special_expected, buflen, out_chars, \
2466 special_string, sizeof(special_string), \
2467 expect_status, __LINE__)
2480#undef truncate_expect
2483 for (input_len = 0; input_len <=
sizeof(
test_string); input_len++) {
2495 bytes_out = 0x55555555;
2497 status = pRtlUTF8ToUnicodeN(
2501 "(test %d): status is 0x%x, expected 0x%x\n",
2504 "(test %d): bytes_out is %u, expected %u\n",
2507 "(test %d): got %s, expected %s\n",
2510 "(test %d): behind string: 0x%x\n",
i,
buffer[bytes_out]);
2513 bytes_out = 0x55555555;
2515 status = pRtlUTF8ToUnicodeN(
2519 "(test %d): status is 0x%x, expected 0x%x\n",
2522 "(test %d): bytes_out is %u, expected %u\n",
2525 "(test %d): got %s, expected %s\n",
2528 "(test %d): behind string: 0x%x\n",
i,
buffer[bytes_out]);
2535 if (pRtlInitAnsiString) {
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
#define GetProcAddress(x, y)
#define HeapFree(x, y, z)
#define MultiByteToWideChar
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
UNICODE_STRING * PUNICODE_STRING
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
int WINAPI lstrlenA(LPCSTR lpString)
#define memcpy(s1, s2, n)
static void test_RtlIntegerToUnicodeString(void)
#define HASH_STRING_ALGORITHM_INVALID
static void test_RtlIntegerToChar(void)
#define NB_FIND_CH_IN_USTR
static WCHAR * AtoW(const char *p)
static const ustr2astr_t ustr2astr[]
static void one_RtlIntegerToUnicodeString_test(int test_num, const int2str_t *int2str)
static const str2int_t str2int[]
static void test_RtlDowncaseUnicodeString(void)
static void test_RtlUnicodeStringToAnsiString(void)
static void test_RtlUpcaseUnicodeString(void)
static void test_RtlCopyString(void)
static void utf8_expect_(const unsigned char *out_string, ULONG buflen, ULONG out_bytes, const WCHAR *in_string, ULONG in_bytes, NTSTATUS expect_status, int line)
static void test_RtlUpcaseUnicodeChar(void)
#define truncate_expect(buflen, out_bytes, expect_status)
static void test_RtlHashUnicodeString(void)
static void test_RtlAppendUnicodeStringToString(void)
static void test_RtlIsTextUnicode(void)
static const app_asc2str_t app_asc2str[]
static const struct hash_unicodestring_test hash_test[]
#define HASH_STRING_ALGORITHM_X65599
static const struct unicode_to_utf8_test unicode_to_utf8[]
static void test_RtlInitString(void)
static void test_RtlGUIDFromString(void)
static void test_RtlAppendStringToString(void)
static void test_RtlUpperString(void)
static void test_RtlUnicodeStringToInteger(void)
static void test_RtlDuplicateUnicodeString(void)
static const app_ustr2str_t app_ustr2str[]
#define utf8_expect(out_string, buflen, out_bytes, in_string, in_bytes, expect_status)
#define length_expect(in_chars, out_bytes, expect_status)
static const int2str_t int2str[]
static const STRING *static UNICODE_STRING *static GUID *static UNICODE_STRING *static INT
static void test_RtlAppendAsciizToString(void)
static void test_RtlUnicodeToUTF8N(void)
static void InitFunctionPtrs(void)
static const struct utf8_to_unicode_test utf8_to_unicode[]
static void test_RtlAppendUnicodeToString(void)
static void test_RtlInitUnicodeStringEx(void)
static const STRING *static const UNICODE_STRING *static LPCWSTR
#define STRI_BUFFER_LENGTH
static void test_RtlCompareUnicodeString(void)
static void test_RtlStringFromGUID(void)
static void unicode_expect_(const WCHAR *out_string, ULONG buflen, ULONG out_chars, const char *in_string, ULONG in_chars, NTSTATUS expect_status, int line)
static void test_RtlUpperChar(void)
static void test_RtlFindCharInUnicodeString(void)
static const WCHAR szGuid[]
#define unicode_expect(out_string, buflen, out_chars, in_string, in_chars, expect_status)
static void test_RtlInitUnicodeString(void)
static const app_str2str_t app_str2str[]
static UNICODE_STRING *static LONG
static const WCHAR szGuid2[]
static const app_uni2str_t app_uni2str[]
static void one_RtlIntegerToChar_test(int test_num, const int2str_t *int2str)
static void test_RtlCharToInteger(void)
static void test_RtlUTF8ToUnicodeN(void)
static const dupl_ustr_t dupl_ustr[]
static const find_ch_in_ustr_t find_ch_in_ustr[]
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_INVALID_PARAMETER_4
#define STATUS_SOME_NOT_MAPPED
#define STATUS_ACCESS_VIOLATION
#define STATUS_INVALID_PARAMETER_5
#define STATUS_NAME_TOO_LONG
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
const char * search_chars
const UNICODE_STRING * PCUNICODE_STRING
#define STATUS_INVALID_PARAMETER
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
#define IS_TEXT_UNICODE_UNICODE_MASK
#define IS_TEXT_UNICODE_REVERSE_ASCII16
#define IS_TEXT_UNICODE_REVERSE_CONTROLS
#define IS_TEXT_UNICODE_REVERSE_MASK
#define IS_TEXT_UNICODE_CONTROLS
#define IS_TEXT_UNICODE_ODD_LENGTH
#define IS_TEXT_UNICODE_REVERSE_SIGNATURE
#define IS_TEXT_UNICODE_STATISTICS
#define IS_TEXT_UNICODE_REVERSE_STATISTICS