27#define ULL(a,b) (((ULONG64)(a) << 32) | (b))
57 static const WCHAR test[] = {
't',
'e',
's',
't',0};
59 static const WCHAR te[] = {
't',
'e',0};
60 static const WCHAR st[] = {
's',
't',0};
61 static const WCHAR t[] = {
't',0};
62 static const WCHAR e[] = {
'e',0};
63 static const WCHAR s[] = {
's',0};
64 static const WCHAR fmt_null[] = {
'%',0};
65 static const WCHAR fmt_tnull[] = {
't',
'e',
's',
't',
'%',0};
66 static const WCHAR fmt_1[] = {
'%',
'1',0};
67 static const WCHAR fmt_12[] = {
'%',
'1',
'%',
'2',0};
68 static const WCHAR fmt_123[] = {
'%',
'1',
'%',
'3',
'%',
'2',
'%',
'1',0};
69 static const WCHAR fmt_123c[] = {
'%',
'1',
'!',
'c',
'!',
'%',
'2',
'!',
'c',
'!',
'%',
'3',
'!',
'c',
'!',
'%',
'1',
'!',
'c',
'!',0};
70 static const WCHAR fmt_123lc[] = {
'%',
'1',
'!',
'l',
'c',
'!',
'%',
'2',
'!',
'l',
'c',
'!',
'%',
'3',
'!',
'l',
'c',
'!',
'%',
'1',
'!',
'l',
'c',
'!',0};
71 static const WCHAR fmt_123wc[] = {
'%',
'1',
'!',
'w',
'c',
'!',
'%',
'2',
'!',
'w',
'c',
'!',
'%',
'3',
'!',
'w',
'c',
'!',
'%',
'1',
'!',
'w',
'c',
'!',0};
72 static const WCHAR fmt_123C[] = {
'%',
'1',
'!',
'C',
'!',
'%',
'2',
'!',
'C',
'!',
'%',
'3',
'!',
'C',
'!',
'%',
'1',
'!',
'C',
'!',0};
73 static const WCHAR fmt_123d[] = {
'%',
'1',
'!',
'd',
'!',
'%',
'2',
'!',
'd',
'!',
'%',
'3',
'!',
'd',
'!',0};
74 static const WCHAR fmt_1s[] = {
'%',
'1',
'!',
's',
'!',0};
75 static const WCHAR fmt_s[] = {
'%',
'!',
's',
'!',0};
76 static const WCHAR fmt_ls[] = {
'%',
'!',
'l',
's',
'!',0};
77 static const WCHAR fmt_ws[] = {
'%',
'!',
'w',
's',
'!',0};
78 static const WCHAR fmt_S[] = {
'%',
'!',
'S',
'!',0};
79 static const WCHAR fmt_14d[] = {
'%',
'1',
'!',
'4',
'd',
'!',0};
80 static const WCHAR fmt_14x[] = {
'%',
'1',
'!',
'4',
'x',
'!',0};
81 static const WCHAR fmt_14X[] = {
'%',
'1',
'!',
'4',
'X',
'!',0};
82 static const WCHAR fmt_1_4X[] = {
'%',
'1',
'!',
'-',
'4',
'X',
'!',0};
83 static const WCHAR fmt_1_4d[] = {
'%',
'1',
'!',
'-',
'4',
'd',
'!',0};
84 static const WCHAR fmt_2pct[] = {
' ',
'%',
'%',
'%',
'%',
' ',0};
85 static const WCHAR fmt_2dot1d[] = {
' ',
'%',
'.',
'%',
'.',
' ',
' ',
'%',
'1',
'!',
'd',
'!',0};
86 static const WCHAR fmt_t0t[] = {
't',
'e',
's',
't',
'%',
'0',
't',
'e',
's',
't',0};
87 static const WCHAR fmt_yah[] = {
'y',
'a',
'h',
'%',
'!',
'%',
'0',
' ',
' ',
' ',0};
88 static const WCHAR fmt_space[] = {
'%',
' ',
'%',
' ',
' ',
' ',0};
89 static const WCHAR fmt_nrt[] = {
'%',
'n',
'%',
'r',
'%',
't',0};
90 static const WCHAR fmt_hi_lf[] = {
'h',
'i',
'\n',0};
91 static const WCHAR fmt_hi_crlf[] = {
'h',
'i',
'\r',
'\n',0};
92 static const WCHAR fmt_cr[] = {
'\r',0};
93 static const WCHAR fmt_crcrlf[] = {
'\r',
'\r',
'\n',0};
94 static const WCHAR fmt_13s[] = {
'%',
'1',
'!',
'3',
's',
'!',0};
95 static const WCHAR fmt_1os[] = {
'%',
'1',
'!',
'*',
's',
'!',0};
96 static const WCHAR fmt_142u[] = {
'%',
'1',
'!',
'4',
'.',
'2',
'u',
'!',0};
97 static const WCHAR fmt_1oou[] = {
'%',
'1',
'!',
'*',
'.',
'*',
'u',
'!',0};
98 static const WCHAR fmt_1oou1oou[] = {
'%',
'1',
'!',
'*',
'.',
'*',
'u',
'!',
',',
'%',
'1',
'!',
'*',
'.',
'*',
'u',
'!',0};
99 static const WCHAR fmt_1oou3oou[] = {
'%',
'1',
'!',
'*',
'.',
'*',
'u',
'!',
',',
'%',
'3',
'!',
'*',
'.',
'*',
'u',
'!',0};
100 static const WCHAR fmt_1oou4oou[] = {
'%',
'1',
'!',
'*',
'.',
'*',
'u',
'!',
',',
'%',
'4',
'!',
'*',
'.',
'*',
'u',
'!',0};
102 static const WCHAR s_123d[] = {
'1',
'2',
'3',0};
103 static const WCHAR s_14d[] = {
' ',
' ',
' ',
'1',0};
104 static const WCHAR s_14x[] = {
' ',
' ',
' ',
'b',0};
105 static const WCHAR s_14X[] = {
' ',
' ',
' ',
'B',0};
106 static const WCHAR s_1_4X[] = {
'B',
' ',
' ',
' ',0};
107 static const WCHAR s_14d2[] = {
' ',
' ',
'1',
'1',0};
108 static const WCHAR s_1_4d[] = {
'1',
' ',
' ',
' ',0};
109 static const WCHAR s_1AB[] = {
' ',
'1',
'A',
'B',0};
110 static const WCHAR s_2pct[] = {
' ',
'%',
'%',
' ',0};
111 static const WCHAR s_2dot147[] = {
' ',
'.',
'.',
' ',
' ',
'4',
'2',
'7',0};
112 static const WCHAR s_yah[] = {
'y',
'a',
'h',
'!',0};
113 static const WCHAR s_space[] = {
' ',
' ',
' ',
' ',0};
114 static const WCHAR s_nrt[] = {
'\r',
'\n',
'\r',
'\t',0};
115 static const WCHAR s_hi_crlf[] = {
'h',
'i',
'\r',
'\n',0};
116 static const WCHAR s_crlf[] = {
'\r',
'\n',0};
117 static const WCHAR s_crlfcrlf[] = {
'\r',
'\n',
'\r',
'\n',0};
118 static const WCHAR s_hi_sp[] = {
'h',
'i',
' ',0};
119 static const WCHAR s_sp[] = {
' ',0};
120 static const WCHAR s_2sp[] = {
' ',
' ',0};
121 static const WCHAR s_spt[] = {
' ',
' ',
't',0};
122 static const WCHAR s_sp3t[] = {
' ',
' ',
' ',
't',0};
123 static const WCHAR s_sp03[] = {
' ',
' ',
'0',
'3',0};
124 static const WCHAR s_sp001[] = {
' ',
' ',
'0',
'0',
'1',0};
125 static const WCHAR s_sp001002[] = {
' ',
' ',
'0',
'0',
'1',
',',
' ',
'0',
'0',
'0',
'2',0};
126 static const WCHAR s_sp001sp002[] = {
' ',
' ',
'0',
'0',
'1',
',',
' ',
' ',
'0',
'0',
'0',
'2',0};
127 static const WCHAR s_sp002sp001[] = {
' ',
' ',
'0',
'0',
'0',
'2',
',',
' ',
' ',
'0',
'0',
'1',0};
128 static const WCHAR s_sp002sp003[] = {
' ',
' ',
'0',
'0',
'0',
'2',
',',
' ',
'0',
'0',
'0',
'0',
'3',0};
129 static const WCHAR s_sp001004[] = {
' ',
' ',
'0',
'0',
'1',
',',
'0',
'0',
'0',
'0',
'0',
'4',0};
130 static const WCHAR s_null[] = {
'(',
'n',
'u',
'l',
'l',
')',0};
132 static const WCHAR init_buf[] = {
'x',
'x',
'x',
'x',
'x',
'x'};
133 static const WCHAR broken_buf[] = {
't',
'e',
's',
't',
'x',
'x'};
142 ok(
r==4,
"failed: r=%d\n",
r);
160 ok(
r==0,
"succeeded: r=%d\n",
r);
170 "Expected the buffer to be unchanged\n");
171 ok(
r==0,
"succeeded: r=%d\n",
r);
182 "Expected the buffer to be unchanged\n");
183 ok(
r==0,
"succeeded: r=%d\n",
r);
193 "Expected the buffer to be unchanged\n");
194 ok(
r==0,
"succeeded: r=%d\n",
r);
203 "Expected the buffer to be unchanged\n");
204 ok(
r==0,
"succeeded: r=%d\n",
r);
211 ok(
r==4,
"failed: r=%d\n",
r);
217 ok(
r==4,
"failed: r=%d\n",
r);
223 ok(
r==4,
"failed: r=%d\n",
r);
229 ok(
r==4,
"failed: r=%d\n",
r);
235 ok(
r==3,
"failed: r=%d\n",
r);
241 ok(
r==4,
"failed: r=%d\n",
r);
247 ok(
r==3,
"failed: r=%d\n",
r);
253 ok(
r==4,
"failed: r=%d\n",
r);
259 ok(
r==4,
"failed: r=%d\n",
r);
265 ok(
r==4,
"failed: r=%d\n",
r);
271 ok(
r==4,
"failed: r=%d\n",
r);
277 ok(
r==4,
"failed: r=%d\n",
r);
283 ok(
r==3,
"failed: r=%d\n",
r);
289 ok(
r==4,
"failed: r=%d\n",
r);
295 ok(
r==4,
"failed: r=%d\n",
r);
301 ok(
r==4,
"failed: r=%d\n",
r);
307 ok(
r==4,
"failed: r=%d\n",
r);
313 ok(
r==4,
"failed: r=%d\n",
r);
319 ok(
r==4,
"failed: r=%d\n",
r);
325 ok(
r==4,
"failed: r=%d\n",
r);
331 ok(
r==4,
"failed: r=%d\n",
r);
337 ok(
r==8,
"failed: r=%d\n",
r);
343 ok(
r==4,
"failed: r=%d\n",
r);
349 ok(
r==4,
"failed: r=%d\n",
r);
355 ok(
r==4,
"failed: r=%d\n",
r);
361 ok(
r==4,
"failed: r=%d\n",
r);
367 ok(
r==4,
"failed: r=%d\n",
r);
373 ok(
r==4,
"failed: r=%d\n",
r);
379 ok(
r==2,
"failed: r=%d\n",
r);
385 ok(
r==4,
"failed: r=%d\n",
r);
391 ok(
r==6,
"failed: r=%d\n",
r);
398 ok(
r==3,
"failed: r=%d\n",
r);
402 ok(
r==4,
"failed: r=%d\n",
r);
406 ok(
r==4,
"failed: r=%d\n",
r);
410 ok(
r==5,
"failed: r=%d\n",
r);
412 0, 0,
out,
sizeof(
out)/
sizeof(
WCHAR), 5, 3, 1, 4, 2 );
414 ok(
r==11,
"failed: r=%d\n",
r);
416 0, 0,
out,
sizeof(
out)/
sizeof(
WCHAR), 5, 3, 1, 6, 4, 2 );
420 ok(
r==12,
"failed: r=%d\n",
r);
427 ok(
r==13,
"failed: r=%d\n",
r);
431 ok(
r==12,
"failed: r=%d\n",
r);
440 ok(
r==3,
"failed: r=%d\n",
r);
446 ok(
r==3,
"failed: r=%d\n",
r);
452 ok(
r==1,
"failed: r=%d\n",
r);
458 ok(
r==2,
"failed: r=%d\n",
r);
465 static const char init_buf[] = {
'x',
'x',
'x',
'x',
'x',
'x'};
466 static const WCHAR szwTest[] = {
't',
'e',
's',
't',0};
472 ok(
r==4,
"failed: r=%d\n",
r);
488 ok(!
memcmp(
out, init_buf,
sizeof(init_buf)),
"Expected the buffer to be untouched\n");
489 ok(
r==0,
"succeeded: r=%d\n",
r);
499 "Expected the buffer to be untouched\n");
500 ok(
r==0,
"succeeded: r=%d\n",
r);
510 "Expected the buffer to be untouched\n");
511 ok(
r==0,
"succeeded: r=%d\n",
r);
520 ok(!
memcmp(
out, init_buf,
sizeof(init_buf)),
"Expected the buffer to be untouched\n");
521 ok(
r==0,
"succeeded: r=%d\n",
r);
528 ok(!
memcmp(
out, init_buf,
sizeof(init_buf)),
"Expected the buffer to be untouched\n");
529 ok(
r==0,
"succeeded: r=%d\n",
r);
536 ok(
r==4,
"failed: r=%d\n",
r);
542 ok(
r==4,
"failed: r=%d\n",
r);
548 ok(
r==4,
"failed: r=%d\n",
r);
552 0,
out,
sizeof(
out)/
sizeof(
CHAR),
"t",
"s",
"e");
554 ok(
r==4,
"failed: r=%d\n",
r);
560 ok(
r==3,
"failed: r=%d\n",
r);
566 ok(
r==4,
"failed: r=%d\n",
r);
572 ok(
r==4,
"failed: r=%d\n",
r);
578 ok(
r==4,
"failed: r=%d\n",
r);
582 0,
out,
sizeof(
out)/
sizeof(
CHAR),
't',
'e',
's');
584 ok(
r==4,
"failed: r=%d\n",
r);
588 0,
out,
sizeof(
out)/
sizeof(
CHAR),
't',
'e',
's');
590 ok(
r==4,
"failed: r=%d\n",
r);
594 0,
out,
sizeof(
out)/
sizeof(
CHAR),
't',
'e',
's');
596 ok(
r==4,
"failed: r=%d\n",
r);
600 0,
out,
sizeof(
out)/
sizeof(
CHAR),
't',
'e',
's');
602 ok(
r==4,
"failed: r=%d\n",
r);
608 ok(
r==3,
"failed: r=%d\n",
r);
614 ok(
r==4,
"failed: r=%d\n",
r);
620 ok(
r==4,
"failed: r=%d\n",
r);
626 ok(
r==4,
"failed: r=%d\n",
r);
632 ok(
r==4,
"failed: r=%d\n",
r);
638 ok(
r==4,
"failed: r=%d\n",
r);
644 ok(
r==4,
"failed: r=%d\n",
r);
650 ok(
r==4,
"failed: r=%d\n",
r);
656 ok(
r==4,
"failed: r=%d\n",
r);
662 ok(
r==7,
"failed: r=%d\n",
r);
668 ok(
r==4,
"failed: r=%d\n",
r);
674 ok(
r==4,
"failed: r=%d\n",
r);
680 ok(
r==4,
"failed: r=%d\n",
r);
686 ok(
r==4,
"failed: r=%d\n",
r);
692 ok(
r==4,
"failed: r=%d\n",
r);
698 ok(
r==4,
"failed: r=%d\n",
r);
704 ok(
r==2,
"failed: r=%d\n",
r);
710 ok(
r==4,
"failed: r=%d\n",
r);
716 ok(
r==6,
"failed: r=%d\n",
r);
721 0, 0,
out,
sizeof(
out),
"t" );
723 ok(
r==3,
"failed: r=%d\n",
r);
725 0, 0,
out,
sizeof(
out), 4,
"t");
730 ok(
r==4,
"failed: r=%d\n",
r);
732 0, 0,
out,
sizeof(
out), 3 );
734 ok(
r==4,
"failed: r=%d\n",
r);
736 0, 0,
out,
sizeof(
out), 5, 3, 1 );
738 ok(
r==5,
"failed: r=%d\n",
r);
740 0, 0,
out,
sizeof(
out), 5, 3, 1, 4, 2 );
742 ok(
r==11,
"failed: r=%d\n",
r);
744 0, 0,
out,
sizeof(
out), 5, 3, 1, 6, 4, 2 );
749 "failed out=[%s]\n",
out);
750 ok(
r==12,
"failed: r=%d\n",
r);
757 ok(
r==13,
"failed: r=%d\n",
r);
761 ok(
r==12,
"failed: r=%d\n",
r);
771 ok(
r==3,
"failed: r=%d\n",
r);
777 ok(
r==3,
"failed: r=%d\n",
r);
783 ok(
r==1,
"failed: r=%d\n",
r);
789 ok(
r==2,
"failed: r=%d\n",
r);
794 static const char init_buf[] = {
'x',
'x',
'x',
'x',
'x'};
801 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
802 ok(!
strcmp(
"test",
out),
"Expected output string \"test\", got %s\n",
out);
807 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
808 ok(!
strcmp(
"test",
out),
"Expected output string \"test\", got %s\n",
out);
812 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
813 ok(!
strcmp(
"test",
out),
"Expected output string \"test\", got %s\n",
out);
820 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %d\n",
ret);
821 ok(!
memcmp(
out, init_buf,
sizeof(init_buf)),
"Expected the output buffer to be untouched\n");
827 ok(
ret == 17,
"Expected FormatMessageA to return 17, got %d\n",
ret);
828 ok(!
strcmp(
"test%1%2!*.*s!%99",
out),
"Expected output string \"test%%1%%2!*.*s!%%99\", got %s\n",
out);
833 ok(
ret == 8,
"Expected FormatMessageA to return 8, got %d\n",
ret);
834 ok(!
strcmp(
"%%% %.%!",
out),
"Expected output string \"%%%%%% %%.%%!\", got %s\n",
out);
838 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
839 ok(!
strcmp(
"\r\n\r\t",
out),
"Expected output string \"\\r\\n\\r\\t\", got %s\n",
out);
844 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
845 ok(!
strcmp(
"hi\r\n",
out),
"Expected output string \"hi\\r\\n\", got %s\n",
out);
849 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
850 ok(!
strcmp(
"hi\r\n",
out),
"Expected output string \"hi\\r\\n\", got %s\n",
out);
854 ok(
ret == 2,
"Expected FormatMessageA to return 2, got %d\n",
ret);
855 ok(!
strcmp(
"\r\n",
out),
"Expected output string \"\\r\\n\", got %s\n",
out);
859 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %d\n",
ret);
860 ok(!
strcmp(
"\r\n\r\n",
out),
"Expected output string \"\\r\\n\\r\\n\", got %s\n",
out);
866 ok(!
strcmp(
"hi ",
out),
"Expected output string \"hi \", got %s\n",
out);
867 ok(
ret == 3,
"Expected FormatMessageA to return 3, got %d\n",
ret);
872 ok(
ret == 3,
"Expected FormatMessageA to return 3, got %d\n",
ret);
873 ok(!
strcmp(
"hi ",
out),
"Expected output string \"hi \", got %s\n",
out);
878 ok(
ret == 1,
"Expected FormatMessageA to return 1, got %d\n",
ret);
879 ok(!
strcmp(
" ",
out),
"Expected output string \" \", got %s\n",
out);
884 ok(
ret == 2,
"Expected FormatMessageA to return 2, got %d\n",
ret);
885 ok(!
strcmp(
" ",
out),
"Expected output string \" \", got %s\n",
out);
890 static const WCHAR test[] = {
't',
'e',
's',
't',0};
892 static const WCHAR fmt_t0[] = {
't',
'e',
's',
't',
'%',
'0',0};
893 static const WCHAR fmt_t0t[] = {
't',
'e',
's',
't',
'%',
'0',
't',
'e',
's',
't',0};
894 static const WCHAR fmt_0t[] = {
'%',
'0',
't',
'e',
's',
't',0};
895 static const WCHAR fmt_t12oos99[] = {
't',
'e',
's',
't',
'%',
'1',
'%',
'2',
'!',
'*',
'.',
'*',
's',
'!',
'%',
'9',
'9',0};
896 static const WCHAR fmt_pctspacedot[] = {
'%',
'%',
'%',
' ',
'%',
'.',
'%',
'!',0};
897 static const WCHAR fmt_nrt[] = {
'%',
'n',
'%',
'r',
'%',
't',0};
898 static const WCHAR fmt_hi_lf[] = {
'h',
'i',
'\n',0};
899 static const WCHAR fmt_hi_crlf[] = {
'h',
'i',
'\r',
'\n',0};
900 static const WCHAR fmt_cr[] = {
'\r',0};
901 static const WCHAR fmt_crcrlf[] = {
'\r',
'\r',
'\n',0};
903 static const WCHAR s_nrt[] = {
'\r',
'\n',
'\r',
'\t',0};
904 static const WCHAR s_hi_crlf[] = {
'h',
'i',
'\r',
'\n',0};
905 static const WCHAR s_crlf[] = {
'\r',
'\n',0};
906 static const WCHAR s_crlfcrlf[] = {
'\r',
'\n',
'\r',
'\n',0};
907 static const WCHAR s_hi_sp[] = {
'h',
'i',
' ',0};
908 static const WCHAR s_sp[] = {
' ',0};
909 static const WCHAR s_2sp[] = {
' ',
' ',0};
916 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
922 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
927 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
934 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %d\n",
ret);
941 ok(
ret == 17,
"Expected FormatMessageW to return 17, got %d\n",
ret);
947 ok(
ret == 8,
"Expected FormatMessageW to return 8, got %d\n",
ret);
952 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
958 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
963 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
968 ok(
ret == 2,
"Expected FormatMessageW to return 2, got %d\n",
ret);
973 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %d\n",
ret);
980 ok(
ret == 3,
"Expected FormatMessageW to return 3, got %d\n",
ret);
986 ok(
ret == 3,
"Expected FormatMessageW to return 3, got %d\n",
ret);
992 ok(
ret == 1,
"Expected FormatMessageW to return 1, got %d\n",
ret);
998 ok(
ret == 2,
"Expected FormatMessageW to return 2, got %d\n",
ret);
1010 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1011 ok(
ret == 15,
"Expected FormatMessageW to return 15, got %d\n",
ret);
1016 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1017 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1022 "short long long line", 0, 0,
out,
sizeof(
out),
NULL);
1023 ok(
ret == 21,
"Expected FormatMessageW to return 21, got %d\n",
ret);
1024 ok(!
strcmp(
"short long long\r\nline",
out),
"failed out=[%s]\n",
out);
1028 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1029 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1034 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1035 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1039 "short long wordlongerthanaline", 0, 0,
out,
sizeof(
out),
NULL);
1040 ok(
ret == 33,
"Expected FormatMessageW to return 33, got %d\n",
ret);
1041 ok(!
strcmp(
"short long\r\nwordlongerthanal\r\nine",
out),
"failed out=[%s]\n",
out);
1045 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1046 ok(
ret == 18,
"Expected FormatMessageW to return 18, got %d\n",
ret);
1050 "short long wordlongerthanaline", 0, 0,
out,
sizeof(
out),
NULL);
1051 ok(
ret == 35,
"Expected FormatMessageW to return 35, got %d\n",
ret);
1052 ok(!
strcmp(
"short long\r\n\r\nwordlongerth\r\nanaline",
out),
"failed out=[%s]\n",
out);
1056 " short line", 0, 0,
out,
sizeof(
out),
NULL);
1057 ok(
ret == 13,
"Expected FormatMessageW to return 13, got %d\n",
ret);
1061 " shortlong line", 0, 0,
out,
sizeof(
out),
NULL);
1062 ok(
ret == 17,
"Expected FormatMessageW to return 17, got %d\n",
ret);
1063 ok(!
strcmp(
"\r\nshortlong\r\nline",
out),
"failed out=[%s]\n",
out);
1067 "l1%n shortlong line", 0, 0,
out,
sizeof(
out),
NULL);
1068 ok(
ret == 21,
"Expected FormatMessageW to return 21, got %d\n",
ret);
1069 ok(!
strcmp(
"l1\r\n\r\nshortlong\r\nline",
out),
"failed out=[%s]\n",
out);
1074 ok(
ret == 7,
"Expected FormatMessageW to return 7, got %d\n",
ret);
1080 ok(
ret == 10,
"Expected FormatMessageW to return 10, got %d\n",
ret);
1086 ok(
ret == 10,
"Expected FormatMessageW to return 10, got %d\n",
ret);
1091 "shortlongline", 0, 0,
out,
sizeof(
out),
NULL);
1092 ok(
ret == 15,
"Expected FormatMessageW to return 15, got %d\n",
ret);
1097 "short long line", 0, 0,
out,
sizeof(
out),
NULL);
1098 ok(
ret == 17,
"Expected FormatMessageW to return 17, got %d\n",
ret);
1099 ok(!
strcmp(
"short\r\nlong\r\nline",
out),
"failed out=[%s]\n",
out);
1103 "short\nlong line", 0, 0,
out,
sizeof(
out),
NULL);
1104 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1110 ok(
ret == 12,
"Expected FormatMessageW to return 12, got %d\n",
ret);
1115 "short%nlong line", 0, 0,
out,
sizeof(
out),
NULL);
1116 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1120 "short%nlong line", 0, 0,
out,
sizeof(
out),
NULL);
1121 ok(
ret == 17,
"Expected FormatMessageW to return 17, got %d\n",
ret);
1122 ok(!
strcmp(
"short\r\nlong\r\nline",
out),
"failed out=[%s]\n",
out);
1126 "short%rlong line", 0, 0,
out,
sizeof(
out),
NULL);
1127 ok(
ret == 15,
"Expected FormatMessageW to return 15, got %d\n",
ret);
1131 "short%rlong line", 0, 0,
out,
sizeof(
out),
NULL);
1132 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1137 "short%nlong line%1", 0, 0,
out,
sizeof(
out),
NULL);
1138 ok(
ret == 19,
"Expected FormatMessageW to return 19, got %d\n",
ret);
1139 ok(!
strcmp(
"short\r\nlong\r\nline%1",
out),
"failed out=[%s]\n",
out);
1144 for (
i=0;
i < 26;
i++)
1151 ok(
ret == 272,
"Expected FormatMessageW to return 272, got %d\n",
ret);
1156 "short long\tline", 0, 0,
out,
sizeof(
out),
NULL);
1157 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1161 "short long-line", 0, 0,
out,
sizeof(
out),
NULL);
1162 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1166 "short long_line", 0, 0,
out,
sizeof(
out),
NULL);
1167 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1171 "short long.line", 0, 0,
out,
sizeof(
out),
NULL);
1172 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1176 "short long,line", 0, 0,
out,
sizeof(
out),
NULL);
1177 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1181 "short long!line", 0, 0,
out,
sizeof(
out),
NULL);
1182 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1186 "short long?line", 0, 0,
out,
sizeof(
out),
NULL);
1187 ok(
ret == 16,
"Expected FormatMessageW to return 16, got %d\n",
ret);
1193 static const char init_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1194 static const char expected_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1199 memcpy(
out, init_buf,
sizeof(init_buf));
1201 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1203 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1205 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)),
1206 "Expected the buffer to be untouched\n");
1209 memcpy(
out, init_buf,
sizeof(init_buf));
1211 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1213 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1215 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)),
1216 "Expected the buffer to be untouched\n");
1219 memcpy(
out, init_buf,
sizeof(init_buf));
1221 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1223 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1225 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)),
1226 "Expected the buffer to be untouched\n");
1231 static const WCHAR test[] = {
't',
'e',
's',
't',0};
1232 static const WCHAR init_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1233 static const WCHAR expected_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1234 static const WCHAR broken_buf[] = {0,
'x',
'x',
'x',
'x'};
1235 static const WCHAR broken2_buf[] = {
't',
'e',
's',0,
'x'};
1241 memcpy(
out, init_buf,
sizeof(init_buf));
1243 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1245 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1247 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)),
1248 "Expected the buffer to be untouched\n");
1253 memcpy(
out, init_buf,
sizeof(init_buf));
1255 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1257 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1259 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)) ||
1261 "Expected the buffer to be untouched\n");
1264 memcpy(
out, init_buf,
sizeof(init_buf));
1266 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1268 "Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %u\n",
1270 ok(!
memcmp(expected_buf,
out,
sizeof(expected_buf)) ||
1272 "Expected the buffer to be untouched\n");
1283 ok(!
ret,
"FormatMessageA returned %u\n",
ret);
1289 ok(!
ret,
"FormatMessageA returned %u\n",
ret);
1301 ok(!
ret,
"FormatMessageA returned %u\n",
ret);
1307 ok(!
ret,
"FormatMessageA returned %u\n",
ret);
1313 ok(!
ret,
"FormatMessageA returned %u\n",
ret);
1324 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1330 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1336 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1342 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1348 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1354 ok(!
ret,
"FormatMessageW returned %u\n",
ret);
1371 buf = (
char *)0xdeadbeef;
1373 "", 0, 0, (
char *)&
buf, 0,
NULL);
1374 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1375 ok(
buf ==
NULL,
"Expected output buffer pointer to be NULL\n");
1377 "Expected last error to be untouched, got %u\n",
GetLastError());
1379 buf = (
char *)0xdeadbeef;
1381 "test", 0, 0, (
char *)&
buf, 0,
NULL);
1382 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1384 "Expected output buffer pointer to be valid\n");
1385 if (
buf !=
NULL &&
buf != (
char *)0xdeadbeef)
1388 "Expected buffer to contain \"test\", got %s\n",
buf);
1392 buf = (
char *)0xdeadbeef;
1395 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1397 "Expected output buffer pointer to be valid\n");
1398 if (
buf !=
NULL &&
buf != (
char *)0xdeadbeef)
1401 "Expected buffer to contain \"test\", got %s\n",
buf);
1405 buf = (
char *)0xdeadbeef;
1408 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1410 "Expected output buffer pointer to be valid\n");
1411 if (
buf !=
NULL &&
buf != (
char *)0xdeadbeef)
1414 "Expected buffer to contain \"test\", got %s\n",
buf);
1418 buf = (
char *)0xdeadbeef;
1421 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1423 "Expected output buffer pointer to be valid\n");
1424 if (
buf !=
NULL &&
buf != (
char *)0xdeadbeef)
1427 "Expected buffer to contain \"test\", got %s\n",
buf);
1431 buf = (
char *)0xdeadbeef;
1433 "test", 0, 0, (
char *)&
buf, 1024,
NULL);
1434 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1436 "Expected output buffer pointer to be valid\n");
1437 if (
buf !=
NULL &&
buf != (
char *)0xdeadbeef)
1440 "Expected buffer to contain \"test\", got %s\n",
buf);
1448 static const WCHAR test[] = {
't',
'e',
's',
't',0};
1471 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1472 ok(
buf ==
NULL,
"Expected output buffer pointer to be NULL\n");
1474 "Expected last error to be untouched, got %u\n",
GetLastError());
1479 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1481 "Expected output buffer pointer to be valid\n");
1492 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1494 "Expected output buffer pointer to be valid\n");
1505 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1507 "Expected output buffer pointer to be valid\n");
1518 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1520 "Expected output buffer pointer to be valid\n");
1531 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1533 "Expected output buffer pointer to be valid\n");
1549 ok(
h != 0,
"GetModuleHandle failed\n");
1555 ok(
ret != 0,
"FormatMessageA returned 0\n");
1560 ok(
ret != 0,
"FormatMessageA returned 0\n");
1564 ok(
ret != 0,
"FormatMessageA returned 0\n");
1569 ok(
ret == 0,
"FormatMessageA returned non-zero\n");
1574 ok(
ret == 0,
"FormatMessageA returned non-zero\n");
1581 ok(
ret == 0,
"FormatMessageA returned %u instead of 0\n",
ret);
1588 ok(
ret == 0,
"FormatMessageA returned %u instead of 0\n",
ret);
1595 ok(
ret == 0,
"FormatMessageA returned %u instead of 0\n",
ret);
1602 ok(
ret == 0,
"FormatMessageA returned %u instead of 0\n",
ret);
1607 "last error %u\n",
error);
1613 ok(
ret == 0,
"FormatMessageA returned %u instead of 0\n",
ret);
1618 "last error %u\n",
error);
1623 static const char init_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1630 memcpy(
out, init_buf,
sizeof(init_buf));
1632 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1634 "Expected the output buffer to be untouched\n");
1636 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1640 ptr = (
char *)0xdeadbeef;
1642 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1643 ok(
ptr ==
NULL,
"Expected output pointer to be initialized to NULL, got %p\n",
ptr);
1645 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1649 memcpy(
out, init_buf,
sizeof(init_buf));
1651 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1653 "Expected the output buffer to be untouched\n");
1655 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1659 memcpy(
out, init_buf,
sizeof(init_buf));
1661 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1663 "Expected the output buffer to be untouched\n");
1665 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1669 memcpy(
out, init_buf,
sizeof(init_buf));
1671 ok(
ret == 0,
"Expected FormatMessageA to return 0, got %u\n",
ret);
1673 "Expected the output buffer to be untouched\n");
1675 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1682 memcpy(
out, init_buf,
sizeof(init_buf));
1685 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1687 "Expected the output buffer to be untouched\n");
1689 memcpy(
out, init_buf,
sizeof(init_buf));
1692 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1694 "Expected the output buffer to be untouched\n");
1696 memcpy(
out, init_buf,
sizeof(init_buf));
1700 ok(
ret == 4,
"Expected FormatMessageA to return 4, got %u\n",
ret);
1702 "Expected the output buffer to be untouched\n");
1707 static const WCHAR init_buf[] = {
'x',
'x',
'x',
'x',
'x'};
1708 static const WCHAR test[] = {
't',
'e',
's',
't',0};
1715 memcpy(
out, init_buf,
sizeof(init_buf));
1717 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1719 "Expected the output buffer to be untouched\n");
1721 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1727 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1728 ok(
ptr ==
NULL,
"Expected output pointer to be initialized to NULL, got %p\n",
ptr);
1730 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1734 memcpy(
out, init_buf,
sizeof(init_buf));
1736 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1738 "Expected the output buffer to be untouched\n");
1740 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1744 memcpy(
out, init_buf,
sizeof(init_buf));
1746 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1748 "Expected the output buffer to be untouched\n");
1750 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1754 memcpy(
out, init_buf,
sizeof(init_buf));
1756 ok(
ret == 0,
"Expected FormatMessageW to return 0, got %u\n",
ret);
1758 "Expected the output buffer to be untouched\n");
1760 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
1767 memcpy(
out, init_buf,
sizeof(init_buf));
1770 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %u\n",
ret);
1772 "Expected the output buffer to be untouched\n");
1774 memcpy(
out, init_buf,
sizeof(init_buf));
1777 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %u\n",
ret);
1779 "Expected the output buffer to be untouched\n");
1781 memcpy(
out, init_buf,
sizeof(init_buf));
1785 ok(
ret == 4,
"Expected FormatMessageW to return 4, got %u\n",
ret);
1787 "Expected the output buffer to be untouched\n");
1792 static const WCHAR I64d[] = {
'%',
'1',
'!',
'I',
'6',
'4',
'd',
'!', 0};
1793 static const WCHAR I64u[] = {
'%',
'1',
'!',
'I',
'6',
'4',
'u',
'!', 0};
1802 } unsigned_tests[] =
1805 { 1234567890,
"1234567890", 10},
1806 {
ULL(0xFFFFFFFF,0xFFFFFFFF),
"18446744073709551615", 20 },
1807 {
ULL(0x7FFFFFFF,0xFFFFFFFF),
"9223372036854775807", 19 },
1817 { 1234567890,
"1234567890", 10 },
1819 {
ULL(0xFFFFFFFF,0xFFFFFFFF),
"-1", 2},
1820 {
ULL(0x7FFFFFFF,0xFFFFFFFF),
"9223372036854775807", 19 },
1821 { -
ULL(0x7FFFFFFF,0xFFFFFFFF),
"-9223372036854775807", 20},
1825 for (
i = 0;
i <
sizeof(unsigned_tests) /
sizeof(unsigned_tests[0]);
i++)
1833 ok(
r == unsigned_tests[
i].
len,
"[%d] failed: r=%d\n",
i,
r);
1836 0, 0, outA,
sizeof(outA), unsigned_tests[
i].
number);
1838 ok(!
strcmp(outA, unsigned_tests[
i].
expected),
"[%d] failed, expected %s, got %s\n",
i,
1840 ok(
r == unsigned_tests[
i].
len,
"[%d] failed: r=%d\n",
i,
r);
1844 for (
i = 0;
i <
sizeof(signed_tests) /
sizeof(signed_tests[0]);
i++)
1852 ok(
r == signed_tests[
i].
len,
"[%d] failed: r=%d\n",
i,
r);
1855 0, 0, outA,
sizeof(outA), signed_tests[
i].
number);
1859 ok(
r == signed_tests[
i].
len,
"[%d] failed: r=%d\n",
i,
r);
1881 win_skip(
"FormatMessageW is not implemented\n");
unsigned long long UINT64
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
static const WCHAR empty[]
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define MultiByteToWideChar
static const WCHAR expW[]
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLenum GLenum GLenum GLenum outW
GLfloat GLfloat GLfloat GLfloat h
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
unsigned char size_t * outsize
#define memcpy(s1, s2, n)
static unsigned int number
#define SUBLANG_ENGLISH_UK
#define SUBLANG_SYS_DEFAULT
#define SUBLANG_ENGLISH_US
DWORD WINAPI GetLastError(void)
#define FORMAT_MESSAGE_FROM_STRING
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
#define FORMAT_MESSAGE_FROM_HMODULE
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
#define ERROR_MUI_FILE_NOT_FOUND
#define TRUST_E_NOSIGNATURE
#define ERROR_MUI_FILE_NOT_LOADED
#define ERROR_RESOURCE_LANG_NOT_FOUND
#define ERROR_MR_MID_NOT_FOUND