ReactOS 0.4.16-dev-753-g705a985
misc.c
Go to the documentation of this file.
1/*
2 * Unit tests for miscellaneous msvcrt functions
3 *
4 * Copyright 2010 Andrew Nguyen
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "wine/test.h"
22#include <errno.h>
23#include <fcntl.h>
24#include <io.h>
25#include <stdio.h>
26#include <math.h>
27#include <process.h>
28#include <versionhelpers.h>
29
30static inline BOOL almost_equal(double d1, double d2) {
31 if(d1-d2>-1e-30 && d1-d2<1e-30)
32 return TRUE;
33 return FALSE;
34}
35
36/* MS' "long double" is an 80 bit FP that takes 12 bytes*/
37struct uld { ULONG lo, hi, exp; };
38
39static int (__cdecl *prand_s)(unsigned int *);
40static int (__cdecl *pI10_OUTPUT)(struct uld, int, int, void*);
41static int (__cdecl *pstrerror_s)(char *, size_t, int);
42static int (__cdecl *p_get_doserrno)(int *);
43static int (__cdecl *p_get_errno)(int *);
44static int (__cdecl *p_set_doserrno)(int);
45static int (__cdecl *p_set_errno)(int);
46static void (__cdecl *p__invalid_parameter)(const wchar_t*,
47 const wchar_t*, const wchar_t*, unsigned int, uintptr_t);
48static void (__cdecl *p_qsort_s)(void*, size_t, size_t,
49 int (__cdecl*)(void*, const void*, const void*), void*);
50static double (__cdecl *p_atan)(double);
51static double (__cdecl *p_exp)(double);
52static double (__cdecl *p_tanh)(double);
53static void *(__cdecl *p_lfind_s)(const void*, const void*, unsigned int*,
54 size_t, int (__cdecl *)(void*, const void*, const void*), void*);
55
56static void init(void)
57{
58 HMODULE hmod = GetModuleHandleA("msvcrt.dll");
59
60 prand_s = (void *)GetProcAddress(hmod, "rand_s");
61 pI10_OUTPUT = (void*)GetProcAddress(hmod, "$I10_OUTPUT");
62 pstrerror_s = (void *)GetProcAddress(hmod, "strerror_s");
63 p_get_doserrno = (void *)GetProcAddress(hmod, "_get_doserrno");
64 p_get_errno = (void *)GetProcAddress(hmod, "_get_errno");
65 p_set_doserrno = (void *)GetProcAddress(hmod, "_set_doserrno");
66 p_set_errno = (void *)GetProcAddress(hmod, "_set_errno");
67 p__invalid_parameter = (void *)GetProcAddress(hmod, "_invalid_parameter");
68 p_qsort_s = (void *)GetProcAddress(hmod, "qsort_s");
69 p_atan = (void *)GetProcAddress(hmod, "atan");
70 p_exp = (void *)GetProcAddress(hmod, "exp");
71 p_tanh = (void *)GetProcAddress(hmod, "tanh");
72 p_lfind_s = (void *)GetProcAddress(hmod, "_lfind_s");
73}
74
75static void test_rand_s(void)
76{
77 int ret;
78 unsigned int rand;
79
80 if (!prand_s)
81 {
82 win_skip("rand_s is not available\n");
83 return;
84 }
85
86 errno = EBADF;
87 ret = prand_s(NULL);
88 ok(ret == EINVAL, "Expected rand_s to return EINVAL, got %d\n", ret);
89 ok(errno == EINVAL, "Expected errno to return EINVAL, got %d\n", errno);
90
91 ret = prand_s(&rand);
92 ok(ret == 0, "Expected rand_s to return 0, got %d\n", ret);
93}
94
95typedef struct _I10_OUTPUT_data {
96 short pos;
97 char sign;
99 char str[100];
101
102typedef struct _I10_OUTPUT_test {
103 struct uld d;
104 int size;
105 int flags;
106
108 int ret;
109 const char *remain;
111
113 /* arg3 = 0 */
114 { { 0x00000000, 0x00000000, 0x0000 /* 0.0 */ }, 10, 0, {0, ' ', 1, "0"}, 1, "" },
115 { { 0x00000000, 0x80000000, 0x3fff /* 1.0 */ }, 10, 0, {1, ' ', 1, "1"}, 1, "000000009" },
116 { { 0x00000000, 0x80000000, 0xbfff /* -1.0 */ }, 10, 0, {1, '-', 1, "1"}, 1, "000000009" },
117 { { 0x0a3d7000, 0x9d70a3d7, 0x3fff /* 1.23 */ }, 10, 0, {1, ' ', 3, "123"}, 1, "0000009" },
118 { { 0x00000000, 0x9184e72a, 0x402a /* 1e13 */ }, 10, 0, {14, ' ', 1, "1"}, 1, "000000009" },
119 { { 0x04675000, 0xc9f2c9cd, 0x4062 /* 1e30 */ }, 30, 0, {31, ' ', 21, "100000000000000001988"}, 1, "" },
120 { { 0x4bb41000, 0xe12e1342, 0x3fd3 /* 1e-13 */ }, 10, 0, {-12, ' ', 1, "1"}, 1, "000000000" },
121 { { 0x00000000, 0x80000000, 0x3ffd /* 0.25 */ }, 10, 0, {0, ' ', 2, "25"}, 1, "00000000" },
122 { { 0xbf94d800, 0x800000d6, 0x3fff /* 1.0000001 */ }, 10, 0, {1, ' ', 8, "10000001"}, 1, "00" },
123 { { 0x00000000, 0x80000000, 0x7fff /* +inf */ }, 10, 0, {1, ' ', 5, "1#INF"}, 0, "" },
124 { { 0x00000000, 0x80000000, 0xffff /* -inf */ }, 10, 0, {1, '-', 5, "1#INF"}, 0, "" },
125 { { 0x00000001, 0x80000000, 0x7fff /* snan */ }, 10, 0, {1, ' ', 6, "1#SNAN"}, 0, "" },
126 { { 0x00000001, 0x80000000, 0xffff /* snan */ }, 10, 0, {1, '-', 6, "1#SNAN"}, 0, "" },
127 { { 0x00000000, 0xc0000000, 0x7fff /* qnan */ }, 10, 0, {1, ' ', 6, "1#QNAN"}, 0, "" },
128 { { 0x00000000, 0x40000000, 0xffff /* qnan */ }, 10, 0, {1, '-', 6, "1#QNAN"}, 0, "" },
129 /* arg3 = 1 */
130 { { 0x00000000, 0x00000000, 0x0000 /* 0 */ }, 10, 1, {0, ' ', 1, "0"}, 1, "" },
131 { { 0x00000000, 0x80000000, 0x3fff /* 1 */ }, 10, 1, {1, ' ', 1, "1"}, 1, "0000000009" },
132 { { 0x00000000, 0x80000000, 0xbfff /* -1 */ }, 10, 1, {1, '-', 1, "1"}, 1, "0000000009" },
133 { { 0x0a3d7000, 0x9d70a3d7, 0x3fff /* 1.23 */ }, 10, 1, {1, ' ', 3, "123"}, 1, "00000009" },
134 { { 0x00000000, 0x9184e72a, 0x402a /* 1e13 */ }, 10, 1, {14, ' ', 1, "1"}, 1, "00000000000000000009" },
135 { { 0x04675000, 0xc9f2c9cd, 0x4062 /* 1e30 */ }, 30, 1, {31, ' ', 21, "100000000000000001988"}, 1, "" },
136 { { 0x4bb41000, 0xe12e1342, 0x3fd3 /* 1e-13 */ }, 10, 1, {0, ' ', 1, "0"}, 1, "" },
137 { { 0xe57a4000, 0xd6bf94d5, 0x3fe7 /* 1e-7 */ }, 10, 1, {-6, ' ', 1, "1"}, 1, "09" },
138 { { 0x00000000, 0x80000000, 0x3ffd /* 0.25 */ }, 10, 1, {0, ' ', 2, "25"}, 1, "00000000" },
139 { { 0xbf94d800, 0x800000d6, 0x3fff /* 1.0000001 */ }, 10, 1, {1, ' ', 8, "10000001"}, 1, "000" },
140 { { 0x00000000, 0x80000000, 0x7fff /* +inf */ }, 10, 1, {1, ' ', 5, "1#INF"}, 0, "" },
141 { { 0x00000000, 0x80000000, 0xffff /* -inf */ }, 10, 1, {1, '-', 5, "1#INF"}, 0, "" },
142 { { 0x00000001, 0x80000000, 0x7fff /* snan */ }, 10, 1, {1, ' ', 6, "1#SNAN"}, 0, "" },
143 { { 0x00000000, 0xc0000000, 0x7fff /* qnan */ }, 10, 1, {1, ' ', 6, "1#QNAN"}, 0, "" },
144 { { 0x00000000, 0x40000000, 0x7fff /* qnan */ }, 10, 1, {1, ' ', 6, "1#QNAN"}, 0, "" },
145 /* too small buffer */
146 { { 0x00000000, 0x00000000, 0x0000 /* 0 */ }, 0, 0, {0, ' ', 1, "0"}, 1, "" },
147 { { 0x00000000, 0x00000000, 0x0000 /* 0 */ }, 0, 1, {0, ' ', 1, "0"}, 1, "" },
148 { { 0x00000000, 0xf6000000, 0x4005 /* 123 */ }, 2, 0, {3, ' ', 2, "12"}, 1, "" },
149 { { 0x00000000, 0xf6000000, 0x4005 /* 123 */ }, 0, 0, {0, ' ', 1, "0"}, 1, "" },
150 { { 0x00000000, 0xf6000000, 0x4005 /* 123 */ }, 2, 1, {3, ' ', 3, "123"}, 1, "09" },
151 { { 0x0a3d7000, 0xfd70a3d7, 0x3ffe /* 0.99 */ }, 1, 0, {1, ' ', 1, "1"}, 1, "" },
152 { { 0x00000000, 0x9a5db800, 0x4013 /* 1264567.0 */ }, 2, 0, {7, ' ', 2, "13"}, 1, "" },
153 { { 0x00000000, 0x9a5db800, 0x4013 /* 1264567.0 */ }, 2, 1, {7, ' ', 7, "1264567"}, 1, "00" },
154 { { 0x00000000, 0x932c05a6, 0x401d /* 1234567891.0 */ }, 2, 1, {10, ' ', 10, "1234567891"}, 1, "09" }
155};
156
157static void test_I10_OUTPUT(void)
158{
160 int i, j, ret;
161
162 if(!pI10_OUTPUT) {
163 win_skip("I10_OUTPUT not available\n");
164 return;
165 }
166
167 for(i=0; i<ARRAY_SIZE(I10_OUTPUT_tests); i++) {
168 memset(out.str, '#', sizeof(out.str));
170 ok(ret == I10_OUTPUT_tests[i].ret, "%d: ret = %d\n", i, ret);
171 ok(out.pos == I10_OUTPUT_tests[i].out.pos, "%d: out.pos = %hd\n", i, out.pos);
172 ok(out.sign == I10_OUTPUT_tests[i].out.sign, "%d: out.size = %c\n", i, out.sign);
173 ok(out.len == I10_OUTPUT_tests[i].out.len, "%d: out.len = %d\n", i, (int)out.len);
174 ok(!strcmp(out.str, I10_OUTPUT_tests[i].out.str), "%d: out.str = %s\n", i, out.str);
175
176 j = strlen(I10_OUTPUT_tests[i].remain);
177 todo_wine_if(j && I10_OUTPUT_tests[i].remain[j-1]=='9')
178 ok(!strncmp(out.str+out.len+1, I10_OUTPUT_tests[i].remain, j),
179 "%d: &out.str[%d] = %.25s...\n", i, out.len+1, out.str+out.len+1);
180
181 for(j=out.len+strlen(I10_OUTPUT_tests[i].remain)+1; j<sizeof(out.str); j++)
182 if(out.str[j] != '#')
183 ok(0, "%d: out.str[%d] = %c (expected \'#\')\n", i, j, out.str[j]);
184 }
185}
186
187static void test_strerror_s(void)
188{
189 int ret;
190 char buf[256];
191
192 if (!pstrerror_s)
193 {
194 win_skip("strerror_s is not available\n");
195 return;
196 }
197
198 errno = EBADF;
199 ret = pstrerror_s(NULL, 0, 0);
200 ok(ret == EINVAL, "Expected strerror_s to return EINVAL, got %d\n", ret);
201 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
202
203 errno = EBADF;
204 ret = pstrerror_s(NULL, sizeof(buf), 0);
205 ok(ret == EINVAL, "Expected strerror_s to return EINVAL, got %d\n", ret);
206 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
207
208 memset(buf, 'X', sizeof(buf));
209 errno = EBADF;
210 ret = pstrerror_s(buf, 0, 0);
211 ok(ret == EINVAL, "Expected strerror_s to return EINVAL, got %d\n", ret);
212 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
213 ok(buf[0] == 'X', "Expected output buffer to be untouched\n");
214
215 memset(buf, 'X', sizeof(buf));
216 ret = pstrerror_s(buf, 1, 0);
217 ok(ret == 0, "Expected strerror_s to return 0, got %d\n", ret);
218 ok(buf[0] == 0, "Expected output buffer to be null terminated\n");
219
220 memset(buf, 'X', sizeof(buf));
221 ret = pstrerror_s(buf, 2, 0);
222 ok(ret == 0, "Expected strerror_s to return 0, got %d\n", ret);
223 ok(strlen(buf) == 1, "Expected output buffer to be truncated\n");
224
225 memset(buf, 'X', sizeof(buf));
226 ret = pstrerror_s(buf, sizeof(buf), 0);
227 ok(ret == 0, "Expected strerror_s to return 0, got %d\n", ret);
228
229 memset(buf, 'X', sizeof(buf));
230 ret = pstrerror_s(buf, sizeof(buf), -1);
231 ok(ret == 0, "Expected strerror_s to return 0, got %d\n", ret);
232}
233
234static void test__get_doserrno(void)
235{
236 int ret, out;
237
238 if (!p_get_doserrno)
239 {
240 win_skip("_get_doserrno is not available\n");
241 return;
242 }
243
245 errno = EBADF;
246 ret = p_get_doserrno(NULL);
247 ok(ret == EINVAL, "Expected _get_doserrno to return EINVAL, got %d\n", ret);
248 ok(_doserrno == ERROR_INVALID_CMM, "Expected _doserrno to be ERROR_INVALID_CMM, got %ld\n", _doserrno);
249 ok(errno == EBADF, "Expected errno to be EBADF, got %d\n", errno);
250
252 errno = EBADF;
253 out = 0xdeadbeef;
254 ret = p_get_doserrno(&out);
255 ok(ret == 0, "Expected _get_doserrno to return 0, got %d\n", ret);
256 ok(out == ERROR_INVALID_CMM, "Expected output variable to be ERROR_INVALID_CMM, got %d\n", out);
257}
258
259static void test__get_errno(void)
260{
261 int ret, out;
262
263 if (!p_get_errno)
264 {
265 win_skip("_get_errno is not available\n");
266 return;
267 }
268
269 errno = EBADF;
270 ret = p_get_errno(NULL);
271 ok(ret == EINVAL, "Expected _get_errno to return EINVAL, got %d\n", ret);
272 ok(errno == EBADF, "Expected errno to be EBADF, got %d\n", errno);
273
274 errno = EBADF;
275 out = 0xdeadbeef;
276 ret = p_get_errno(&out);
277 ok(ret == 0, "Expected _get_errno to return 0, got %d\n", ret);
278 ok(out == EBADF, "Expected output variable to be EBADF, got %d\n", out);
279}
280
281static void test__set_doserrno(void)
282{
283 int ret;
284
285 if (!p_set_doserrno)
286 {
287 win_skip("_set_doserrno is not available\n");
288 return;
289 }
290
292 ret = p_set_doserrno(ERROR_FILE_NOT_FOUND);
293 ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
295 "Expected _doserrno to be ERROR_FILE_NOT_FOUND, got %ld\n", _doserrno);
296
298 ret = p_set_doserrno(-1);
299 ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
300 ok(_doserrno == -1,
301 "Expected _doserrno to be -1, got %ld\n", _doserrno);
302
304 ret = p_set_doserrno(0xdeadbeef);
305 ok(ret == 0, "Expected _set_doserrno to return 0, got %d\n", ret);
306 ok(_doserrno == 0xdeadbeef,
307 "Expected _doserrno to be 0xdeadbeef, got %ld\n", _doserrno);
308}
309
310static void test__set_errno(void)
311{
312 int ret;
313
314 if (!p_set_errno)
315 {
316 win_skip("_set_errno is not available\n");
317 return;
318 }
319
320 errno = EBADF;
321 ret = p_set_errno(EINVAL);
322 ok(ret == 0, "Expected _set_errno to return 0, got %d\n", ret);
323 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
324
325 errno = EBADF;
326 ret = p_set_errno(-1);
327 ok(ret == 0, "Expected _set_errno to return 0, got %d\n", ret);
328 ok(errno == -1, "Expected errno to be -1, got %d\n", errno);
329
330 errno = EBADF;
331 ret = p_set_errno(0xdeadbeef);
332 ok(ret == 0, "Expected _set_errno to return 0, got %d\n", ret);
333 ok(errno == 0xdeadbeef, "Expected errno to be 0xdeadbeef, got %d\n", errno);
334}
335
336static void test__popen_child(int fd)
337{
338 /* don't execute any tests here */
339 /* ExitProcess is used to set return code of _pclose */
340 printf("child output\n");
342 ExitProcess(1);
343 ExitProcess(0x37);
344}
345
346static void test__popen_read_child(void)
347{
348 char buf[1024], *rets;
349
350 rets = fgets(buf, sizeof(buf), stdin);
351 if (strcmp(buf, "child-to-parent\n") != 0)
352 ExitProcess(1);
353
354 rets = fgets(buf, sizeof(buf), stdin);
355 if (rets)
356 ExitProcess(2);
357 ExitProcess(3);
358}
359
360static void test__popen(const char *name)
361{
362 FILE *pipe;
363 char *tempf, buf[1024];
364 int ret, fd;
365
366 tempf = _tempnam(".", "wne");
367 ok(tempf != NULL, "_tempnam failed\n");
368 fd = _open(tempf, _O_CREAT | _O_WRONLY);
369 ok(fd != -1, "open failed\n");
370
371 sprintf(buf, "\"%s\" misc popen %d", name, fd);
372 pipe = _popen(buf, "r");
373 ok(pipe != NULL, "_popen failed with error: %d\n", errno);
374
375 fgets(buf, sizeof(buf), pipe);
376 ok(!strcmp(buf, "child output\n"), "buf = %s\n", buf);
377
378 ret = _pclose(pipe);
379 ok(ret == 0x37, "_pclose returned %x, expected 0x37\n", ret);
380 _close(fd);
381 _unlink(tempf);
382 free(tempf);
383
384 errno = 0xdeadbeef;
385 ret = _pclose((FILE*)0xdeadbeef);
386 ok(ret == -1, "_pclose returned %x, expected -1\n", ret);
387 if(p_set_errno)
388 ok(errno == EBADF, "errno = %d\n", errno);
389
390 sprintf(buf, "\"%s\" misc popen_read", name);
391 pipe = _popen(buf, "w");
392 ok(pipe != NULL, "_popen failed with error: %d\n", errno);
393
394 ret = fputs("child-to-parent\n", pipe);
395 ok(ret != EOF, "fputs returned %x\n", ret);
396
397#ifdef __REACTOS__
398 if (IsReactOS())
399 {
400 skip("Skipping _pclose, because it hangs on reactos\n");
401 return;
402 }
403#endif
404 ret = _pclose(pipe);
405 ok(ret == 0x3, "_pclose returned %x, expected 0x3\n", ret);
406}
407
408static void test__invalid_parameter(void)
409{
410 if(!p__invalid_parameter) {
411 win_skip("_invalid_parameter not available\n");
412 return;
413 }
414
415 p__invalid_parameter(NULL, NULL, NULL, 0, 0);
416}
417
419{
420 int pos;
421 int *base;
422
423 struct {
424 int l;
425 int r;
426 } cmp[64];
427};
428
429static int __cdecl qsort_comp(void *ctx, const void *l, const void *r)
430{
431 struct qsort_test *qt = ctx;
432
433 if(qt) {
434 ok(qt->pos < 64, "qt->pos = %d\n", qt->pos);
435 ok(qt->cmp[qt->pos].l == (int*)l-qt->base,
436 "%d) l on %ld position\n", qt->pos, (long)((int*)l - qt->base));
437 ok(qt->cmp[qt->pos].r == (int*)r-qt->base,
438 "%d) r on %ld position\n", qt->pos, (long)((int*)r - qt->base));
439 qt->pos++;
440 }
441
442 return *(int*)l%1000 - *(int*)r%1000;
443}
444
445static void test_qsort_s(void)
446{
447 static const int nonstable_test[] = {9000, 8001, 7002, 6003, 1003, 5004, 4005, 3006, 2007};
448 int tab[100], i;
449
450 struct qsort_test small_sort = {
451 0, tab, {
452 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5}, {7, 6},
453 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5},
454 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4},
455 {1, 0}, {2, 1}, {3, 2}, {4, 3},
456 {1, 0}, {2, 1}, {3, 2},
457 {1, 0}, {2, 1},
458 {1, 0}
459 }
460 }, small_sort2 = {
461 0, tab, {
462 {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0},
463 {1, 0}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1},
464 {1, 0}, {2, 1}, {3, 2}, {4, 2}, {5, 2},
465 {1, 0}, {2, 1}, {3, 2}, {4, 3},
466 {1, 0}, {2, 1}, {3, 2},
467 {1, 0}, {2, 1},
468 {1, 0}
469 }
470 }, quick_sort = {
471 0, tab, {
472 {0, 4}, {0, 8}, {4, 8},
473 {1, 4}, {2, 4}, {3, 4}, {5, 4}, {6, 4}, {7, 4}, {7, 4}, {6, 4},
474 {6, 4},
475 {8, 7},
476 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 4},
477 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 3},
478 {1, 0}, {2, 1}, {3, 2}, {4, 2},
479 {1, 0}, {2, 1}, {3, 2},
480 {1, 0}, {2, 1},
481 {1, 0}
482 }
483 };
484
485 if(!p_qsort_s) {
486 win_skip("qsort_s not available\n");
487 return;
488 }
489
490 for(i=0; i<8; i++) tab[i] = i;
491 p_qsort_s(tab, 8, sizeof(int), qsort_comp, &small_sort);
492 ok(small_sort.pos == 28, "small_sort.pos = %d\n", small_sort.pos);
493 for(i=0; i<8; i++)
494 ok(tab[i] == i, "tab[%d] = %d\n", i, tab[i]);
495
496 for(i=0; i<8; i++) tab[i] = 7-i;
497 p_qsort_s(tab, 8, sizeof(int), qsort_comp, &small_sort2);
498 ok(small_sort2.pos == 28, "small_sort2.pos = %d\n", small_sort2.pos);
499 for(i=0; i<8; i++)
500 ok(tab[i] == i, "tab[%d] = %d\n", i, tab[i]);
501
502 for(i=0; i<9; i++) tab[i] = i;
503 tab[5] = 1;
504 tab[6] = 2;
505 p_qsort_s(tab, 9, sizeof(int), qsort_comp, &quick_sort);
506 ok(quick_sort.pos == 34, "quick_sort.pos = %d\n", quick_sort.pos);
507
508 /* show that qsort is not stable */
509 for(i=0; i<9; i++) tab[i] = 8-i + 1000*(i+1);
510 tab[0] = 1003;
511 p_qsort_s(tab, 9, sizeof(int), qsort_comp, NULL);
512 for(i=0; i<9; i++)
513 ok(tab[i] == nonstable_test[i], "tab[%d] = %d, expected %d\n", i, tab[i], nonstable_test[i]);
514
515 /* check if random data is sorted */
516 srand(0);
517 for(i=0; i<100; i++) tab[i] = rand()%1000;
518 p_qsort_s(tab, 100, sizeof(int), qsort_comp, NULL);
519 for(i=1; i<100; i++)
520 ok(tab[i-1] <= tab[i], "data sorted incorrectly on position %d: %d <= %d\n", i, tab[i-1], tab[i]);
521
522 /* test if random permutation is sorted correctly */
523 for(i=0; i<100; i++) tab[i] = i;
524 for(i=0; i<100; i++) {
525 int b = rand()%100;
526 int e = rand()%100;
527
528 if(b == e) continue;
529 tab[b] ^= tab[e];
530 tab[e] ^= tab[b];
531 tab[b] ^= tab[e];
532 }
533 p_qsort_s(tab, 100, sizeof(int), qsort_comp, NULL);
534 for(i=0; i<100; i++)
535 ok(tab[i] == i, "data sorted incorrectly on position %d: %d\n", i, tab[i]);
536}
537
538static int eq_nan(UINT64 ai, double b)
539{
540 UINT64 bi = *(UINT64*)&b;
541 UINT64 mask;
542
543#if defined(__i386__)
544 mask = 0xFFFFFFFF00000000ULL;
545#else
546 mask = ~0;
547#endif
548
549 ok((ai & mask) == (bi & mask), "comparing %s and %s\n",
551 return (ai & mask) == (bi & mask);
552}
553
554static int eq_nanf(DWORD ai, float b)
555{
556 DWORD bi = *(DWORD*)&b;
557 ok(ai == bi, "comparing %08lx and %08lx\n", ai, bi);
558 return ai == bi;
559}
560
561static void test_math_functions(void)
562{
563 static const UINT64 test_nan_i = 0xFFF0000123456780ULL;
564 static const DWORD test_nanf_i = 0xFF801234;
565 double test_nan = *(double*)&test_nan_i;
566 float test_nanf = *(float*)&test_nanf_i;
567 double ret;
568
569 errno = 0xdeadbeef;
570 p_atan(NAN);
571 ok(errno == EDOM, "errno = %d\n", errno);
572
573 errno = 0xdeadbeef;
574 ret = p_atan(INFINITY);
575 ok(almost_equal(ret, 1.57079632679489661923), "ret = %lf\n", ret);
576 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
577
578 errno = 0xdeadbeef;
579 ret = p_atan(-INFINITY);
580 ok(almost_equal(ret, -1.57079632679489661923), "ret = %lf\n", ret);
581 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
582
583 errno = 0xdeadbeef;
584 p_tanh(NAN);
585 ok(errno == EDOM, "errno = %d\n", errno);
586
587 errno = 0xdeadbeef;
588 ret = p_tanh(INFINITY);
589 ok(almost_equal(ret, 1.0), "ret = %lf\n", ret);
590 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
591
592 errno = 0xdeadbeef;
593 p_exp(NAN);
594 ok(errno == EDOM, "errno = %d\n", errno);
595
596 errno = 0xdeadbeef;
597 p_exp(INFINITY);
598 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
599
600 ok(eq_nan(test_nan_i | (1ULL << 51), cosh(test_nan)), "cosh not preserving nan\n");
601 ok(eq_nan(test_nan_i | (1ULL << 51), sinh(test_nan)), "sinh not preserving nan\n");
602 ok(eq_nan(test_nan_i | (1ULL << 51), tanh(test_nan)), "tanh not preserving nan\n");
603 ok(eq_nanf(test_nanf_i | (1 << 22), coshf(test_nanf)), "coshf not preserving nan\n");
604 ok(eq_nanf(test_nanf_i | (1 << 22), sinhf(test_nanf)), "sinhf not preserving nan\n");
605 ok(eq_nanf(test_nanf_i | (1 << 22), tanhf(test_nanf)), "tanhf not preserving nan\n");
606}
607
608static void __cdecl test_thread_func(void *end_thread_type)
609{
610 if (end_thread_type == (void*)1)
611 _endthread();
612 else if (end_thread_type == (void*)2)
613 ExitThread(0);
614 else if (end_thread_type == (void*)3)
615 _endthreadex(0);
616}
617
618static unsigned __stdcall test_thread_func_ex(void *arg)
619{
620 _endthread();
621 return 0;
622}
623
625{
627 DWORD ret;
628
629 /* _beginthread: handle is not closed on ExitThread and _endthreadex */
631 ok(hThread != INVALID_HANDLE_VALUE, "_beginthread failed (%d)\n", errno);
634 ok(!ret, "ret = %ld\n", ret);
635
637 ok(hThread != INVALID_HANDLE_VALUE, "_beginthread failed (%d)\n", errno);
640 ok(!ret, "ret = %ld\n", ret);
641
643 ok(hThread != INVALID_HANDLE_VALUE, "_beginthread failed (%d)\n", errno);
644 Sleep(150);
646 ok(ret == WAIT_OBJECT_0, "ret = %ld\n", ret);
648 ok(ret, "ret = %ld\n", ret);
649
651 ok(hThread != INVALID_HANDLE_VALUE, "_beginthread failed (%d)\n", errno);
652 Sleep(150);
654 ok(ret == WAIT_OBJECT_0, "ret = %ld\n", ret);
656 ok(ret, "ret = %ld\n", ret);
657
658 /* _beginthreadex: handle is not closed on _endthread */
660 ok(hThread != NULL, "_beginthreadex failed (%d)\n", errno);
661 Sleep(150);
663 ok(ret == WAIT_OBJECT_0, "ret = %ld\n", ret);
665 ok(ret, "ret = %ld\n", ret);
666}
667
668static void test_thread_suspended(void)
669{
671 DWORD ret;
672
674 ok(hThread != NULL, "_beginthreadex failed (%d)\n", errno);
676 ok(ret == 1, "suspend count = %ld\n", ret);
678 ok(ret == WAIT_OBJECT_0, "ret = %ld\n", ret);
679}
680
681static int __cdecl _lfind_s_comp(void *ctx, const void *l, const void *r)
682{
683 *(int *)ctx = 0xdeadc0de;
684 return *(int *)l - *(int *)r;
685}
686
687static void test__lfind_s(void)
688{
689 static const int tests[] = {9000, 8001, 7002, 6003, 1003, 5004, 4005, 3006, 2007};
690 unsigned int num;
691 void *found;
692 int ctx;
693 int key;
694
695 if (!p_lfind_s)
696 {
697 win_skip("_lfind_s is not available\n");
698 return;
699 }
700
701 key = 1234;
703
704 errno = 0xdeadbeef;
705 found = p_lfind_s(NULL, tests, &num, sizeof(int), _lfind_s_comp, NULL);
706 ok(errno == EINVAL, "errno = %d\n", errno);
707 ok(!found, "Expected NULL, got %p\n", found);
708
709 errno = 0xdeadbeef;
710 found = p_lfind_s(&key, NULL, &num, sizeof(int), _lfind_s_comp, NULL);
711 ok(errno == EINVAL, "errno = %d\n", errno);
712 ok(!found, "Expected NULL, got %p\n", found);
713
714 errno = 0xdeadbeef;
715 found = p_lfind_s(&key, tests, &num, 0, _lfind_s_comp, NULL);
716 ok(errno == EINVAL, "errno = %d\n", errno);
717 ok(!found, "Expected NULL, got %p\n", found);
718
719 errno = 0xdeadbeef;
720 found = p_lfind_s(&key, tests, &num, sizeof(int), NULL, NULL);
721 ok(errno == EINVAL, "errno = %d\n", errno);
722 ok(!found, "Expected NULL, got %p\n", found);
723
724 ctx = -1;
725 key = 9000;
726 errno = 0xdeadbeef;
727 found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx);
728 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
729 ok(found == tests, "Expected %p, got %p\n", tests, found);
730 ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx);
731
732 ctx = -1;
733 key = 2007;
734 errno = 0xdeadbeef;
735 found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx);
736 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
737 ok(found == tests+8, "Expected %p, got %p\n", tests+8, found);
738 ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx);
739
740 ctx = -1;
741 key = 1234;
742 errno = 0xdeadbeef;
743 found = p_lfind_s(&key, tests, &num, sizeof(int), _lfind_s_comp, &ctx);
744 ok(errno == 0xdeadbeef, "errno = %d\n", errno);
745 ok(!found, "Expected NULL, got %p\n", found);
746 ok(ctx == 0xdeadc0de, "Expected 0xdeadc0de, got %x\n", ctx);
747}
748
750{
751 int arg_c;
752 char** arg_v;
753
754 init();
755
756 arg_c = winetest_get_mainargs(&arg_v);
757 if(arg_c >= 3) {
758 if (!strcmp(arg_v[2], "popen_read"))
760 else if(arg_c == 4 && !strcmp(arg_v[2], "popen"))
761 test__popen_child(atoi(arg_v[3]));
762 else
763 ok(0, "invalid argument '%s'\n", arg_v[2]);
764
765 return;
766 }
767
768 test_rand_s();
775 test__popen(arg_v[0]);
777 test_qsort_s();
782}
unsigned long long UINT64
_STLP_DECLSPEC complex< float > _STLP_CALL sinh(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL cosh(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL tanh(const complex< float > &)
#define EINVAL
Definition: acclib.h:90
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define EBADF
Definition: acclib.h:82
#define __cdecl
Definition: accygwin.h:79
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
r l[0]
Definition: byte_order.h:168
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _O_CREAT
Definition: cabinet.h:46
#define _O_WRONLY
Definition: cabinet.h:38
#define CloseHandle
Definition: compat.h:739
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:567
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:365
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define EDOM
Definition: errno.h:39
__kernel_size_t size_t
Definition: linux.h:237
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint GLuint num
Definition: glext.h:9618
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
Definition: glfuncs.h:248
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 GLint GLint j
Definition: glfuncs.h:250
_Check_return_ float __cdecl tanhf(_In_ float x)
Definition: math.h:251
#define INFINITY
Definition: math.h:56
_Check_return_ float __cdecl coshf(_In_ float x)
Definition: math.h:239
_Check_return_ float __cdecl sinhf(_In_ float x)
Definition: math.h:248
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP char *__cdecl _tempnam(_In_opt_z_ const char *_DirName, _In_opt_z_ const char *_FilePrefix)
#define EOF
Definition: stdio.h:24
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
#define stdin
Definition: stdio.h:98
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl _popen(_In_z_ const char *_Command, _In_z_ const char *_Mode)
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define _doserrno
Definition: stdlib.h:131
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define b
Definition: ke_i.h:79
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static struct test_info tests[]
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
#define NAN
Definition: mesh.c:39
#define todo_wine_if(is_todo)
Definition: custom.c:86
static void test__invalid_parameter(void)
Definition: misc.c:408
static void test__lfind_s(void)
Definition: misc.c:687
struct _I10_OUTPUT_data I10_OUTPUT_data
static void test__set_doserrno(void)
Definition: misc.c:281
static void test__popen_child(int fd)
Definition: misc.c:336
static void test_math_functions(void)
Definition: misc.c:561
static const I10_OUTPUT_test I10_OUTPUT_tests[]
Definition: misc.c:112
static void __cdecl test_thread_func(void *end_thread_type)
Definition: misc.c:608
static int eq_nan(UINT64 ai, double b)
Definition: misc.c:538
static void test__popen_read_child(void)
Definition: misc.c:346
static void test_qsort_s(void)
Definition: misc.c:445
static void test__get_errno(void)
Definition: misc.c:259
static unsigned __stdcall test_thread_func_ex(void *arg)
Definition: misc.c:618
static void test_thread_handle_close(void)
Definition: misc.c:624
struct _I10_OUTPUT_test I10_OUTPUT_test
static void test__set_errno(void)
Definition: misc.c:310
static void test__get_doserrno(void)
Definition: misc.c:234
static void test_I10_OUTPUT(void)
Definition: misc.c:157
static int __cdecl _lfind_s_comp(void *ctx, const void *l, const void *r)
Definition: misc.c:681
static void test_strerror_s(void)
Definition: misc.c:187
static BOOL almost_equal(double d1, double d2)
Definition: misc.c:30
static int __cdecl qsort_comp(void *ctx, const void *l, const void *r)
Definition: misc.c:429
static int eq_nanf(DWORD ai, float b)
Definition: misc.c:554
static void test__popen(const char *name)
Definition: misc.c:360
static void test_rand_s(void)
Definition: misc.c:75
static const wchar_t const wchar_t unsigned uintptr_t
Definition: misc.c:47
static void test_thread_suspended(void)
Definition: misc.c:668
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:89
HANDLE hThread
Definition: wizard.c:28
#define errno
Definition: errno.h:18
_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle)
_Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle)
_Check_return_ _CRTIMP int __cdecl _unlink(_In_z_ const char *_Filename)
_CRTIMP int __cdecl _open(const char *_Filename, int _OpenFlag,...)
Definition: file.c:2001
_CRTIMP void __cdecl _endthreadex(_In_ unsigned _Retval)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
_CRTIMP uintptr_t __cdecl _beginthread(_In_ void(__cdecl *_StartAddress)(void *), _In_ unsigned _StackSize, _In_opt_ void *_ArgList)
_CRTIMP void __cdecl _endthread(void)
Definition: thread.c:95
#define win_skip
Definition: test.h:164
int winetest_get_mainargs(char ***pargv)
static int fd
Definition: io.c:51
#define memset(x, y, z)
Definition: compat.h:39
char sign
Definition: misc.c:97
BYTE len
Definition: misc.c:98
short pos
Definition: misc.c:96
char str[100]
Definition: misc.c:99
I10_OUTPUT_data out
Definition: misc.c:107
const char * remain
Definition: misc.c:109
struct uld d
Definition: misc.c:103
Definition: copy.c:22
Definition: name.c:39
int pos
Definition: misc.c:420
int l
Definition: misc.c:424
struct qsort_test::@1691 cmp[64]
int * base
Definition: misc.c:421
int r
Definition: misc.c:425
Definition: misc.c:37
ULONG exp
Definition: misc.c:37
ULONG lo
Definition: misc.c:37
ULONG hi
Definition: misc.c:37
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
PVOID HANDLE
Definition: typedefs.h:73
#define __stdcall
Definition: typedefs.h:25
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int ret
static struct wctab tab[]
#define CREATE_SUSPENDED
Definition: winbase.h:181
#define WAIT_OBJECT_0
Definition: winbase.h:432
#define ERROR_INVALID_CMM
Definition: winerror.h:1185
static int init
Definition: wintirpc.c:33
unsigned char BYTE
Definition: xxhash.c:193