Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / oleaut32 / tests / vartest.c
blobf522f5d7e4b147ba9ae6c666c0bb5d1d9d6b4cff
1 /*
2 * VARIANT test program
4 * Copyright 1998 Jean-Claude Cote
6 * The purpose of this program is validate the implementation
7 * of the APIs related to VARIANTs. The validation is done
8 * by comparing the results given by the Windows implementation
9 * versus the Wine implementation.
11 * This program tests the creation/coercion/destruction of VARIANTs.
13 * The program does not currently test any API that takes
14 * arguments of type: IDispatch, IUnknown, DECIMAL, CURRENCY.
16 * Since the purpose of this program is to compare the results
17 * from Windows and Wine it is written so that with a simple
18 * define it can be compiled either in Windows or Linux.
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 * NOTES
35 * - The Variant structure in Windows has a non-named union. This means
36 * the member of the union are accessible simply by doing
37 * pVariant->pfltVal. With gcc it is not possible to have non-named
38 * union so it has been named 'u'. So it's members are accessible
39 * using this name like so pVariant->u.pfltVal. So if this program is
40 * compiled in Windows the references to 'u' will need to be take out
41 * of this file.
43 * - Also the printf is a little different so the format specifiers may
44 * need to be tweaked if this file is compile in Windows.
45 * Printf is also different in that it continues printing numbers
46 * even after there is no more significative digits left to print. These
47 * number are garbage and in windows they are set to zero but not
48 * on Linux.
50 * - The VarDateFromStr is not implemented yet.
52 * - The date and floating point format may not be the exact same
53 * format has the one inwindows depending on what the Internatinal
54 * setting are in windows.
58 #include <stdarg.h>
59 #include <stdio.h>
60 #include <stdlib.h>
61 #include <math.h>
62 #include <float.h>
63 #include <time.h>
65 #include "windef.h"
66 #include "winbase.h"
67 #include "winsock.h"
68 #include "wine/test.h"
69 #include "winuser.h"
70 #include "wingdi.h"
71 #include "winnls.h"
72 #include "winerror.h"
73 #include "winnt.h"
75 #include "wtypes.h"
76 #include "oleauto.h"
79 static HRESULT (WINAPI *pVarBstrFromI1)(CHAR,LCID,ULONG,BSTR*)=NULL;
81 static HRESULT (WINAPI *pVarI1FromBool)(VARIANT_BOOL,CHAR*)=NULL;
82 static HRESULT (WINAPI *pVarI1FromDate)(DATE,CHAR*)=NULL;
83 static HRESULT (WINAPI *pVarI1FromI4)(LONG,CHAR*)=NULL;
84 static HRESULT (WINAPI *pVarI1FromR8)(double,CHAR*)=NULL;
85 static HRESULT (WINAPI *pVarI1FromStr)(OLECHAR*,LCID,ULONG,CHAR*);
86 static HRESULT (WINAPI *pVarI1FromUI1)(BYTE,CHAR*)=NULL;
88 static HRESULT (WINAPI *pVarI2FromUI2)(USHORT,short*)=NULL;
90 static HRESULT (WINAPI *pVarUI2FromBool)(VARIANT_BOOL,USHORT*)=NULL;
91 static HRESULT (WINAPI *pVarUI2FromDate)(DATE,USHORT*)=NULL;
92 static HRESULT (WINAPI *pVarUI2FromI2)(short,USHORT*)=NULL;
93 static HRESULT (WINAPI *pVarUI2FromI4)(LONG,USHORT*);
94 static HRESULT (WINAPI *pVarUI2FromR8)(double,USHORT*)=NULL;
95 static HRESULT (WINAPI *pVarUI2FromStr)(OLECHAR*,LCID,ULONG,USHORT*)=NULL;
97 static HRESULT (WINAPI *pVarUI4FromBool)(VARIANT_BOOL,ULONG*)=NULL;
98 static HRESULT (WINAPI *pVarUI4FromDate)(DATE,ULONG*)=NULL;
99 static HRESULT (WINAPI *pVarUI4FromI2)(short,ULONG*)=NULL;
100 static HRESULT (WINAPI *pVarUI4FromR8)(double,ULONG*)=NULL;
101 static HRESULT (WINAPI *pVarUI4FromStr)(OLECHAR*,LCID,ULONG,ULONG*)=NULL;
103 /* When comparing floating point values we cannot expect an exact match
104 * because the rounding errors depend on the exact algorithm.
106 #define EQ_DOUBLE(a,b) (fabs((a)-(b))<1e-14)
108 #define MAX_BUFFER 1024
110 static char* WtoA( OLECHAR* p )
112 static char buffer[MAX_BUFFER];
113 DWORD len = WideCharToMultiByte( CP_ACP, 0, p, -1, buffer+1, sizeof(buffer)-3, NULL, NULL );
114 buffer[0] = '\"';
115 buffer[len] = '\"';
116 buffer[len+1] = 0;
117 return buffer;
120 static OLECHAR* AtoW( char* p )
122 OLECHAR *buffer;
123 DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 );
124 buffer = malloc( len * sizeof(OLECHAR) );
125 MultiByteToWideChar( CP_ACP, 0, p, -1, buffer, len );
126 return buffer;
129 static const struct _vartypes {
130 int ind;
131 HRESULT vcind1,vcind2,vcex1,vcex2;
132 int todoind1,todoind2,todowcex1,todowcex2;
133 } vartypes[] = {
134 {0, 0, 0x80070057, 0, 0x80020008,0,1 },
135 {1, 0, 0x80070057, 0, 0x80020008,0,1 },
136 {2, 0, 0, 0, 0x80020005 },
137 {3, 0, 0, 0, 0x80020005 },
138 {4, 0, 0, 0, 0x80020005 },
139 {5, 0, 0, 0, 0x80020005 },
140 {6, 0, 0, 0, 0x80020005 },
141 {7, 0, 0, 0, 0x80020005 },
142 {77,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
143 {78,0x80020008, 0x80070057, 0x80020005, 0x80020005,0,1 },
144 {79,0x80020008, 0x80070057, 0x80020005, 0x80020005,0,1 },
145 {80,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
146 {81,0x80020008, 0x80070057, 0x80020005, 0x80020005,0,1 },
147 {82,0x80020008, 0x80070057, 0x80020005, 0x80020005,0,1 },
148 {83,0x80020008, 0x80070057, 0, 0x80020005,0,1,1 },
149 {84,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
150 {85,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
151 {86,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
152 {87,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
153 {88,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
154 {89,0x80020008, 0x80070057, 0, 0x80020005,0,1,1 },
155 {90,0x80020008, 0x80070057, 0, 0x80020005,0,1,1 },
156 {91,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
157 {92,0x80020008, 0x80070057, 0, 0x80020005,0,1 },
158 {93,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
159 {94,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
160 {95,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
161 {96,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
162 {97,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
163 {98,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
164 {99,0x80020008, 0x80070057, 0x80020008, 0x80020008,0,1,1,1 },
167 static const char *strfromr8[] = {
168 "1",
169 "-1",
170 "21",
171 "-21",
172 "321",
173 "-321",
174 "4321",
175 "-4321",
176 "54321",
177 "-54321",
178 "654321",
179 "-654321",
180 "7654321",
181 "-7654321",
182 "87654321",
183 "-87654321",
184 "987654321",
185 "-987654321",
186 "1987654321",
187 "-1987654321",
188 "21987654321",
189 "-21987654321",
190 "321987654321",
191 "-321987654321",
192 "4321987654321",
193 "-4321987654321",
194 "54321987654321",
195 "-54321987654321",
196 "654321987654321",
197 "-654321987654321",
198 "7.65432198765432E+15",
199 "-7.65432198765432E+15",
200 "8.76543219876543E+16",
201 "-8.76543219876543E+16",
202 "9.87654321987654E+17",
203 "-9.87654321987654E+17",
204 "1.98765432198765E+18",
205 "-1.98765432198765E+18",
206 "2.19876543219877E+19",
207 "-2.19876543219877E+19",
208 "1",
209 "0",
210 "-1",
211 "1.2",
212 "0.2",
213 "-1.2",
214 "1.23",
215 "0.23",
216 "-1.23",
217 "1.234",
218 "0.234",
219 "-1.234",
220 "1.2345",
221 "0.2345",
222 "-1.2345",
223 "1.23456",
224 "0.23456",
225 "-1.23456",
226 "1.234567",
227 "0.234567",
228 "-1.234567",
229 "1.2345678",
230 "0.2345678",
231 "-1.2345678",
232 "1.23456789",
233 "0.23456789",
234 "-1.23456789",
235 "1.234567891",
236 "0.234567891",
237 "-1.234567891",
238 "1.2345678912",
239 "0.2345678912",
240 "-1.2345678912",
241 "1.23456789123",
242 "0.23456789123",
243 "-1.23456789123",
244 "1.234567891234",
245 "0.234567891234",
246 "-1.234567891234",
247 "1.2345678912345",
248 "0.2345678912345",
249 "-1.2345678912345",
250 "1.23456789123456",
251 "0.23456789123456",
252 "-1.23456789123456",
253 "1.23456789123457",
254 "0.234567891234567",
255 "-1.23456789123457",
256 "1.23456789123457",
257 "0.234567891234568",
258 "-1.23456789123457",
259 "1.23456789123457",
260 "0.234567891234568",
261 "-1.23456789123457",
262 "1.23456789123457",
263 "0.234567891234568",
264 "-1.23456789123457",
265 "1.23456789123457",
266 "0.234567891234568",
267 "-1.23456789123457",
268 "2",
269 "-2",
270 "22.2",
271 "-22.2",
272 "322.23",
273 "-322.23",
274 "4322.234",
275 "-4322.234",
276 "54322.2345",
277 "-54322.2345",
278 "654322.23456",
279 "-654322.23456",
280 "7654322.234567",
281 "-7654322.234567",
282 "87654322.2345678",
283 "-87654322.2345678",
284 "987654322.234568",
285 "-987654322.234568",
286 "1987654322.23457",
287 "-1987654322.23457",
288 "21987654322.2346",
289 "-21987654322.2346",
290 "321987654322.235",
291 "-321987654322.235",
292 "4321987654322.23",
293 "-4321987654322.23",
294 "54321987654322.2",
295 "-54321987654322.2",
296 "654321987654322",
297 "-654321987654322",
298 "7.65432198765432E+15",
299 "-7.65432198765432E+15",
300 "8.76543219876543E+16",
301 "-8.76543219876543E+16",
302 "9.87654321987654E+17",
303 "-9.87654321987654E+17",
304 "1.98765432198765E+18",
305 "-1.98765432198765E+18",
306 "2.19876543219877E+19",
307 "-2.19876543219877E+19",
308 /* r4 tests */
309 "1",
310 "-1",
311 "21",
312 "-21",
313 "321",
314 "-321",
315 "4321",
316 "-4321",
317 "54321",
318 "-54321",
319 "654321",
320 "-654321",
321 "7654321",
322 "-7654321",
323 "8.765432E+07",
324 "-8.765432E+07",
325 "9.876543E+08",
326 "-9.876543E+08",
327 "1.987654E+09",
328 "-1.987654E+09",
329 "1",
330 "0",
331 "-1",
332 "1.2",
333 "0.2",
334 "-1.2",
335 "1.23",
336 "0.23",
337 "-1.23",
338 "1.234",
339 "0.234",
340 "-1.234",
341 "1.2345",
342 "0.2345",
343 "-1.2345",
344 "1.23456",
345 "0.23456",
346 "-1.23456",
347 "1.234567",
348 "0.234567",
349 "-1.234567",
350 "1.234568",
351 "0.2345678",
352 "-1.234568",
353 "1.234568",
354 "0.2345679",
355 "-1.234568",
356 "1.234568",
357 "0.2345679",
358 "-1.234568",
359 "2",
360 "-2",
361 "22.2",
362 "-22.2",
363 "322.23",
364 "-322.23",
365 "4322.234",
366 "-4322.234",
367 "54322.23",
368 "-54322.23",
369 "654322.3",
370 "-654322.3",
371 "7654322",
372 "-7654322",
373 "8.765432E+07",
374 "-8.765432E+07",
375 "9.876543E+08",
376 "-9.876543E+08",
377 "1.987654E+09",
378 "-1.987654E+09",
381 /* These are the strings we use for the XxxFromStr tests.
382 * The arrays that follow define the expected results for each type.
384 static char* _pTestStrA[] = {
385 "-2",
386 "-1",
387 "-0.51",
388 "-0.5",
389 "-0.49",
390 "-0.0",
391 "0.0",
392 "0.49",
393 "0.5",
394 "0.51",
395 "1",
396 "127",
397 "128",
398 "129",
399 "255",
400 "256",
401 "257",
402 "32767",
403 "32768",
404 "-32768",
405 "-32769",
406 "16777216",
407 "16777217",
408 "-16777216",
409 "16777217",
410 "2147483647",
411 "2147483648",
412 "-2147483647",
413 "-2147483648",
416 " ",
417 "1F",
418 "1G",
419 " 1 ",
420 " 1 2 ",
421 "1,2,3",
422 "1 2 3",
423 "1,2, 3",
424 "1;2;3",
425 "1.2.3",
427 "0.",
428 ".0",
429 "0.1E12",
430 "2.4,E1",
431 " +3.2,E1",
432 "4E2.5",
433 " 2E+2",
434 "1 E+2",
435 ".",
436 ".E2",
437 "1000000000000000000000000000000000000000000000000000000000000000",
438 "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
439 "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
440 "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
441 "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
442 "65535",
443 "65535.5",
444 "65536",
445 "4294967295",
446 "4294967296",
448 "1 January 99",
449 "December 31, 2078",
450 "January 1, 1900",
451 "January 2 1900",
452 "11.11.1999",
453 "11/11/1999",
454 " 11 / 11 / 1999",
455 "11/11/1999:11:11:1134",
456 "11/11/1999 11:11:11:1",
457 "\t1999/\t11/21 11 :11:11am",
459 "11/11/1999 11:11:11Am",
460 "11/11/1999 11:11:11PM",
461 "11/11/199911:11:11PM",
462 "11/11/1999 0:0:11am",
463 "11/11/1999 11,11:11am",
464 "11/11/1999 11:11:11am",
465 "11/11/1999 11/11:11am",
466 "11/11/1999 11:11AM",
467 "11/11/1999 1AM",
468 "11/11/1999 0AM",
470 "11/11/1999 11:11:11",
471 "11/13/1999 0AM",
472 "13/13/1999 0AM",
473 "13/11/1999 0AM",
474 "11/33/1999 0AM",
475 "11/11/1999 AM",
476 "1/1/0 0AM",
477 "1/1/-1 0AM",
478 "1999 January 3 9AM",
479 "1 January 1999 11AM",
481 "4AM 11/11/1999",
482 "4:22 11/11/1999 AM",
483 " 1 1 /11/1999",
484 "11-11/1999 11:11:11.12AM",
485 "1999 January 3, 9AM",
486 "December, 31, 2078",
487 "December, 31, 2078,",
488 "December, 31 2078",
489 "11/99",
490 "11-1999",
492 "true",
493 "True",
494 "TRue",
495 "TRUE",
496 " TRUE",
497 "FALSE ",
498 "False",
499 "JustSomeText",
500 "Just Some Text",
502 "1.5",
503 "2.5",
504 "3.5",
505 "4.5",
507 #define NB_OLE_STRINGS (sizeof(_pTestStrA)/sizeof(*_pTestStrA))
509 static const struct _strret_date {
510 HRESULT error;
511 DATE retval;
512 BOOL todo_rc;
513 BOOL todo_val;
514 } strrets_DATE[NB_OLE_STRINGS] = {
515 { 0x80020005 },
516 { 0x80020005 },
517 { 0x80020005 },
518 { 0x80020005 },
519 { 0x80020005 },
520 { 0x80020005 },
521 { 0, 0.0, 1 },
522 { 0, 0.03402777777777, 1 },
523 { 0, 0.00347222222222, 1 },
524 { 0, 0.03541666666666, 1 },
525 { 0x80020005 },
526 { 0x80020005 },
527 { 0x80020005 },
528 { 0x80020005 },
529 { 0x80020005 },
530 { 0x80020005 },
531 { 0x80020005 },
532 { 0x80020005 },
533 { 0x80020005 },
534 { 0x80020005 },
535 { 0x80020005 },
536 { 0x80020005, 0.0, 1 },
537 { 0x80020005, 0.0, 1 },
538 { 0x80020005 },
539 { 0x80020005, 0.0, 1 },
540 { 0x80020005 },
541 { 0x80020005 },
542 { 0x80020005 },
543 { 0x80020005 },
544 { 0x80020005 },
545 { 0x80020005 },
546 { 0x80020005 },
547 { 0x80020005 },
548 { 0x80020005 },
549 { 0, 37623.0, 1 },
550 { 0, 37623.0 },
551 { 0, 37623.0 },
552 { 0, 37623.0 },
553 { 0x80020005, 0.0, 1 },
554 { 0, 0.04309027777777, 0, 1 },
555 { 0x80020005 },
556 { 0x80020005 },
557 { 0x80020005, 0.0, 1 },
558 { 0x80020005, 0.0, 1 },
559 { 0x80020005 },
560 { 0x80020005, 0.0, 1 },
561 { 0x80020005 },
562 { 0x80020005 },
563 { 0x80020005 },
564 { 0x80020005 },
565 { 0x80020005 },
566 { 0x80020005 },
567 { 0x80020005 },
568 { 0x80020005 },
569 { 0x80020005 },
570 { 0x80020005 },
571 { 0x80020005 },
572 { 0x80020005 },
573 { 0x80020005 },
574 { 0x80020005 },
575 { 0, 36161.0, 1 },
576 { 0, 65380.0 },
577 { 0, 2.0},
578 { 0, 3.0 },
579 { 0x80020005, 0.0, 1 },
580 { 0, 36475.0 },
581 { 0, 36475.0 },
582 { 0x80020005 },
583 { 0x80020005 },
584 { 0, 36485.466099537036, 1 },
585 { 0, 36475.466099537036 },
586 { 0, 36475.966099537036 },
587 { 0x80020005, 0.0, 1 },
588 { 0, 36475.000127314815 },
589 { 0x80020005 },
590 { 0, 36475.466099537036 },
591 { 0x80020005 },
592 { 0, 36475.465972222222 },
593 { 0, 36475.041666666664, 1 },
594 { 0, 36475.0, 1 },
595 { 0, 36475.466099537036 },
596 { 0, 36477.0, 1 },
597 { 0x80020005 },
598 { 0, 36477.0, 1 },
599 { 0x80020005 },
600 { 0x80020005, 0.0, 1 },
601 { 0, 36526.0, 1 },
602 { 0x80020005 },
603 { 0, 36163.375000000000, 1 },
604 { 0, 36161.458333333336, 1 },
605 { 0, 36475.166666666664, 1 },
606 { 0x80020005, 0.0, 1 },
607 { 0x80020005 },
608 { 0x80020005, 0.0, 1 },
609 { 0x80020005 },
610 { 0, 65380.0 },
611 { 0x80020005, 0.0, 1 },
612 { 0, 65380.0 },
613 { 0, 36465.0, 1 },
614 { 0, 36465.0, 1 },
615 { 0x80020005 },
616 { 0x80020005 },
617 { 0x80020005 },
618 { 0x80020005 },
619 { 0x80020005 },
620 { 0x80020005 },
621 { 0x80020005 },
622 { 0x80020005 },
623 { 0x80020005 },
624 { 0, 0.045138888888889, 1 },
625 { 0, 0.086805555555556, 1 },
626 { 0, 0.128472222222222, 1 },
627 { 0, 0.170138888888889, 1 },
629 static const struct _strret_b {
630 HRESULT error;
631 BOOL retval;
632 } strrets_B[NB_OLE_STRINGS] = {
633 { 0, VARIANT_TRUE },
634 { 0, VARIANT_TRUE },
635 { 0, VARIANT_TRUE },
636 { 0, VARIANT_TRUE },
637 { 0, VARIANT_TRUE },
638 { 0, VARIANT_FALSE },
639 { 0, VARIANT_FALSE },
640 { 0, VARIANT_TRUE },
641 { 0, VARIANT_TRUE },
642 { 0, VARIANT_TRUE },
643 { 0, VARIANT_TRUE },
644 { 0, VARIANT_TRUE },
645 { 0, VARIANT_TRUE },
646 { 0, VARIANT_TRUE },
647 { 0, VARIANT_TRUE },
648 { 0, VARIANT_TRUE },
649 { 0, VARIANT_TRUE },
650 { 0, VARIANT_TRUE },
651 { 0, VARIANT_TRUE },
652 { 0, VARIANT_TRUE },
653 { 0, VARIANT_TRUE },
654 { 0, VARIANT_TRUE },
655 { 0, VARIANT_TRUE },
656 { 0, VARIANT_TRUE },
657 { 0, VARIANT_TRUE },
658 { 0, VARIANT_TRUE },
659 { 0, VARIANT_TRUE },
660 { 0, VARIANT_TRUE },
661 { 0, VARIANT_TRUE },
662 { 0x80020005 },
663 { 0x80020005 },
664 { 0x80020005 },
665 { 0x80020005 },
666 { 0, VARIANT_TRUE },
667 { 0x80020005 },
668 { 0, VARIANT_TRUE },
669 { 0x80020005 },
670 { 0x80020005 },
671 { 0x80020005 },
672 { 0x80020005 },
673 { 0, VARIANT_FALSE },
674 { 0, VARIANT_FALSE },
675 { 0, VARIANT_TRUE },
676 { 0, VARIANT_TRUE },
677 { 0, VARIANT_TRUE },
678 { 0x80020005 },
679 { 0, VARIANT_TRUE },
680 { 0x80020005 },
681 { 0x80020005 },
682 { 0x80020005 },
683 { 0, VARIANT_TRUE },
684 { 0, VARIANT_TRUE },
685 { 0, VARIANT_TRUE },
686 { 0, VARIANT_TRUE },
687 { 0, VARIANT_TRUE },
688 { 0, VARIANT_TRUE },
689 { 0, VARIANT_TRUE },
690 { 0, VARIANT_TRUE },
691 { 0, VARIANT_TRUE },
692 { 0, VARIANT_TRUE },
693 { 0x80020005 },
694 { 0x80020005 },
695 { 0x80020005 },
696 { 0x80020005 },
697 { 0x80020005 },
698 { 0x80020005 },
699 { 0x80020005 },
700 { 0x80020005 },
701 { 0x80020005 },
702 { 0x80020005 },
703 { 0x80020005 },
704 { 0x80020005 },
705 { 0x80020005 },
706 { 0x80020005 },
707 { 0x80020005 },
708 { 0x80020005 },
709 { 0x80020005 },
710 { 0x80020005 },
711 { 0x80020005 },
712 { 0x80020005 },
713 { 0x80020005 },
714 { 0x80020005 },
715 { 0x80020005 },
716 { 0x80020005 },
717 { 0x80020005 },
718 { 0x80020005 },
719 { 0x80020005 },
720 { 0x80020005 },
721 { 0x80020005 },
722 { 0x80020005 },
723 { 0x80020005 },
724 { 0x80020005 },
725 { 0x80020005 },
726 { 0x80020005 },
727 { 0x80020005 },
728 { 0x80020005 },
729 { 0x80020005 },
730 { 0x80020005 },
731 { 0x80020005 },
732 { 0x80020005 },
733 { 0, VARIANT_TRUE },
734 { 0, VARIANT_TRUE },
735 { 0, VARIANT_TRUE },
736 { 0, VARIANT_TRUE },
737 { 0x80020005 },
738 { 0x80020005 },
739 { 0, VARIANT_FALSE },
740 { 0x80020005 },
741 { 0x80020005 },
742 { 0, VARIANT_TRUE },
743 { 0, VARIANT_TRUE },
744 { 0, VARIANT_TRUE },
745 { 0, VARIANT_TRUE },
747 static const struct _strret_r8 {
748 HRESULT error;
749 DOUBLE retval;
750 } strrets_R8[NB_OLE_STRINGS] = {
751 { 0, -2.000000 },
752 { 0, -1.000000 },
753 { 0, -0.510000 },
754 { 0, -0.500000 },
755 { 0, -0.490000 },
756 { 0, 0.000000 },
757 { 0, 0.000000 },
758 { 0, 0.490000 },
759 { 0, 0.500000 },
760 { 0, 0.510000 },
761 { 0, 1.000000 },
762 { 0, 127.000000 },
763 { 0, 128.000000 },
764 { 0, 129.000000 },
765 { 0, 255.000000 },
766 { 0, 256.000000 },
767 { 0, 257.000000 },
768 { 0, 32767.000000 },
769 { 0, 32768.000000 },
770 { 0, -32768.000000 },
771 { 0, -32769.000000 },
772 { 0, 16777216.000000 },
773 { 0, 16777217.000000 },
774 { 0, -16777216.000000 },
775 { 0, 16777217.000000 },
776 { 0, 2147483647.000000 },
777 { 0, 2147483648.000000 },
778 { 0, -2147483647.000000 },
779 { 0, -2147483648.000000 },
780 { 0x80020005 },
781 { 0x80020005 },
782 { 0x80020005 },
783 { 0x80020005 },
784 { 0, 1.000000 },
785 { 0x80020005 },
786 { 0, 123.000000 },
787 { 0x80020005 },
788 { 0x80020005 },
789 { 0x80020005 },
790 { 0x80020005 },
791 { 0, 0.000000 },
792 { 0, 0.000000 },
793 { 0, 100000000000.000000 },
794 { 0, 24.000000 },
795 { 0, 32.000000 },
796 { 0x80020005 },
797 { 0, 200.000000 },
798 { 0x80020005 },
799 { 0x80020005 },
800 { 0x80020005 },
801 { 0, 1e63 },
802 { 0, 1.000000 },
803 { 0, 1.000000 },
804 { 0, 99999999999999997e183 },
805 { 0, 1.000000 },
806 { 0, 65535.000000 },
807 { 0, 65535.500000 },
808 { 0, 65536.000000 },
809 { 0, 4294967295.000000 },
810 { 0, 4294967296.000000 },
811 { 0x80020005 },
812 { 0x80020005 },
813 { 0x80020005 },
814 { 0x80020005 },
815 { 0x80020005 },
816 { 0x80020005 },
817 { 0x80020005 },
818 { 0x80020005 },
819 { 0x80020005 },
820 { 0x80020005 },
821 { 0x80020005 },
822 { 0x80020005 },
823 { 0x80020005 },
824 { 0x80020005 },
825 { 0x80020005 },
826 { 0x80020005 },
827 { 0x80020005 },
828 { 0x80020005 },
829 { 0x80020005 },
830 { 0x80020005 },
831 { 0x80020005 },
832 { 0x80020005 },
833 { 0x80020005 },
834 { 0x80020005 },
835 { 0x80020005 },
836 { 0x80020005 },
837 { 0x80020005 },
838 { 0x80020005 },
839 { 0x80020005 },
840 { 0x80020005 },
841 { 0x80020005 },
842 { 0x80020005 },
843 { 0x80020005 },
844 { 0x80020005 },
845 { 0x80020005 },
846 { 0x80020005 },
847 { 0x80020005 },
848 { 0x80020005 },
849 { 0x80020005 },
850 { 0x80020005 },
851 { 0x80020005 },
852 { 0x80020005 },
853 { 0x80020005 },
854 { 0x80020005 },
855 { 0x80020005 },
856 { 0x80020005 },
857 { 0x80020005 },
858 { 0x80020005 },
859 { 0x80020005 },
860 { 0, 1.500000 },
861 { 0, 2.500000 },
862 { 0, 3.500000 },
863 { 0, 4.500000 },
865 static const struct _strret_r4 {
866 HRESULT error;
867 FLOAT retval;
868 } strrets_R4[NB_OLE_STRINGS] = {
869 { 0, -2.000000F },
870 { 0, -1.000000F },
871 { 0, -0.510000F },
872 { 0, -0.500000F },
873 { 0, -0.490000F },
874 { 0, 0.000000F },
875 { 0, 0.000000F },
876 { 0, 0.490000F },
877 { 0, 0.500000F },
878 { 0, 0.510000F },
879 { 0, 1.000000F },
880 { 0, 127.000000F },
881 { 0, 128.000000F },
882 { 0, 129.000000F },
883 { 0, 255.000000F },
884 { 0, 256.000000F },
885 { 0, 257.000000F },
886 { 0, 32767.000000F },
887 { 0, 32768.000000F },
888 { 0, -32768.000000F },
889 { 0, -32769.000000F },
890 { 0, 16777216.000000F },
891 { 0, 16777216.000000F },
892 { 0, -16777216.000000F },
893 { 0, 16777216.000000F },
894 { 0, 2147483648.000000F },
895 { 0, 2147483648.000000F },
896 { 0, -2147483648.000000F },
897 { 0, -2147483648.000000F },
898 { 0x80020005 },
899 { 0x80020005 },
900 { 0x80020005 },
901 { 0x80020005 },
902 { 0, 1.000000F },
903 { 0x80020005 },
904 { 0, 123.000000F },
905 { 0x80020005 },
906 { 0x80020005 },
907 { 0x80020005 },
908 { 0x80020005 },
909 { 0, 0.000000F },
910 { 0, 0.000000F },
911 { 0, 99999997952.000000F },
912 { 0, 24.000000F },
913 { 0, 32.000000F },
914 { 0x80020005 },
915 { 0, 200.000000F },
916 { 0x80020005 },
917 { 0x80020005 },
918 { 0x80020005 },
919 { 0x8002000A },
920 { 0, 1.000000F },
921 { 0, 1.000000F },
922 { 0x8002000A },
923 { 0, 1.000000F },
924 { 0, 65535.000000F },
925 { 0, 65535.500000F },
926 { 0, 65536.000000F },
927 { 0, 4294967296.000000F },
928 { 0, 4294967296.000000F },
929 { 0x80020005 },
930 { 0x80020005 },
931 { 0x80020005 },
932 { 0x80020005 },
933 { 0x80020005 },
934 { 0x80020005 },
935 { 0x80020005 },
936 { 0x80020005 },
937 { 0x80020005 },
938 { 0x80020005 },
939 { 0x80020005 },
940 { 0x80020005 },
941 { 0x80020005 },
942 { 0x80020005 },
943 { 0x80020005 },
944 { 0x80020005 },
945 { 0x80020005 },
946 { 0x80020005 },
947 { 0x80020005 },
948 { 0x80020005 },
949 { 0x80020005 },
950 { 0x80020005 },
951 { 0x80020005 },
952 { 0x80020005 },
953 { 0x80020005 },
954 { 0x80020005 },
955 { 0x80020005 },
956 { 0x80020005 },
957 { 0x80020005 },
958 { 0x80020005 },
959 { 0x80020005 },
960 { 0x80020005 },
961 { 0x80020005 },
962 { 0x80020005 },
963 { 0x80020005 },
964 { 0x80020005 },
965 { 0x80020005 },
966 { 0x80020005 },
967 { 0x80020005 },
968 { 0x80020005 },
969 { 0x80020005 },
970 { 0x80020005 },
971 { 0x80020005 },
972 { 0x80020005 },
973 { 0x80020005 },
974 { 0x80020005 },
975 { 0x80020005 },
976 { 0x80020005 },
977 { 0x80020005 },
978 { 0, 1.500000F },
979 { 0, 2.500000F },
980 { 0, 3.500000F },
981 { 0, 4.500000F },
983 static const struct _strret_i4 {
984 HRESULT error;
985 LONG retval;
986 } strrets_I4[NB_OLE_STRINGS] = {
987 { 0, -2L },
988 { 0, -1L },
989 { 0, -1L },
990 { 0, 0L },
991 { 0, 0L },
992 { 0, 0L },
993 { 0, 0L },
994 { 0, 0L },
995 { 0, 0L },
996 { 0, 1L },
997 { 0, 1L },
998 { 0, 127L },
999 { 0, 128L },
1000 { 0, 129L },
1001 { 0, 255L },
1002 { 0, 256L },
1003 { 0, 257L },
1004 { 0, 32767L },
1005 { 0, 32768L },
1006 { 0, -32768L },
1007 { 0, -32769L },
1008 { 0, 16777216L },
1009 { 0, 16777217L },
1010 { 0, -16777216L },
1011 { 0, 16777217L },
1012 { 0, 2147483647L },
1013 { 0x8002000A },
1014 { 0, -2147483647L },
1015 { 0, 0x80000000L },
1016 { 0x80020005 },
1017 { 0x80020005 },
1018 { 0x80020005 },
1019 { 0x80020005 },
1020 { 0, 1L },
1021 { 0x80020005 },
1022 { 0, 123L },
1023 { 0x80020005 },
1024 { 0x80020005 },
1025 { 0x80020005 },
1026 { 0x80020005 },
1027 { 0, 0L },
1028 { 0, 0L },
1029 { 0x8002000A },
1030 { 0, 24L },
1031 { 0, 32L },
1032 { 0x80020005 },
1033 { 0, 200L },
1034 { 0x80020005 },
1035 { 0x80020005 },
1036 { 0x80020005 },
1037 { 0x8002000A },
1038 { 0, 1L },
1039 { 0, 1L },
1040 { 0x8002000A },
1041 { 0, 1L },
1042 { 0, 65535L },
1043 { 0, 65536L },
1044 { 0, 65536L },
1045 { 0x8002000A },
1046 { 0x8002000A },
1047 { 0x80020005 },
1048 { 0x80020005 },
1049 { 0x80020005 },
1050 { 0x80020005 },
1051 { 0x80020005 },
1052 { 0x80020005 },
1053 { 0x80020005 },
1054 { 0x80020005 },
1055 { 0x80020005 },
1056 { 0x80020005 },
1057 { 0x80020005 },
1058 { 0x80020005 },
1059 { 0x80020005 },
1060 { 0x80020005 },
1061 { 0x80020005 },
1062 { 0x80020005 },
1063 { 0x80020005 },
1064 { 0x80020005 },
1065 { 0x80020005 },
1066 { 0x80020005 },
1067 { 0x80020005 },
1068 { 0x80020005 },
1069 { 0x80020005 },
1070 { 0x80020005 },
1071 { 0x80020005 },
1072 { 0x80020005 },
1073 { 0x80020005 },
1074 { 0x80020005 },
1075 { 0x80020005 },
1076 { 0x80020005 },
1077 { 0x80020005 },
1078 { 0x80020005 },
1079 { 0x80020005 },
1080 { 0x80020005 },
1081 { 0x80020005 },
1082 { 0x80020005 },
1083 { 0x80020005 },
1084 { 0x80020005 },
1085 { 0x80020005 },
1086 { 0x80020005 },
1087 { 0x80020005 },
1088 { 0x80020005 },
1089 { 0x80020005 },
1090 { 0x80020005 },
1091 { 0x80020005 },
1092 { 0x80020005 },
1093 { 0x80020005 },
1094 { 0x80020005 },
1095 { 0x80020005 },
1096 { 0, 2L },
1097 { 0, 2L },
1098 { 0, 4L },
1099 { 0, 4L },
1101 static const struct _strret_i2 {
1102 HRESULT error;
1103 SHORT retval;
1104 } strrets_I2[NB_OLE_STRINGS] = {
1105 { 0, -2 },
1106 { 0, -1 },
1107 { 0, -1 },
1108 { 0, 0 },
1109 { 0, 0 },
1110 { 0, 0 },
1111 { 0, 0 },
1112 { 0, 0 },
1113 { 0, 0 },
1114 { 0, 1 },
1115 { 0, 1 },
1116 { 0, 127 },
1117 { 0, 128 },
1118 { 0, 129 },
1119 { 0, 255 },
1120 { 0, 256 },
1121 { 0, 257 },
1122 { 0, 32767 },
1123 { 0x8002000A },
1124 { 0, -32768 },
1125 { 0x8002000A },
1126 { 0x8002000A },
1127 { 0x8002000A },
1128 { 0x8002000A },
1129 { 0x8002000A },
1130 { 0x8002000A },
1131 { 0x8002000A },
1132 { 0x8002000A },
1133 { 0x8002000A },
1134 { 0x80020005 },
1135 { 0x80020005 },
1136 { 0x80020005 },
1137 { 0x80020005 },
1138 { 0, 1 },
1139 { 0x80020005 },
1140 { 0, 123 },
1141 { 0x80020005 },
1142 { 0x80020005 },
1143 { 0x80020005 },
1144 { 0x80020005 },
1145 { 0, 0 },
1146 { 0, 0 },
1147 { 0x8002000A },
1148 { 0, 24 },
1149 { 0, 32 },
1150 { 0x80020005 },
1151 { 0, 200 },
1152 { 0x80020005 },
1153 { 0x80020005 },
1154 { 0x80020005 },
1155 { 0x8002000A },
1156 { 0, 1 },
1157 { 0, 1 },
1158 { 0x8002000A },
1159 { 0, 1 },
1160 { 0x8002000A },
1161 { 0x8002000A },
1162 { 0x8002000A },
1163 { 0x8002000A },
1164 { 0x8002000A },
1165 { 0x80020005 },
1166 { 0x80020005 },
1167 { 0x80020005 },
1168 { 0x80020005 },
1169 { 0x80020005 },
1170 { 0x80020005 },
1171 { 0x80020005 },
1172 { 0x80020005 },
1173 { 0x80020005 },
1174 { 0x80020005 },
1175 { 0x80020005 },
1176 { 0x80020005 },
1177 { 0x80020005 },
1178 { 0x80020005 },
1179 { 0x80020005 },
1180 { 0x80020005 },
1181 { 0x80020005 },
1182 { 0x80020005 },
1183 { 0x80020005 },
1184 { 0x80020005 },
1185 { 0x80020005 },
1186 { 0x80020005 },
1187 { 0x80020005 },
1188 { 0x80020005 },
1189 { 0x80020005 },
1190 { 0x80020005 },
1191 { 0x80020005 },
1192 { 0x80020005 },
1193 { 0x80020005 },
1194 { 0x80020005 },
1195 { 0x80020005 },
1196 { 0x80020005 },
1197 { 0x80020005 },
1198 { 0x80020005 },
1199 { 0x80020005 },
1200 { 0x80020005 },
1201 { 0x80020005 },
1202 { 0x80020005 },
1203 { 0x80020005 },
1204 { 0x80020005 },
1205 { 0x80020005 },
1206 { 0x80020005 },
1207 { 0x80020005 },
1208 { 0x80020005 },
1209 { 0x80020005 },
1210 { 0x80020005 },
1211 { 0x80020005 },
1212 { 0x80020005 },
1213 { 0x80020005 },
1214 { 0, 2 },
1215 { 0, 2 },
1216 { 0, 4 },
1217 { 0, 4 },
1219 static const struct _strret_i1 {
1220 HRESULT error;
1221 CHAR retval;
1222 } strrets_I1[NB_OLE_STRINGS] = {
1223 { 0, -2 },
1224 { 0, -1 },
1225 { 0, -1 },
1226 { 0, 0 },
1227 { 0, 0 },
1228 { 0, 0 },
1229 { 0, 0 },
1230 { 0, 0 },
1231 { 0, 0 },
1232 { 0, 1 },
1233 { 0, 1 },
1234 { 0, 127 },
1235 { 0x8002000A },
1236 { 0x8002000A },
1237 { 0x8002000A },
1238 { 0x8002000A },
1239 { 0x8002000A },
1240 { 0x8002000A },
1241 { 0x8002000A },
1242 { 0x8002000A },
1243 { 0x8002000A },
1244 { 0x8002000A },
1245 { 0x8002000A },
1246 { 0x8002000A },
1247 { 0x8002000A },
1248 { 0x8002000A },
1249 { 0x8002000A },
1250 { 0x8002000A },
1251 { 0x8002000A },
1252 { 0x80020005 },
1253 { 0x80020005 },
1254 { 0x80020005 },
1255 { 0x80020005 },
1256 { 0, 1 },
1257 { 0x80020005 },
1258 { 0, 123 },
1259 { 0x80020005 },
1260 { 0x80020005 },
1261 { 0x80020005 },
1262 { 0x80020005 },
1263 { 0, 0 },
1264 { 0, 0 },
1265 { 0x8002000A },
1266 { 0, 24 },
1267 { 0, 32 },
1268 { 0x80020005 },
1269 { 0x8002000A },
1270 { 0x80020005 },
1271 { 0x80020005 },
1272 { 0x80020005 },
1273 { 0x8002000A },
1274 { 0, 1 },
1275 { 0, 1 },
1276 { 0x8002000A },
1277 { 0, 1 },
1278 { 0x8002000A },
1279 { 0x8002000A },
1280 { 0x8002000A },
1281 { 0x8002000A },
1282 { 0x8002000A },
1283 { 0x80020005 },
1284 { 0x80020005 },
1285 { 0x80020005 },
1286 { 0x80020005 },
1287 { 0x80020005 },
1288 { 0x80020005 },
1289 { 0x80020005 },
1290 { 0x80020005 },
1291 { 0x80020005 },
1292 { 0x80020005 },
1293 { 0x80020005 },
1294 { 0x80020005 },
1295 { 0x80020005 },
1296 { 0x80020005 },
1297 { 0x80020005 },
1298 { 0x80020005 },
1299 { 0x80020005 },
1300 { 0x80020005 },
1301 { 0x80020005 },
1302 { 0x80020005 },
1303 { 0x80020005 },
1304 { 0x80020005 },
1305 { 0x80020005 },
1306 { 0x80020005 },
1307 { 0x80020005 },
1308 { 0x80020005 },
1309 { 0x80020005 },
1310 { 0x80020005 },
1311 { 0x80020005 },
1312 { 0x80020005 },
1313 { 0x80020005 },
1314 { 0x80020005 },
1315 { 0x80020005 },
1316 { 0x80020005 },
1317 { 0x80020005 },
1318 { 0x80020005 },
1319 { 0x80020005 },
1320 { 0x80020005 },
1321 { 0x80020005 },
1322 { 0x80020005 },
1323 { 0x80020005 },
1324 { 0x80020005 },
1325 { 0x80020005 },
1326 { 0x80020005 },
1327 { 0x80020005 },
1328 { 0x80020005 },
1329 { 0x80020005 },
1330 { 0x80020005 },
1331 { 0x80020005 },
1332 { 0, 2 },
1333 { 0, 2 },
1334 { 0, 4 },
1335 { 0, 4 },
1337 static const struct _strret_u1 {
1338 HRESULT error;
1339 BYTE retval;
1340 } strrets_U1[NB_OLE_STRINGS] = {
1341 { 0x8002000A },
1342 { 0x8002000A },
1343 { 0x8002000A },
1344 { 0, 0 },
1345 { 0, 0 },
1346 { 0, 0 },
1347 { 0, 0 },
1348 { 0, 0 },
1349 { 0, 0 },
1350 { 0, 1 },
1351 { 0, 1 },
1352 { 0, 0x7F },
1353 { 0, 0x80 },
1354 { 0, 0x81 },
1355 { 0, 0xFF },
1356 { 0x8002000A },
1357 { 0x8002000A },
1358 { 0x8002000A },
1359 { 0x8002000A },
1360 { 0x8002000A },
1361 { 0x8002000A },
1362 { 0x8002000A },
1363 { 0x8002000A },
1364 { 0x8002000A },
1365 { 0x8002000A },
1366 { 0x8002000A },
1367 { 0x8002000A },
1368 { 0x8002000A },
1369 { 0x8002000A },
1370 { 0x80020005 },
1371 { 0x80020005 },
1372 { 0x80020005 },
1373 { 0x80020005 },
1374 { 0, 1 },
1375 { 0x80020005 },
1376 { 0, 0x7B },
1377 { 0x80020005 },
1378 { 0x80020005 },
1379 { 0x80020005 },
1380 { 0x80020005 },
1381 { 0, 0 },
1382 { 0, 0 },
1383 { 0x8002000A },
1384 { 0, 0x18 },
1385 { 0, 0x20 },
1386 { 0x80020005 },
1387 { 0, 0xC8 },
1388 { 0x80020005 },
1389 { 0x80020005 },
1390 { 0x80020005 },
1391 { 0x8002000A },
1392 { 0, 1 },
1393 { 0, 1 },
1394 { 0x8002000A },
1395 { 0, 1 },
1396 { 0x8002000A },
1397 { 0x8002000A },
1398 { 0x8002000A },
1399 { 0x8002000A },
1400 { 0x8002000A },
1401 { 0x80020005 },
1402 { 0x80020005 },
1403 { 0x80020005 },
1404 { 0x80020005 },
1405 { 0x80020005 },
1406 { 0x80020005 },
1407 { 0x80020005 },
1408 { 0x80020005 },
1409 { 0x80020005 },
1410 { 0x80020005 },
1411 { 0x80020005 },
1412 { 0x80020005 },
1413 { 0x80020005 },
1414 { 0x80020005 },
1415 { 0x80020005 },
1416 { 0x80020005 },
1417 { 0x80020005 },
1418 { 0x80020005 },
1419 { 0x80020005 },
1420 { 0x80020005 },
1421 { 0x80020005 },
1422 { 0x80020005 },
1423 { 0x80020005 },
1424 { 0x80020005 },
1425 { 0x80020005 },
1426 { 0x80020005 },
1427 { 0x80020005 },
1428 { 0x80020005 },
1429 { 0x80020005 },
1430 { 0x80020005 },
1431 { 0x80020005 },
1432 { 0x80020005 },
1433 { 0x80020005 },
1434 { 0x80020005 },
1435 { 0x80020005 },
1436 { 0x80020005 },
1437 { 0x80020005 },
1438 { 0x80020005 },
1439 { 0x80020005 },
1440 { 0x80020005 },
1441 { 0x80020005 },
1442 { 0x80020005 },
1443 { 0x80020005 },
1444 { 0x80020005 },
1445 { 0x80020005 },
1446 { 0x80020005 },
1447 { 0x80020005 },
1448 { 0x80020005 },
1449 { 0x80020005 },
1450 { 0, 2 },
1451 { 0, 2 },
1452 { 0, 4 },
1453 { 0, 4 },
1456 static const struct _strret_U2 {
1457 HRESULT error;
1458 WORD retval;
1459 } strrets_U2[NB_OLE_STRINGS] = {
1460 { 0x8002000A },
1461 { 0x8002000A },
1462 { 0x8002000A },
1463 { 0, 0 },
1464 { 0, 0 },
1465 { 0, 0 },
1466 { 0, 0 },
1467 { 0, 0 },
1468 { 0, 0 },
1469 { 0, 1 },
1470 { 0, 1 },
1471 { 0, 127 },
1472 { 0, 128 },
1473 { 0, 129 },
1474 { 0, 255 },
1475 { 0, 256 },
1476 { 0, 257 },
1477 { 0, 32767 },
1478 { 0, 32768 },
1479 { 0x8002000A },
1480 { 0x8002000A },
1481 { 0x8002000A },
1482 { 0x8002000A },
1483 { 0x8002000A },
1484 { 0x8002000A },
1485 { 0x8002000A },
1486 { 0x8002000A },
1487 { 0x8002000A },
1488 { 0x8002000A },
1489 { 0x80020005 },
1490 { 0x80020005 },
1491 { 0x80020005 },
1492 { 0x80020005 },
1493 { 0, 1 },
1494 { 0x80020005 },
1495 { 0, 123 },
1496 { 0x80020005 },
1497 { 0x80020005 },
1498 { 0x80020005 },
1499 { 0x80020005 },
1500 { 0, 0 },
1501 { 0, 0 },
1502 { 0x8002000A },
1503 { 0, 24 },
1504 { 0, 32 },
1505 { 0x80020005 },
1506 { 0, 200 },
1507 { 0x80020005 },
1508 { 0x80020005 },
1509 { 0x80020005 },
1510 { 0x8002000A },
1511 { 0, 1 },
1512 { 0, 1 },
1513 { 0x8002000A },
1514 { 0, 1 },
1515 { 0, 65535 },
1516 { 0x8002000A },
1517 { 0x8002000A },
1518 { 0x8002000A },
1519 { 0x8002000A },
1520 { 0x80020005 },
1521 { 0x80020005 },
1522 { 0x80020005 },
1523 { 0x80020005 },
1524 { 0x80020005 },
1525 { 0x80020005 },
1526 { 0x80020005 },
1527 { 0x80020005 },
1528 { 0x80020005 },
1529 { 0x80020005 },
1530 { 0x80020005 },
1531 { 0x80020005 },
1532 { 0x80020005 },
1533 { 0x80020005 },
1534 { 0x80020005 },
1535 { 0x80020005 },
1536 { 0x80020005 },
1537 { 0x80020005 },
1538 { 0x80020005 },
1539 { 0x80020005 },
1540 { 0x80020005 },
1541 { 0x80020005 },
1542 { 0x80020005 },
1543 { 0x80020005 },
1544 { 0x80020005 },
1545 { 0x80020005 },
1546 { 0x80020005 },
1547 { 0x80020005 },
1548 { 0x80020005 },
1549 { 0x80020005 },
1550 { 0x80020005 },
1551 { 0x80020005 },
1552 { 0x80020005 },
1553 { 0x80020005 },
1554 { 0x80020005 },
1555 { 0x80020005 },
1556 { 0x80020005 },
1557 { 0x80020005 },
1558 { 0x80020005 },
1559 { 0x80020005 },
1560 { 0x80020005 },
1561 { 0x80020005 },
1562 { 0x80020005 },
1563 { 0x80020005 },
1564 { 0x80020005 },
1565 { 0x80020005 },
1566 { 0x80020005 },
1567 { 0x80020005 },
1568 { 0x80020005 },
1569 { 0, 2 },
1570 { 0, 2 },
1571 { 0, 4 },
1572 { 0, 4 },
1575 static const struct _strret_U4 {
1576 HRESULT error;
1577 DWORD retval;
1578 } strrets_U4[NB_OLE_STRINGS] = {
1579 { 0x8002000A },
1580 { 0x8002000A },
1581 { 0x8002000A },
1582 { 0, 0 },
1583 { 0, 0 },
1584 { 0, 0 },
1585 { 0, 0 },
1586 { 0, 0 },
1587 { 0, 0 },
1588 { 0, 1 },
1589 { 0, 1 },
1590 { 0, 127 },
1591 { 0, 128 },
1592 { 0, 129 },
1593 { 0, 255 },
1594 { 0, 256 },
1595 { 0, 257 },
1596 { 0, 32767 },
1597 { 0, 32768 },
1598 { 0x8002000A },
1599 { 0x8002000A },
1600 { 0, 16777216 },
1601 { 0, 16777217 },
1602 { 0x8002000A },
1603 { 0, 16777217 },
1604 { 0, 2147483647 },
1605 { 0, 2147483648U },
1606 { 0x8002000A },
1607 { 0x8002000A },
1608 { 0x80020005 },
1609 { 0x80020005 },
1610 { 0x80020005 },
1611 { 0x80020005 },
1612 { 0, 1 },
1613 { 0x80020005 },
1614 { 0, 123 },
1615 { 0x80020005 },
1616 { 0x80020005 },
1617 { 0x80020005 },
1618 { 0x80020005 },
1619 { 0, 0 },
1620 { 0, 0 },
1621 { 0x8002000A },
1622 { 0, 24 },
1623 { 0, 32 },
1624 { 0x80020005 },
1625 { 0, 200 },
1626 { 0x80020005 },
1627 { 0x80020005 },
1628 { 0x80020005 },
1629 { 0x8002000A },
1630 { 0, 1 },
1631 { 0, 1 },
1632 { 0x8002000A },
1633 { 0, 1 },
1634 { 0, 65535 },
1635 { 0, 65536 },
1636 { 0, 65536 },
1637 { 0, 4294967295U },
1638 { 0x8002000A },
1639 { 0x80020005 },
1640 { 0x80020005 },
1641 { 0x80020005 },
1642 { 0x80020005 },
1643 { 0x80020005 },
1644 { 0x80020005 },
1645 { 0x80020005 },
1646 { 0x80020005 },
1647 { 0x80020005 },
1648 { 0x80020005 },
1649 { 0x80020005 },
1650 { 0x80020005 },
1651 { 0x80020005 },
1652 { 0x80020005 },
1653 { 0x80020005 },
1654 { 0x80020005 },
1655 { 0x80020005 },
1656 { 0x80020005 },
1657 { 0x80020005 },
1658 { 0x80020005 },
1659 { 0x80020005 },
1660 { 0x80020005 },
1661 { 0x80020005 },
1662 { 0x80020005 },
1663 { 0x80020005 },
1664 { 0x80020005 },
1665 { 0x80020005 },
1666 { 0x80020005 },
1667 { 0x80020005 },
1668 { 0x80020005 },
1669 { 0x80020005 },
1670 { 0x80020005 },
1671 { 0x80020005 },
1672 { 0x80020005 },
1673 { 0x80020005 },
1674 { 0x80020005 },
1675 { 0x80020005 },
1676 { 0x80020005 },
1677 { 0x80020005 },
1678 { 0x80020005 },
1679 { 0x80020005 },
1680 { 0x80020005 },
1681 { 0x80020005 },
1682 { 0x80020005 },
1683 { 0x80020005 },
1684 { 0x80020005 },
1685 { 0x80020005 },
1686 { 0x80020005 },
1687 { 0x80020005 },
1688 { 0, 2 },
1689 { 0, 2 },
1690 { 0, 4 },
1691 { 0, 4 },
1694 START_TEST(vartest)
1696 HMODULE hdll;
1697 VARIANTARG va;
1698 VARIANTARG vb;
1699 VARIANTARG vc;
1700 VARIANTARG vd;
1701 VARIANTARG ve;
1703 HRESULT rc;
1704 LCID lcid;
1705 int theInt = 0;
1706 int* pInt = &theInt;
1707 VARIANT_BOOL b = 0;
1708 VARIANT_BOOL* pBool = &b;
1709 unsigned short uShort = 0;
1710 unsigned short* pUShort = &uShort;
1711 unsigned long uLong = 0;
1712 unsigned long* pULong = &uLong;
1713 CHAR theChar;
1714 CHAR* pChar = &theChar;
1715 BYTE byte;
1716 BYTE* pByte = &byte;
1717 short s = 0;
1718 short* pShort = &s;
1719 long Long = 0;
1720 long* pLong = &Long;
1721 float f = 0;
1722 float* pFloat = &f;
1723 double d = 0;
1724 double* pDouble = &d;
1726 BSTR bstr = NULL;
1727 int off, i = 0;
1728 OLECHAR* pOleChar[NB_OLE_STRINGS];
1730 for (i=0; i<NB_OLE_STRINGS;i++) {
1731 pOleChar[i]=AtoW(_pTestStrA[i]);
1733 lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT );
1735 /* Start testing the Low-Level API ( the coercions )
1737 hdll=LoadLibraryA("netapi32.dll");
1738 pVarI1FromBool=(void*)GetProcAddress(hdll,"VarI1FromBool");
1739 pVarI1FromDate=(void*)GetProcAddress(hdll,"VarI1FromDate");
1740 pVarI1FromI4=(void*)GetProcAddress(hdll,"VarI1FromI4");
1741 pVarI1FromR8=(void*)GetProcAddress(hdll,"VarI1FromR8");
1742 pVarI1FromStr=(void*)GetProcAddress(hdll,"VarI1FromStr");
1743 pVarI1FromUI1=(void*)GetProcAddress(hdll,"VarI1FromUI1");
1745 pVarI2FromUI2=(void*)GetProcAddress(hdll,"VarI2FromUI2");
1747 pVarUI2FromBool=(void*)GetProcAddress(hdll,"VarUI2FromBool");
1748 pVarUI2FromDate=(void*)GetProcAddress(hdll,"VarUI2FromDate");
1749 pVarUI2FromI2=(void*)GetProcAddress(hdll,"VarUI2FromI2");
1750 pVarUI2FromI4=(void*)GetProcAddress(hdll,"VarUI2FromI4");
1751 pVarUI2FromR8=(void*)GetProcAddress(hdll,"VarUI2FromR8");
1752 pVarUI2FromStr=(void*)GetProcAddress(hdll,"VarUI2FromStr");
1754 pVarUI4FromBool=(void*)GetProcAddress(hdll,"VarUI4FromBool");
1755 pVarUI4FromDate=(void*)GetProcAddress(hdll,"VarUI4FromDate");
1756 pVarUI4FromI2=(void*)GetProcAddress(hdll,"VarUI4FromI2");
1757 pVarUI4FromR8=(void*)GetProcAddress(hdll,"VarUI4FromR8");
1758 pVarUI4FromStr=(void*)GetProcAddress(hdll,"VarUI4FromStr");
1760 /* unsigned char from...
1762 trace( "======== Testing VarUI1FromXXX ========\n");
1764 #define XOK "should return S_OK"
1765 #define XOV "should return DISP_E_OVERFLOW"
1766 /* Crashes on Win95: VarUI1FromI2( 0, NULL ) */
1768 ok(VarUI1FromStr(NULL, lcid, 0, pByte) == DISP_E_TYPEMISMATCH,"should return DISP_E_TYPEMISMATCH");
1769 ok(S_OK == VarUI1FromI2( 0, pByte ), XOK);
1770 ok(*pByte == 0,"should give 0 byte value");
1772 ok(S_OK == VarUI1FromI2( 69, pByte ), XOK);
1773 ok(*pByte == 69,"should give 69 byte value");
1775 ok(S_OK == VarUI1FromI2( 70, pByte ), XOK);
1776 ok(*pByte == 70,"should give 70 byte value");
1778 ok(S_OK == VarUI1FromI2( 128, pByte ), XOK);
1779 ok(*pByte == 128,"should give 128 byte value");
1781 ok(S_OK == VarUI1FromI2( 255, pByte ), XOK);
1782 ok(*pByte == 255,"should give 255 byte value");
1784 ok(DISP_E_OVERFLOW == VarUI1FromI2( 256, pByte ), XOV);
1785 ok(DISP_E_OVERFLOW == VarUI1FromI2( 257, pByte ), XOV);
1787 ok(S_OK == VarUI1FromR8( 0.0, pByte ), XOK);
1788 ok(*pByte == 0,"0.0 float should be converted to 0");
1790 ok(S_OK == VarUI1FromR8( 69.33, pByte ), XOK);
1791 ok(*pByte == 0x45, "expected 69 (hex 0x45) as byte value");
1793 ok(S_OK == VarUI1FromR8( 69.66, pByte ), XOK);
1794 ok(*pByte == 0x46, "expected 70 (hex 0x46) as byte value");
1796 ok(DISP_E_OVERFLOW == VarUI1FromR8( -69.33, pByte ), XOV);
1797 ok(DISP_E_OVERFLOW == VarUI1FromR8( -69.66, pByte ), XOV);
1799 ok(S_OK == VarUI1FromR8( -0.5, pByte ), XOK);
1800 ok(*pByte == 0,"-0.5 should give return 0");
1802 ok(DISP_E_OVERFLOW == VarUI1FromR8( -0.51, pByte ), XOV);
1804 ok(S_OK == VarUI1FromR8( -0.49, pByte ), XOK);
1805 ok(*pByte == 0,"-0.49 should give return 0");
1807 ok(S_OK == VarUI1FromR8( 0.5, pByte ), XOK);
1808 ok(*pByte == 0,"0.5 should give return 0");
1810 ok(S_OK == VarUI1FromR8( 0.51, pByte ), XOK);
1811 ok(*pByte == 1,"0.51 should give return 1");
1813 ok(S_OK == VarUI1FromR8( 0.49, pByte ), XOK);
1814 ok(*pByte == 0,"0.49 should give return 0");
1816 ok(S_OK == VarUI1FromDate( 0.0, pByte ), XOK);
1817 ok(*pByte == 0,"0.0 date should give return 0");
1819 ok(S_OK == VarUI1FromDate( 69.33, pByte ), XOK);
1820 ok(*pByte == 0x45,"69.33 date should give return 0x45");
1822 ok(S_OK == VarUI1FromDate( 69.66, pByte ), XOK);
1823 ok(*pByte == 0x46,"69.66 date should give return 0x46");
1825 ok(DISP_E_OVERFLOW == VarUI1FromDate( -69.33, pByte ), XOV);
1827 ok(DISP_E_OVERFLOW == VarUI1FromDate( -69.66, pByte ), XOV);
1829 ok(S_OK == VarUI1FromBool( VARIANT_TRUE, pByte ), XOK);
1830 ok(*pByte == 0xff, "true should be converted to 0xff");
1832 ok(S_OK == VarUI1FromBool( VARIANT_FALSE, pByte ), XOK);
1833 ok(*pByte == 0, "false should be converted to 0");
1835 for (i = 0; i < NB_OLE_STRINGS; i++)
1837 *pByte= 42;
1838 rc=VarUI1FromStr( pOleChar[i], lcid, 0, pByte );
1839 ok(rc == strrets_U1[i].error,
1840 "VarUI1FromStr([%d]=\"%s\") rc=%lx instead of %lx",
1841 i,_pTestStrA[i],rc,strrets_U1[i].error);
1842 if (rc == 0 && strrets_U1[i].error == 0) {
1843 ok(*pByte == strrets_U1[i].retval,
1844 "VarUI1FromStr([%d]=\"%s\") got %02x instead of %02x",
1845 i,_pTestStrA[i],*pByte,strrets_U1[i].retval);
1849 /* unsigned short from ... */
1850 trace( "======== Testing VarUI2FromXXX ========\n");
1852 if (pVarUI2FromI2) {
1853 ok(DISP_E_OVERFLOW == pVarUI2FromI2( -1, pUShort ), XOV);
1854 ok(S_OK == pVarUI2FromI2( 0, NULL ), XOK);
1856 ok(S_OK == pVarUI2FromI2( 0, pUShort ), XOK);
1857 ok(*pUShort == 0,"0 should be 0");
1858 ok(S_OK == pVarUI2FromI2( 69, pUShort ), XOK);
1859 ok(*pUShort == 69,"69 should be 69");
1860 ok(S_OK == pVarUI2FromI2( 70, pUShort ), XOK);
1861 ok(*pUShort == 70,"70 should be 70");
1863 ok(S_OK == pVarUI2FromI2( 128, pUShort ), XOK);
1864 ok(*pUShort == 128,"128 should be 128");
1867 if (pVarUI2FromI4) {
1868 ok(S_OK == pVarUI2FromI4( 65535, pUShort ), XOK);
1869 ok(*pUShort == 65535,"65535 should be 65535");
1870 ok(DISP_E_OVERFLOW == pVarUI2FromI4( 65536, pUShort ), XOV);
1871 ok(DISP_E_OVERFLOW == pVarUI2FromI4( 65537, pUShort ), XOV);
1874 if (pVarUI2FromR8) {
1875 ok(S_OK == pVarUI2FromR8( 0.0, pUShort ), XOK);
1876 ok(*pUShort == 0,"0.0 should be 0");
1877 ok(S_OK == pVarUI2FromR8( 69.33, pUShort ), XOK);
1878 ok(*pUShort == 69,"69.33 should be 69");
1879 ok(S_OK == pVarUI2FromR8( 69.66, pUShort ), XOK);
1880 ok(*pUShort == 70,"69.66 should be 70");
1882 ok(DISP_E_OVERFLOW == pVarUI2FromR8( -69.33, pUShort ), XOV);
1883 ok(DISP_E_OVERFLOW == pVarUI2FromR8( -69.66, pUShort ), XOV);
1885 ok(S_OK == pVarUI2FromR8( -0.5, pUShort ), XOK);
1886 ok(*pUShort == 0, "-0.5 -> 0");
1887 ok(DISP_E_OVERFLOW == pVarUI2FromR8( -0.51, pUShort ), XOV);
1888 ok(S_OK == pVarUI2FromR8( -0.49, pUShort ), XOK);
1889 ok(*pUShort == 0, "-0.49 -> 0");
1891 ok(S_OK == pVarUI2FromR8( 0.5, pUShort ), XOK);
1892 ok(*pUShort == 0,"0.5 should be 0");
1893 ok(S_OK == pVarUI2FromR8( 0.51, pUShort ), XOK);
1894 ok(*pUShort == 1,"0.51 should be 1");
1895 ok(S_OK == pVarUI2FromR8( 0.49, pUShort ), XOK);
1896 ok(*pUShort == 0,"0.49 should be 0");
1899 if (pVarUI2FromDate) {
1900 ok(S_OK == pVarUI2FromDate( 0.0, pUShort ), XOK);
1901 ok(*pUShort == 0,"0.0 should be 0");
1902 ok(S_OK == pVarUI2FromDate( 69.33, pUShort ), XOK);
1903 ok(*pUShort == 69,"69.33 should be 69");
1904 ok(S_OK == pVarUI2FromDate( 69.66, pUShort ), XOK);
1905 ok(*pUShort == 70,"69.66 should be 70");
1906 ok(DISP_E_OVERFLOW == pVarUI2FromDate( -69.33, pUShort ), XOV);
1907 ok(DISP_E_OVERFLOW == pVarUI2FromDate( -69.66, pUShort ), XOV);
1910 if (pVarUI2FromBool) {
1911 ok(S_OK == pVarUI2FromBool( VARIANT_TRUE, pUShort ), XOK);
1912 ok(*pUShort == 65535,"TRUE should be 65535");
1913 ok(S_OK == pVarUI2FromBool( VARIANT_FALSE, pUShort ), XOK);
1914 ok(*pUShort == 0,"FALSE should be 0");
1917 if (pVarUI2FromStr) {
1918 ok(DISP_E_TYPEMISMATCH == pVarUI2FromStr( NULL, lcid, 0, pUShort ), "should return DISP_E_TYPEMISMATCH");
1920 for (i = 0; i < NB_OLE_STRINGS; i++)
1922 *pUShort=42;
1923 rc=pVarUI2FromStr( pOleChar[i], lcid, 0, pUShort );
1924 ok(rc == strrets_U2[i].error,
1925 "VarUI2FromStr([%d]=\"%s\") rc=%lx instead of %lx",
1926 i,_pTestStrA[i],rc,strrets_U2[i].error);
1927 if (rc == 0 && strrets_U2[i].error == 0) {
1928 ok(*pUShort == strrets_U2[i].retval,
1929 "VarUI2FromStr([%d]=\"%s\") got %u instead of %u",
1930 i,_pTestStrA[i],*pUShort,strrets_U2[i].retval);
1935 /* unsigned long from ...
1937 trace( "======== Testing VarUI4FromXXX ========\n");
1939 if (pVarUI4FromI2) {
1940 ok(S_OK == pVarUI4FromI2( 0, NULL ), XOK);
1942 ok(S_OK == pVarUI4FromI2( 0, pULong ), XOK);
1943 ok(*pULong == 0,"0 should be 0");
1944 ok(S_OK == pVarUI4FromI2( 69, pULong ), XOK);
1945 ok(*pULong == 69,"69 should be 69");
1947 ok(S_OK == pVarUI4FromI2( 70, pULong ), XOK);
1948 ok(*pULong == 70,"70 should be 70");
1950 ok(S_OK == pVarUI4FromI2( 128, pULong ), XOK);
1951 ok(*pULong == 128,"128 should be 128");
1952 ok(S_OK == pVarUI4FromI2( 255, pULong ), XOK);
1953 ok(*pULong == 255,"255 should be 255");
1956 if (pVarUI4FromR8) {
1957 ok(S_OK == pVarUI4FromR8( 4294967295.0, pULong ), XOK);
1958 ok(*pULong == 4294967295U,"4294967295.0 should be 4294967295");
1959 ok(DISP_E_OVERFLOW == pVarUI4FromR8( 4294967296.0, pULong ), XOV);
1961 ok(S_OK == pVarUI4FromR8( 0.0, pULong ), XOK);
1962 ok(*pULong == 0,"0 should be 0");
1963 ok(S_OK == pVarUI4FromR8( 69.33, pULong ), XOK);
1964 ok(*pULong == 69,"69.33 should be 69");
1965 ok(S_OK == pVarUI4FromR8( 69.66, pULong ), XOK);
1966 ok(*pULong == 70,"69.66 should be 70");
1967 ok(DISP_E_OVERFLOW == pVarUI4FromR8( -69.33, pULong ), XOV);
1968 ok(DISP_E_OVERFLOW == pVarUI4FromR8( -69.66, pULong ), XOV);
1970 ok(S_OK == pVarUI4FromR8( -0.5, pULong ), XOK);
1971 ok(*pULong == 0,"-0.5 should be 0");
1973 ok(DISP_E_OVERFLOW == pVarUI4FromR8( -0.51, pULong ), XOV);
1975 ok(S_OK == pVarUI4FromR8( -0.49, pULong ), XOK);
1976 ok(*pULong == 0,"-0.49 should be 0");
1978 ok(S_OK == pVarUI4FromR8( 0.5, pULong ), XOK);
1979 ok(*pULong == 0,"0.5 should be 0");
1980 ok(S_OK == pVarUI4FromR8( 0.51, pULong ), XOK);
1981 ok(*pULong == 1,"0.51 should be 1");
1982 ok(S_OK == pVarUI4FromR8( 0.49, pULong ), XOK);
1983 ok(*pULong == 0,"0.49 should be 0");
1986 if (pVarUI4FromDate) {
1987 ok(S_OK == pVarUI4FromDate( 0.0, pULong ), XOK);
1988 ok(*pULong == 0,"0.0 should be 0");
1989 ok(S_OK == pVarUI4FromDate( 69.33, pULong ), XOK);
1990 ok(*pULong == 69,"69.33 should be 69");
1991 ok(S_OK == pVarUI4FromDate( 69.66, pULong ), XOK);
1992 ok(*pULong == 70,"69.66 should be 70");
1993 ok(DISP_E_OVERFLOW == pVarUI4FromDate( -69.33, pULong ), XOV);
1994 ok(DISP_E_OVERFLOW == pVarUI4FromDate( -69.66, pULong ), XOV);
1997 if (pVarUI4FromBool) {
1998 ok(S_OK == pVarUI4FromBool( VARIANT_TRUE, pULong ), XOK);
1999 ok(*pULong == 4294967295U, "TRUE should be 4294967295");
2000 ok(S_OK == pVarUI4FromBool( VARIANT_FALSE, pULong ), XOK);
2001 ok(*pULong == 0, "FALSE should be 0");
2004 if (pVarUI4FromStr) {
2005 ok(DISP_E_TYPEMISMATCH == pVarUI4FromStr( NULL, lcid, 0, pULong ), "should erturn DISP_E_TYPEMISMATCH");
2006 for (i = 0; i < NB_OLE_STRINGS; i++)
2008 *pULong=42;
2009 rc=pVarUI4FromStr( pOleChar[i], lcid, 0, pULong );
2010 ok(rc == strrets_U4[i].error,
2011 "VarUI4FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2012 i,_pTestStrA[i],rc,strrets_U4[i].error);
2013 if (rc == 0 && strrets_U4[i].error == 0) {
2014 ok(*pULong == strrets_U4[i].retval,
2015 "VarUI4FromStr([%d]=\"%s\") got %lu instead of %lu",
2016 i,_pTestStrA[i],*pULong,strrets_U4[i].retval);
2021 /* CHAR from ...
2023 trace( "======== Testing VarI1FromXXX ========\n");
2025 if (pVarI1FromBool) {
2026 ok(S_OK == pVarI1FromBool( VARIANT_TRUE, pByte ), XOK);
2027 ok(*pByte == 0xff,"true should be 0xff");
2029 ok(S_OK == pVarI1FromBool( VARIANT_TRUE, pChar ), XOK);
2030 ok(*pChar == -1, "TRUE should be -1");
2032 ok(S_OK == pVarI1FromBool( VARIANT_FALSE, pChar ), XOK);
2033 ok(*pChar == 0, "FALSE should be 0");
2036 if (pVarI1FromUI1) {
2037 ok(DISP_E_OVERFLOW == pVarI1FromUI1( (unsigned char)32767, pChar ), XOV);
2038 ok(*pChar == 0, "should still be 0");
2039 ok(DISP_E_OVERFLOW == pVarI1FromUI1( (unsigned char)65535, pChar ), XOV);
2040 ok(*pChar == 0, "should still be 0");
2043 if (pVarI1FromI4) {
2044 ok(DISP_E_OVERFLOW == pVarI1FromI4( 32767, pChar ), XOV);
2045 ok(*pChar == 0, "should still be 0");
2046 ok(DISP_E_OVERFLOW == pVarI1FromI4( 32768, pChar ), XOV);
2047 ok(*pChar == 0, "should still be 0");
2048 ok(DISP_E_OVERFLOW == pVarI1FromI4( -32768, pChar ), XOV);
2049 ok(*pChar == 0, "should still be 0");
2050 ok(DISP_E_OVERFLOW == pVarI1FromI4( -32769, pChar ), XOV);
2051 ok(*pChar == 0, "should still be 0");
2054 if (pVarI1FromR8) {
2055 ok(S_OK == pVarI1FromR8( 69.33, pChar ), XOK);
2056 ok(*pChar == 69, "69.33 should be 69");
2057 ok(S_OK == pVarI1FromR8( 69.66, pChar ), XOK);
2058 ok(*pChar == 70, "69.66 should be 70");
2060 ok(S_OK == pVarI1FromR8( -69.33, pChar ), XOK);
2061 ok(*pChar == -69, "-69.33 should be -69");
2062 ok(S_OK == pVarI1FromR8( -69.66, pChar ), XOK);
2063 ok(*pChar == -70, "-69.66 should be -70");
2066 if (pVarI1FromDate) {
2067 ok(S_OK == pVarI1FromDate( -69.66, pChar ), XOK);
2068 ok(*pChar == -70, "-69.66 should be -70");
2071 if (pVarI1FromStr) {
2072 for (i = 0; i < NB_OLE_STRINGS; i++)
2074 *pChar=42;
2075 rc=pVarI1FromStr( pOleChar[i], lcid, 0, pChar );
2076 ok(rc == strrets_I1[i].error,
2077 "VarI1FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2078 i,_pTestStrA[i],rc,strrets_I1[i].error);
2079 if (rc == 0 && strrets_I1[i].error == 0) {
2080 ok(*pChar == strrets_I1[i].retval,
2081 "VarI1FromStr([%d]=\"%s\") got %d instead of %d",
2082 i,_pTestStrA[i],*pChar,strrets_I1[i].retval);
2087 /* short from ...
2089 trace( "======== Testing VarI2FromXXX ========\n");
2091 if (pVarI2FromUI2) {
2092 ok(S_OK == pVarI2FromUI2( 32767, pShort ), XOK);
2093 ok(*pShort == 32767, "should be 32767");
2094 ok(DISP_E_OVERFLOW == pVarI2FromUI2( 65535, pShort ), XOV);
2095 ok(*pShort == 32767, "pShort should be unchanged");
2098 ok(S_OK == VarI2FromI4( 32767, pShort ), XOK);
2099 ok(*pShort == 32767, "should be 32767");
2100 ok(DISP_E_OVERFLOW == VarI2FromI4( 32768, pShort ), XOV);
2101 ok(*pShort == 32767, "should still be 32767");
2102 ok(S_OK == VarI2FromI4( -32768, pShort ), XOK);
2103 ok(*pShort == -32768, "should be -32768");
2104 ok(DISP_E_OVERFLOW == VarI2FromI4( -32769, pShort ), XOV);
2105 ok(*pShort == -32768, "should still be -32768");
2107 ok(S_OK == VarI2FromR8( 69.33, pShort ), XOK);
2108 ok(*pShort == 69, "should be 69");
2109 ok(S_OK == VarI2FromR8( 69.66, pShort ), XOK);
2110 ok(*pShort == 70, "should be 70");
2111 ok(S_OK == VarI2FromR8( -69.33, pShort ), XOK);
2112 ok(*pShort == -69, "should be -69");
2113 ok(S_OK == VarI2FromR8( -69.66, pShort ), XOK);
2114 ok(*pShort == -70, "should be -70");
2115 ok(S_OK == VarI2FromDate( -69.66, pShort ), XOK);
2116 ok(*pShort == -70, "should be -70");
2118 for (i = 0; i < NB_OLE_STRINGS; i++)
2120 *pShort=42;
2121 rc=VarI2FromStr( pOleChar[i], lcid, 0, pShort );
2122 ok(rc == strrets_I2[i].error,
2123 "VarI2FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2124 i,_pTestStrA[i],rc,strrets_I2[i].error);
2125 if (rc == 0 && strrets_I2[i].error == 0) {
2126 ok(*pShort == strrets_I2[i].retval,
2127 "VarI2FromStr([%d]=\"%s\") got %d instead of %d",
2128 i,_pTestStrA[i],*pShort,strrets_I2[i].retval);
2132 /* long from ...
2134 trace( "======== Testing VarI4FromXXX ========\n");
2136 ok(S_OK == VarI4FromI2( 3, (long*)pInt ), XOK);
2137 ok(*pInt == 3,"should be 3");
2139 ok(S_OK == VarI4FromR8( 69.33, pLong ), XOK);
2140 ok(*pLong == 69,"should be 69");
2141 ok(S_OK == VarI4FromR8( 69.66, pLong ), XOK);
2142 ok(*pLong == 70,"should be 70");
2143 ok(S_OK == VarI4FromR8( -69.33, pLong ), XOK);
2144 ok(*pLong == -69,"should be -69");
2145 ok(S_OK == VarI4FromR8( -69.66, pLong ), XOK);
2146 ok(*pLong == -70,"should be -70");
2148 ok(S_OK == VarI4FromR8( 2147483647.0, pLong ), XOK);
2149 ok(*pLong == 2147483647,"should be 2147483647");
2150 ok(DISP_E_OVERFLOW == VarI4FromR8( 2147483648.0, pLong ), XOV);
2151 ok(*pLong == 2147483647,"should still be 2147483647");
2153 ok(S_OK == VarI4FromR8( -2147483647.0, pLong ), XOK);
2154 ok(*pLong == -2147483647,"should be -2147483647");
2155 ok(S_OK == VarI4FromR8( -2147483648.0, pLong ), XOK);
2156 ok(*pLong == 0x80000000L,"should be -2147483648");
2157 ok(DISP_E_OVERFLOW == VarI4FromR8( -2147483649.0, pLong ), XOV);
2158 ok(*pLong == 0x80000000L,"should still be -2147483648");
2159 ok(DISP_E_OVERFLOW == VarI4FromDate( -2147483649.0, pLong ), XOV);
2160 ok(*pLong == 0x80000000L,"should still be -2147483648");
2162 for (i = 0; i < NB_OLE_STRINGS; i++)
2164 *pLong=42;
2165 rc=VarI4FromStr( pOleChar[i], lcid, 0, pLong );
2166 ok(rc == strrets_I4[i].error,
2167 "VarI4FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2168 i,_pTestStrA[i],rc,strrets_I4[i].error);
2169 if (rc == 0 && strrets_I4[i].error == 0) {
2170 ok(*pLong == strrets_I4[i].retval,
2171 "VarI4FromStr([%d]=\"%s\") got %ld instead of %ld",
2172 i,_pTestStrA[i],*pLong,strrets_I4[i].retval);
2176 /* float from ...
2178 trace( "======== Testing VarR4FromXXX ========\n");
2180 ok(S_OK == VarR4FromI4( 16777216, pFloat ), XOK);
2181 ok(16777216.0 == *pFloat,"should be 16777216.0");
2183 ok(S_OK == VarR4FromI4( 16777217, pFloat ), XOK);
2184 ok(16777216.0 == *pFloat,"should be 16777216.0");
2185 ok(S_OK == VarR4FromI4( -16777216, pFloat ), XOK);
2186 ok(-16777216.0 == *pFloat,"should be -16777216.0");
2187 ok(S_OK == VarR4FromI4( -16777217, pFloat ), XOK);
2188 ok(-16777216.0 == *pFloat,"should be -16777216.0");
2190 ok(S_OK == VarR4FromR8( 16777216.0, pFloat ), XOK);
2191 ok(16777216.0 == *pFloat,"should be 16777216.0");
2192 ok(S_OK == VarR4FromR8( 16777217.0, pFloat ), XOK);
2193 ok(16777216.0 == *pFloat,"should be 16777216.0");
2194 ok(S_OK == VarR4FromR8( -16777216.0, pFloat ), XOK);
2195 ok(-16777216.0 == *pFloat,"should be -16777216.0");
2196 ok(S_OK == VarR4FromR8( -16777217.0, pFloat ), XOK);
2197 ok(-16777216.0 == *pFloat,"should be -16777216.0");
2199 ok(S_OK == VarR4FromR8( 16777218e31, pFloat ), XOK);
2200 ok(*pFloat == 167772177736353110000000000000000000000.000000,
2201 "should be 167772177736353110000000000000000000000.000000");
2202 ok(DISP_E_OVERFLOW == VarR4FromR8( 16777218e32, pFloat ), XOV);
2203 ok(*pFloat == 167772177736353110000000000000000000000.000000,
2204 "should still be 167772177736353110000000000000000000000.000000");
2205 ok(S_OK == VarR4FromDate( 16777218e31, pFloat ), XOK);
2206 ok(*pFloat == 167772177736353110000000000000000000000.000000,
2207 "should be 167772177736353110000000000000000000000.000000");
2209 for (i = 0; i < NB_OLE_STRINGS; i++)
2211 *pFloat=42.0;
2212 rc=VarR4FromStr( pOleChar[i], lcid, 0, pFloat );
2213 ok(rc == strrets_R4[i].error,
2214 "VarR4FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2215 i,_pTestStrA[i],rc,strrets_R4[i].error);
2216 if (rc == 0 && strrets_R4[i].error == 0) {
2217 ok(*pFloat == strrets_R4[i].retval,
2218 "VarR4FromStr([%d]=\"%s\") got %f instead of %f",
2219 i,_pTestStrA[i],*pFloat,strrets_R4[i].retval);
2223 /* double from ...
2225 trace( "======== Testing VarR8FromXXX ========\n");
2227 ok(S_OK == VarR8FromDate( 900719925474099.0, pDouble ), XOK);
2228 ok(*pDouble == 900719925474099.000000,"should be 900719925474099.000000\n");
2229 for (i = 0; i < NB_OLE_STRINGS; i++)
2231 *pDouble=42.0;
2232 rc=VarR8FromStr( pOleChar[i], lcid, 0, pDouble );
2233 ok(rc == strrets_R8[i].error,
2234 "VarR8FromStr([%d]=\"%s\") rc=%lx instead of %lx",
2235 i,_pTestStrA[i],rc,strrets_R8[i].error);
2236 if (rc == 0 && strrets_R8[i].error == 0) {
2237 ok(*pDouble == strrets_R8[i].retval,
2238 "VarR8FromStr([%d]=\"%s\") got %.15f instead of %.15f",
2239 i,_pTestStrA[i],*pDouble,strrets_R8[i].retval);
2243 /* date from ...
2245 trace( "======== Testing VarDateFromXXX ========\n");
2247 ok(S_OK == VarDateFromI4( 2958465, pDouble ), XOK);
2248 ok(*pDouble == 2958465.000000,"should be 2958465.000000");
2249 rc=VarDateFromI4( 2958466, pDouble );
2250 ok(rc==DISP_E_OVERFLOW || rc==DISP_E_TYPEMISMATCH /* Win95 */,
2251 "got %lx",rc);
2252 ok(*pDouble == 2958465.000000,"should still be 2958465.000000");
2253 ok(S_OK == VarDateFromI4( -657434, pDouble ), XOK);
2254 ok(*pDouble == -657434.000000,"should be -657434.000000");
2255 rc=VarDateFromI4( -657435, pDouble );
2256 ok(rc==DISP_E_OVERFLOW || rc==DISP_E_TYPEMISMATCH /* Win95 */,
2257 "got %lx",rc);
2258 ok(*pDouble == -657434.000000,"should still be -657434.000000");
2260 ok(S_OK == VarDateFromR8( 2958465.9999, pDouble ), XOK);
2261 ok(*pDouble == 2958465.999900, "should be 2958465.999900");
2262 rc=VarDateFromR8( 2958466, pDouble );
2263 ok(rc==DISP_E_OVERFLOW || rc==DISP_E_TYPEMISMATCH /* Win95 */,
2264 "got %lx",rc);
2265 ok(*pDouble == 2958465.999900, "should still be 2958465.999900");
2266 ok(S_OK == VarDateFromR8( -657434.9999, pDouble ), XOK);
2267 ok(*pDouble == -657434.999900,"should be -657434.999900");
2268 rc=VarDateFromR8( -657435, pDouble );
2269 ok(rc==DISP_E_OVERFLOW || rc==DISP_E_TYPEMISMATCH /* Win95 */,
2270 "got %lx",rc);
2271 ok(*pDouble == -657434.999900,"should still be -657434.999900");
2273 ok(S_OK == VarDateFromR8( 0.0, pDouble ), XOK);
2274 ok(*pDouble == 0.0,"0.0 should be 0.0");
2275 ok(S_OK == VarDateFromR8( 1.0, pDouble ), XOK);
2276 ok(*pDouble == 1.0,"1.0 should be 1.0");
2277 ok(S_OK == VarDateFromR8( 2.25, pDouble ), XOK);
2278 ok(*pDouble == 2.25,"2.25 should be 2.25");
2279 ok(S_OK == VarDateFromR8( -2.0, pDouble ), XOK);
2280 ok(*pDouble == -2.0,"-2.0 should be -2.0");
2282 /* Need some parsing function in Linux to emulate this...
2283 * Still in progess.
2285 for (i = 0; i < NB_OLE_STRINGS; i++)
2287 *pDouble=42.0;
2288 rc=VarDateFromStr( pOleChar[i], lcid, 0, pDouble );
2289 if (strrets_DATE[i].todo_rc) {
2290 todo_wine {
2291 ok(rc == strrets_DATE[i].error,
2292 "VarDateFromStr([%d]=\"%s\") rc= %lx instead of %lx",
2293 i,_pTestStrA[i],rc,strrets_DATE[i].error);
2295 } else {
2296 ok(rc == strrets_DATE[i].error,
2297 "VarDateFromStr([%d]=\"%s\") rc= %lx instead of %lx",
2298 i,_pTestStrA[i],rc,strrets_DATE[i].error);
2300 if (rc == 0 && strrets_DATE[i].error == 0) {
2301 if (strrets_DATE[i].todo_rc || strrets_DATE[i].todo_val) {
2302 todo_wine {
2303 ok(EQ_DOUBLE(*pDouble,strrets_DATE[i].retval),
2304 "VarDateFromStr([%d]=\"%s\") got %.15f instead of %.15f",
2305 i,_pTestStrA[i],*pDouble,strrets_DATE[i].retval);
2307 } else {
2308 ok(EQ_DOUBLE(*pDouble,strrets_DATE[i].retval),
2309 "VarDateFromStr([%d]=\"%s\") got %.15f instead of %.15f",
2310 i,_pTestStrA[i],*pDouble,strrets_DATE[i].retval);
2314 /* bool from ...
2316 trace( "======== Testing VarBoolFromXXX ========\n");
2318 ok(S_OK == VarBoolFromI4( 0, pBool ), XOK);
2319 ok(VARIANT_FALSE == *pBool, "expected FALSE");
2320 ok(S_OK == VarBoolFromI4( 1, pBool ), XOK);
2321 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2322 ok(S_OK == VarBoolFromI4( -1, pBool ), XOK);
2323 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2324 ok(S_OK == VarBoolFromI4( 2, pBool ), XOK);
2325 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2327 ok(S_OK == VarBoolFromUI1( ' ', pBool ), XOK);
2328 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2329 ok(S_OK == VarBoolFromUI1( '\0', pBool ), XOK);
2330 ok(VARIANT_FALSE == *pBool, "expected FALSE");
2331 ok(S_OK == VarBoolFromUI1( 0x0000, pBool ), XOK);
2332 ok(VARIANT_FALSE == *pBool, "expected FALSE");
2333 ok(S_OK == VarBoolFromUI1( (unsigned char)0xFFF, pBool ), XOK);
2334 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2335 ok(S_OK == VarBoolFromUI1( (unsigned char)0xFFFF, pBool ), XOK);
2336 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2338 ok(S_OK == VarBoolFromR8( 0.0, pBool ), XOK);
2339 ok(VARIANT_FALSE == *pBool, "expected FALSE");
2340 ok(S_OK == VarBoolFromR8( 1.1, pBool ), XOK);
2341 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2342 ok(S_OK == VarBoolFromR8( 0.5, pBool ), XOK);
2343 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2344 ok(S_OK == VarBoolFromR8( 0.49, pBool ), XOK);
2345 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2346 ok(S_OK == VarBoolFromR8( 0.51, pBool ), XOK);
2347 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2348 ok(S_OK == VarBoolFromR8( -0.5, pBool ), XOK);
2349 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2350 ok(S_OK == VarBoolFromR8( -0.49, pBool ), XOK);
2351 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2352 ok(S_OK == VarBoolFromR8( -0.51, pBool ), XOK);
2353 ok(VARIANT_TRUE == *pBool, "expected TRUE");
2356 for (i = 0; i < NB_OLE_STRINGS; i++)
2358 *pBool=42;
2359 rc=VarBoolFromStr( pOleChar[i], lcid, 0, pBool );
2360 ok(rc == strrets_B[i].error,
2361 "VarBoolFromStr([%d]=\"%s\") rc=%lx instead of %lx",
2362 i,_pTestStrA[i],rc,strrets_B[i].error);
2363 if (rc == 0 && strrets_B[i].error == 0) {
2364 ok(*pBool == strrets_B[i].retval,
2365 "VarBoolFromStr([%d]=\"%s\") got %x instead of %x",
2366 i,_pTestStrA[i],*pBool,strrets_B[i].retval);
2370 /* BSTR from ...
2372 trace( "======== Testing VarBSTRFromXXX ========\n");
2374 /* integers...
2376 if (pVarBstrFromI1) {
2377 ok(S_OK == pVarBstrFromI1( -100, 0, 0, &bstr ), XOK);
2378 ok(!strcmp(WtoA(bstr),"\"-100\""),"should be string -100");
2381 ok(S_OK == VarBstrFromUI1( 0x5A, 0, 0, &bstr ), XOK);
2382 ok(!strcmp(WtoA(bstr),"\"90\""),"should be string 90");
2383 ok(S_OK == VarBstrFromI4( 2958465, 0, 0, &bstr ), XOK);
2384 ok(!strcmp(WtoA(bstr),"\"2958465\""),"should be string 2958465");
2386 /* reals...
2388 off = 0;
2389 d=0;
2390 for( i=0; i<20; i++ )
2392 char xval[80];
2393 /* add an integer to the real number
2395 d += ((i%9)+1) * pow( 10, i );
2397 ok(S_OK == VarBstrFromR8( d, lcid, 0, &bstr ), XOK);
2398 sprintf(xval,"\"%s\"",strfromr8[off]);
2399 ok(!strcmp(xval,WtoA(bstr)),
2400 "d is %.15f, should be cvt. to %s, but return val is %s",
2401 d,strfromr8[off],WtoA(bstr));
2402 off++;
2404 ok(S_OK == VarBstrFromR8( -d, lcid, 0, &bstr ), XOK);
2405 sprintf(xval,"\"%s\"",strfromr8[off]);
2406 ok(!strcmp(xval,WtoA(bstr)),
2407 "d is %.15f, should be cvt. to %s, but return val is %s",
2408 -d,strfromr8[off],WtoA(bstr));
2409 off++;
2411 d=0;
2412 for( i=0; i<20; i++ )
2414 char xval[80];
2415 /* add a decimal to the real number
2417 d += ((i%9)+1) * pow( 10, (i*-1) );
2418 ok(S_OK == VarBstrFromR8( d, lcid, 0, &bstr ), XOK);
2419 sprintf(xval,"\"%s\"",strfromr8[off]);
2420 ok(!strcmp(xval,WtoA(bstr)),
2421 "d is %.15f, should be cvt. to %s, but return val is %s",
2422 d,strfromr8[off],WtoA(bstr));
2423 off++;
2424 ok(S_OK == VarBstrFromR8( d-1, lcid, 0, &bstr ), XOK);
2425 sprintf(xval,"\"%s\"",strfromr8[off]);
2426 ok(!strcmp(xval,WtoA(bstr)),
2427 "d is %.15f, should be cvt. to %s, but return val is %s",
2428 d-1,strfromr8[off],WtoA(bstr));
2429 off++;
2430 ok(S_OK == VarBstrFromR8( -d, lcid, 0, &bstr ), XOK);
2431 sprintf(xval,"\"%s\"",strfromr8[off]);
2432 ok(!strcmp(xval,WtoA(bstr)),
2433 "d is %.15f, should be cvt. to %s, but return val is %s",
2434 -d,strfromr8[off],WtoA(bstr));
2435 off++;
2438 d=0;
2439 for( i=0; i<20; i++ )
2441 char xval[80];
2442 /* add an integer to the real number
2444 d += ((i%9)+1) * pow( 10, i );
2445 /* add a decimal to the real number
2447 d += ((i%9)+1) * pow( 10, (i*-1) );
2448 ok(S_OK == VarBstrFromR8( d, lcid, 0, &bstr ), XOK);
2449 sprintf(xval,"\"%s\"",strfromr8[off]);
2450 ok(!strcmp(xval,WtoA(bstr)),
2451 "d is %.15f, should be cvt. to %s, but return val is %s",
2452 d,strfromr8[off],WtoA(bstr));
2453 off++;
2454 ok(S_OK == VarBstrFromR8( -d, lcid, 0, &bstr ), XOK);
2455 sprintf(xval,"\"%s\"",strfromr8[off]);
2456 ok(!strcmp(xval,WtoA(bstr)),
2457 "d is %.15f, should be cvt. to %s, but return val is %s",
2458 -d,strfromr8[off],WtoA(bstr));
2459 off++;
2462 d=0;
2463 for( i=0; i<10; i++ )
2465 char xval[80];
2466 /* add an integer to the real number
2468 d += ((i%9)+1) * pow( 10, i );
2469 ok(S_OK == VarBstrFromR4( (float)d, lcid, 0, &bstr ), XOK);
2470 sprintf(xval,"\"%s\"",strfromr8[off]);
2471 ok(!strcmp(xval,WtoA(bstr)),
2472 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2473 i,d,strfromr8[off],WtoA(bstr));
2474 off++;
2475 ok(S_OK == VarBstrFromR4( (float)-d, lcid, 0, &bstr ), XOK);
2476 sprintf(xval,"\"%s\"",strfromr8[off]);
2477 ok(!strcmp(xval,WtoA(bstr)),
2478 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2479 i,-d,strfromr8[off],WtoA(bstr));
2480 off++;
2482 d=0;
2483 for( i=0; i<10; i++ )
2485 char xval[80];
2486 /* add a decimal to the real number
2488 d += ((i%9)+1) * pow( 10, (i*-1) );
2489 ok(S_OK == VarBstrFromR4( (float)d, lcid, 0, &bstr ), XOK);
2490 sprintf(xval,"\"%s\"",strfromr8[off]);
2491 ok(!strcmp(xval,WtoA(bstr)),
2492 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2493 i,d,strfromr8[off],WtoA(bstr));
2494 off++;
2495 ok(S_OK == VarBstrFromR4( (float)(d-1), lcid, 0, &bstr ), XOK);
2496 sprintf(xval,"\"%s\"",strfromr8[off]);
2497 ok(!strcmp(xval,WtoA(bstr)),
2498 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2499 i,d-1,strfromr8[off],WtoA(bstr));
2500 off++;
2501 ok(S_OK == VarBstrFromR4( (float)-d, lcid, 0, &bstr ), XOK);
2502 sprintf(xval,"\"%s\"",strfromr8[off]);
2503 ok(!strcmp(xval,WtoA(bstr)),
2504 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2505 i,-d,strfromr8[off],WtoA(bstr));
2506 off++;
2509 d=0;
2510 for( i=0; i<10; i++ )
2512 static int istodo[10]={0,0,0,0,0,1,0,0,0,0};
2513 char xval[80];
2514 /* add an integer to the real number
2516 d += ((i%9)+1) * pow( 10, i );
2517 /* add a decimal to the real number
2519 d += ((i%9)+1) * pow( 10, (i*-1) );
2520 ok(S_OK == VarBstrFromR4( (float)d, lcid, 0, &bstr ), XOK);
2521 sprintf(xval,"\"%s\"",strfromr8[off]);
2522 if (istodo[i]) {
2523 todo_wine {
2524 ok(!strcmp(xval,WtoA(bstr)),
2525 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2526 i,d,strfromr8[off],WtoA(bstr));
2528 } else {
2529 ok(!strcmp(xval,WtoA(bstr)),
2530 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2531 i,d,strfromr8[off],WtoA(bstr));
2533 off++;
2534 ok(S_OK == VarBstrFromR4( (float)-d, lcid, 0, &bstr ), XOK);
2535 sprintf(xval,"\"%s\"",strfromr8[off]);
2536 if (istodo[i]) {
2537 todo_wine {
2538 ok(!strcmp(xval,WtoA(bstr)),
2539 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2540 i,-d,strfromr8[off],WtoA(bstr));
2542 } else {
2543 ok(!strcmp(xval,WtoA(bstr)),
2544 "%d: d is %.8f, should be cvt. to %s, but return val is %s",
2545 i,-d,strfromr8[off],WtoA(bstr));
2547 off++;
2550 ok(S_OK == VarBstrFromBool( 0x00, lcid, 0, &bstr ), XOK);
2551 ok(!strcmp(WtoA(bstr),"\"False\""),"should be 'False'");
2552 ok(S_OK == VarBstrFromBool( 0xFF, lcid, 0, &bstr ), XOK);
2553 ok(!strcmp(WtoA(bstr),"\"True\""),"should be 'True'");
2555 ok(S_OK == VarBstrFromDate( 0.0, lcid, 0, &bstr ), XOK);
2556 todo_wine {
2557 ok(!strcmp(WtoA(bstr),"\"12:00:00 AM\""),
2558 "should be '12:00:00 AM', but is %s\n",WtoA(bstr));
2561 ok(S_OK == VarBstrFromDate( 3.34, lcid, 0, &bstr ), XOK);
2562 todo_wine {
2563 ok(strcmp(WtoA(bstr),"\"1/2/1900 8:09:36 AM\"")==0 ||
2564 strcmp(WtoA(bstr),"\"1/2/00 8:09:36 AM\"")==0 /* Win95 */,
2565 "should be '1/2/1900 8:09:36 AM', but is %s\n",WtoA(bstr));
2568 ok(S_OK == VarBstrFromDate( 3339.34, lcid, 0, &bstr ), XOK);
2569 todo_wine {
2570 ok(strcmp(WtoA(bstr),"\"2/20/1909 8:09:36 AM\"")==0 ||
2571 strcmp(WtoA(bstr),"\"2/20/09 8:09:36 AM\"")==0 /* Win95 */,
2572 "should be '2/20/1909 8:09:36 AM', but is %s\n",WtoA(bstr));
2575 ok(S_OK == VarBstrFromDate( 365.00, lcid, 0, &bstr ), XOK);
2576 todo_wine {
2577 ok(strcmp(WtoA(bstr),"\"12/30/1900\"")==0 ||
2578 strcmp(WtoA(bstr),"\"12/30/00\"")==0 /* Win95 */,
2579 "should be '12/30/1900', but is %s\n",WtoA(bstr));
2582 ok(S_OK == VarBstrFromDate( 365.25, lcid, 0, &bstr ), XOK);
2583 todo_wine {
2584 ok(strcmp(WtoA(bstr),"\"12/30/1900 6:00:00 AM\"")==0 ||
2585 strcmp(WtoA(bstr),"\"12/30/00 6:00:00 AM\"")==0 /* Win95 */,
2586 "should be '12/30/1900 6:00:00 AM', but is %s\n",WtoA(bstr));
2589 ok(S_OK == VarBstrFromDate( 1461.0, lcid, 0, &bstr ), XOK);
2590 todo_wine {
2591 ok(strcmp(WtoA(bstr),"\"12/31/1903\"")==0 ||
2592 strcmp(WtoA(bstr),"\"12/31/03\"")==0 /* Win95 */,
2593 "should be '12/31/1903', but is %s\n",WtoA(bstr));
2596 ok(S_OK == VarBstrFromDate( 1461.5, lcid, 0, &bstr ), XOK);
2597 todo_wine {
2598 ok(strcmp(WtoA(bstr),"\"12/31/1903 12:00:00 PM\"")==0 ||
2599 strcmp(WtoA(bstr),"\"12/31/03 12:00:00 PM\"")==0 /* Win95 */,
2600 "should be '12/31/1903 12:00:00 PM', but is %s\n",WtoA(bstr));
2603 /* Test variant API...
2605 trace( "======== Testing Hi-Level Variant API ========\n");
2607 bstr = SysAllocString( pOleChar[4] );
2609 VariantClear( &va );
2611 VariantInit( &va );
2612 VariantInit( &vb );
2613 VariantInit( &vc );
2614 VariantInit( &vd );
2615 VariantInit( &ve );
2617 V_VT(&va) = VT_BSTR;
2618 V_UNION(&va,bstrVal) = bstr;
2619 ok(S_OK == VariantClear( &va ), XOK);
2620 SysFreeString( bstr );
2621 SysFreeString( bstr );
2623 ok(S_OK == VariantCopy( &vb, &va ), XOK);
2624 ok(S_OK == VariantClear( &vb ), XOK);
2625 ok(S_OK == VariantClear( &va ), XOK);
2627 V_VT(&va) = VT_R8;
2628 d = 4.123;
2629 V_UNION(&va,dblVal) = d;
2630 ok(S_OK == VariantCopy( &va, &va ), XOK);
2631 ok(V_R8(&va) == 4.123,"should be 4.123");
2633 V_VT(&va) = VT_R8 | VT_BYREF;
2634 d = 31.123;
2635 V_UNION(&va,pdblVal) = &d;
2636 ok(S_OK == VariantCopyInd( &va, &va ), XOK);
2637 ok(V_R8(&va) == 31.123,"should be 31.123");
2639 V_VT(&va) = VT_R8;
2640 d = 1.123;
2641 V_UNION(&va,dblVal) = d;
2642 ok(S_OK == VariantCopy( &vb, &va ), XOK);
2643 ok(V_R8(&vb) == 1.123,"should be 1.123");
2645 V_VT(&va) = VT_R8 | VT_BYREF;
2646 d = 123.123;
2647 V_UNION(&va,pdblVal) = &d;
2648 ok(S_OK == VariantCopy( &vb, &va ), XOK);
2649 ok(*(V_R8REF(&vb)) == 123.123,"should be 123.123");
2651 V_VT(&va) = VT_R8 | VT_BYREF;
2652 d = 111.2;
2653 V_UNION(&va,pdblVal) = &d;
2654 ok(S_OK == VariantCopyInd( &vb, &va ), XOK);
2655 ok(V_R8(&vb) == 111.2,"should be 111.2");
2657 V_VT(&va) = VT_R8 | VT_BYREF;
2658 d = 1211.123453;
2659 V_UNION(&va,pdblVal) = &d;
2660 ok(S_OK == VariantChangeTypeEx( &va, &va, lcid, 0, VT_I2 ), XOK);
2661 ok(V_VT(&va) == VT_I2,"should be type VT_I2");
2663 V_VT(&va) = VT_I4;
2664 V_UNION(&va,intVal) = 4;
2665 ok(S_OK == VariantChangeTypeEx(&vb, &va, lcid, 0, VT_BSTR ), XOK);
2666 ok(!strcmp(WtoA(V_BSTR(&vb)),"\"4\""),"should be 4");
2668 V_VT(&va) = VT_DATE;
2669 V_UNION(&va,date) = 34465.332431;
2670 ok(S_OK == VariantChangeTypeEx(&vb, &va, lcid, 0, VT_BSTR ), XOK);
2671 todo_wine {
2672 ok(strcmp(WtoA(V_BSTR(&vb)),"\"5/11/1994 7:58:42 AM\"")==0 ||
2673 strcmp(WtoA(V_BSTR(&vb)),"\"5/11/94 7:58:42 AM\"")==0 /* Win95 */,
2674 "should be 5/11/94 7:58:42 AM got %s",WtoA(V_BSTR(&vb)));
2677 bstr = pOleChar[4];
2678 V_VT(&va) = VT_BSTR;
2679 V_UNION(&va,bstrVal) = bstr;
2680 ok(S_OK == VariantChangeTypeEx(&vb, &va, lcid, 0, VT_R8 ), XOK);
2681 ok(V_R8(&vb) == -0.490000,"should be -0.49");
2683 V_VT(&vc) = VT_BSTR | VT_BYREF;
2684 V_UNION(&vc,pbstrVal) = &bstr;
2685 V_VT(&vb) = VT_VARIANT | VT_BYREF;
2686 V_UNION(&vb,pvarVal) = &vc;
2687 V_VT(&va) = VT_VARIANT | VT_BYREF;
2688 V_UNION(&va,pvarVal) = &vb;
2689 ok(E_INVALIDARG == VariantCopyInd( &vd, &va ), "expect E_INVALIDARG");
2691 /* test what happens when bad vartypes are passed in */
2692 trace( "======== Testing different VARTYPES ========\n" );
2694 for( i=0; i<sizeof(vartypes)/sizeof(vartypes[0]); i++ )
2696 /* Trying to use variants that are set to be BSTR but
2697 * do not contain a valid pointer makes the program crash
2698 * in Windows so we will skip those. We do not need them
2699 * anyway to illustrate the behavior.
2701 V_VT(&va) = vartypes[i].ind;
2702 d = 4.123;
2703 V_UNION(&va,dblVal) = d;
2704 rc = VariantCopyInd( &vb, &va );
2705 if (vartypes[i].todoind1) {
2706 todo_wine {
2707 ok(vartypes[i].vcind1 == rc,
2708 "%d: vt %d, return value %lx, expected was %lx",
2709 i,vartypes[i].ind,rc,vartypes[i].vcind1);
2711 } else {
2712 ok(vartypes[i].vcind1 == rc,
2713 "%d: vt %d, return value %lx, expected was %lx",
2714 i,vartypes[i].ind,rc,vartypes[i].vcind1);
2716 V_VT(&va) = vartypes[i].ind | VT_BYREF;
2717 d = 4.123;
2718 V_UNION(&va,pdblVal) = &d;
2719 rc = VariantCopyInd( &vb, &va );
2720 if (vartypes[i].todoind2) {
2721 todo_wine {
2722 ok(vartypes[i].vcind2 == rc,
2723 "%d: vt %d, return value %lx, expected was %lx",
2724 i,vartypes[i].ind,rc,vartypes[i].vcind2);
2726 } else {
2727 ok(vartypes[i].vcind2 == rc,
2728 "%d: vt %d, return value %lx, expected was %lx",
2729 i,vartypes[i].ind,rc,vartypes[i].vcind2);
2731 V_VT(&va) = VT_R8;
2732 d = 4.123;
2733 V_UNION(&va,dblVal) = d;
2734 rc = VariantChangeTypeEx( &vb, &va, lcid, 0, (VARTYPE)i );
2735 if (vartypes[i].todowcex1) {
2736 todo_wine {
2737 ok(vartypes[i].vcex1 == rc || rc == DISP_E_BADVARTYPE,
2738 "%d: vt %d, return value %lx, expected was %lx",
2739 i,vartypes[i].ind,rc,vartypes[i].vcex1);
2741 } else {
2742 ok(vartypes[i].vcex1 == rc || rc == DISP_E_BADVARTYPE,
2743 "%d: vt %d, return value %lx, expected was %lx",
2744 i,vartypes[i].ind,rc,vartypes[i].vcex1);
2746 V_VT(&va) = VT_R8;
2747 d = 4.123;
2748 V_UNION(&va,dblVal) = d;
2749 rc = VariantChangeTypeEx( &vb, &va, lcid, 0, (VARTYPE)(i | VT_BYREF) );
2750 if (vartypes[i].todowcex2) {
2751 todo_wine {
2752 ok(vartypes[i].vcex2 == rc || rc == DISP_E_BADVARTYPE,
2753 "%d: vt %d, return value %lx, expected was %lx",
2754 i,vartypes[i].ind,rc,vartypes[i].vcex2);
2756 } else {
2757 ok(vartypes[i].vcex2 == rc || rc == DISP_E_BADVARTYPE,
2758 "%d: vt %d, return value %lx, expected was %lx",
2759 i,vartypes[i].ind,rc,vartypes[i].vcex2);
2762 V_VT(&va) = 99;
2763 d = 4.123;
2764 V_UNION(&va,dblVal) = d;
2765 ok(DISP_E_BADVARTYPE == VariantClear( &va ), "should give DISP_E_BADVARTYPE");
2767 VariantClear( &va );
2768 VariantClear( &vb );
2769 VariantClear( &vc );
2770 VariantClear( &vd );
2771 VariantClear( &ve );
2772 /* There is alot of memory leaks but this is simply a test program.