181683643f83fa14f61eb14745feeb99a25e1af2
[reactos.git] / rostests / winetests / shlwapi / clist.c
1 /* Unit test suite for SHLWAPI Compact List and IStream ordinal functions
2 *
3 * Copyright 2002 Jon Griffiths
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #define WIN32_NO_STATUS
21 #define _INC_WINDOWS
22 #define COM_NO_WINDOWS_H
23
24 //#include <stdarg.h>
25
26 #include <wine/test.h>
27 //#include "windef.h"
28 //#include "winbase.h"
29 #include <objbase.h>
30
31 typedef struct tagSHLWAPI_CLIST
32 {
33 ULONG ulSize;
34 ULONG ulId;
35 } SHLWAPI_CLIST, *LPSHLWAPI_CLIST;
36
37 typedef const SHLWAPI_CLIST* LPCSHLWAPI_CLIST;
38
39 /* Items to add */
40 static const SHLWAPI_CLIST SHLWAPI_CLIST_items[] =
41 {
42 {4, 1},
43 {8, 3},
44 {12, 2},
45 {16, 8},
46 {20, 9},
47 {3, 11},
48 {9, 82},
49 {33, 16},
50 {32, 55},
51 {24, 100},
52 {39, 116},
53 { 0, 0}
54 };
55
56 /* Dummy IStream object for testing calls */
57 typedef struct
58 {
59 void* lpVtbl;
60 LONG ref;
61 int readcalls;
62 BOOL failreadcall;
63 BOOL failreadsize;
64 BOOL readbeyondend;
65 BOOL readreturnlarge;
66 int writecalls;
67 BOOL failwritecall;
68 BOOL failwritesize;
69 int seekcalls;
70 int statcalls;
71 BOOL failstatcall;
72 LPCSHLWAPI_CLIST item;
73 ULARGE_INTEGER pos;
74 } _IDummyStream;
75
76 static
77 HRESULT WINAPI QueryInterface(_IDummyStream *This,REFIID riid, LPVOID *ppvObj)
78 {
79 return S_OK;
80 }
81
82 static ULONG WINAPI AddRef(_IDummyStream *This)
83 {
84 return InterlockedIncrement(&This->ref);
85 }
86
87 static ULONG WINAPI Release(_IDummyStream *This)
88 {
89 return InterlockedDecrement(&This->ref);
90 }
91
92 static HRESULT WINAPI Read(_IDummyStream* This, LPVOID lpMem, ULONG ulSize,
93 PULONG lpRead)
94 {
95 HRESULT hRet = S_OK;
96 ++This->readcalls;
97
98 if (This->failreadcall)
99 {
100 return STG_E_ACCESSDENIED;
101 }
102 else if (This->failreadsize)
103 {
104 *lpRead = ulSize + 8;
105 return S_OK;
106 }
107 else if (This->readreturnlarge)
108 {
109 *((ULONG*)lpMem) = 0xffff01;
110 *lpRead = ulSize;
111 This->readreturnlarge = FALSE;
112 return S_OK;
113 }
114 if (ulSize == sizeof(ULONG))
115 {
116 /* Read size of item */
117 *((ULONG*)lpMem) = This->item->ulSize ? This->item->ulSize + sizeof(SHLWAPI_CLIST) : 0;
118 *lpRead = ulSize;
119 }
120 else
121 {
122 unsigned int i;
123 char* buff = lpMem;
124
125 /* Read item data */
126 if (!This->item->ulSize)
127 {
128 This->readbeyondend = TRUE;
129 *lpRead = 0;
130 return E_FAIL; /* Should never happen */
131 }
132 *((ULONG*)lpMem) = This->item->ulId;
133 *lpRead = ulSize;
134
135 for (i = 0; i < This->item->ulSize; i++)
136 buff[4+i] = i*2;
137
138 This->item++;
139 }
140 return hRet;
141 }
142
143 static HRESULT WINAPI Write(_IDummyStream* This, LPVOID lpMem, ULONG ulSize,
144 PULONG lpWritten)
145 {
146 HRESULT hRet = S_OK;
147
148 ++This->writecalls;
149 if (This->failwritecall)
150 {
151 return STG_E_ACCESSDENIED;
152 }
153 else if (This->failwritesize)
154 {
155 *lpWritten = 0;
156 }
157 else
158 *lpWritten = ulSize;
159 return hRet;
160 }
161
162 static HRESULT WINAPI Seek(_IDummyStream* This, LARGE_INTEGER dlibMove,
163 DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
164 {
165 ++This->seekcalls;
166 This->pos.QuadPart = dlibMove.QuadPart;
167 if (plibNewPosition)
168 plibNewPosition->QuadPart = dlibMove.QuadPart;
169 return S_OK;
170 }
171
172 static HRESULT WINAPI Stat(_IDummyStream* This, STATSTG* pstatstg,
173 DWORD grfStatFlag)
174 {
175 ++This->statcalls;
176 if (This->failstatcall)
177 return E_FAIL;
178 if (pstatstg)
179 pstatstg->cbSize.QuadPart = This->pos.QuadPart;
180 return S_OK;
181 }
182
183 /* VTable */
184 static void* iclvt[] =
185 {
186 QueryInterface,
187 AddRef,
188 Release,
189 Read,
190 Write,
191 Seek,
192 NULL, /* SetSize */
193 NULL, /* CopyTo */
194 NULL, /* Commit */
195 NULL, /* Revert */
196 NULL, /* LockRegion */
197 NULL, /* UnlockRegion */
198 Stat,
199 NULL /* Clone */
200 };
201
202 /* Function ptrs for ordinal calls */
203 static HMODULE SHLWAPI_hshlwapi = 0;
204
205 static VOID (WINAPI *pSHLWAPI_19)(LPSHLWAPI_CLIST);
206 static HRESULT (WINAPI *pSHLWAPI_20)(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST);
207 static BOOL (WINAPI *pSHLWAPI_21)(LPSHLWAPI_CLIST*,ULONG);
208 static LPSHLWAPI_CLIST (WINAPI *pSHLWAPI_22)(LPSHLWAPI_CLIST,ULONG);
209 static HRESULT (WINAPI *pSHLWAPI_17)(_IDummyStream*,LPSHLWAPI_CLIST);
210 static HRESULT (WINAPI *pSHLWAPI_18)(_IDummyStream*,LPSHLWAPI_CLIST*);
211
212 static BOOL (WINAPI *pSHLWAPI_166)(_IDummyStream*);
213 static HRESULT (WINAPI *pSHLWAPI_184)(_IDummyStream*,LPVOID,ULONG);
214 static HRESULT (WINAPI *pSHLWAPI_212)(_IDummyStream*,LPCVOID,ULONG);
215 static HRESULT (WINAPI *pSHLWAPI_213)(_IDummyStream*);
216 static HRESULT (WINAPI *pSHLWAPI_214)(_IDummyStream*,ULARGE_INTEGER*);
217
218
219 static BOOL InitFunctionPtrs(void)
220 {
221 SHLWAPI_hshlwapi = GetModuleHandleA("shlwapi.dll");
222
223 /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
224 if(!GetProcAddress(SHLWAPI_hshlwapi, "SHCreateStreamOnFileEx")){
225 win_skip("Too old shlwapi version\n");
226 return FALSE;
227 }
228
229 pSHLWAPI_17 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17);
230 ok(pSHLWAPI_17 != 0, "No Ordinal 17\n");
231 pSHLWAPI_18 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18);
232 ok(pSHLWAPI_18 != 0, "No Ordinal 18\n");
233 pSHLWAPI_19 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19);
234 ok(pSHLWAPI_19 != 0, "No Ordinal 19\n");
235 pSHLWAPI_20 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20);
236 ok(pSHLWAPI_20 != 0, "No Ordinal 20\n");
237 pSHLWAPI_21 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21);
238 ok(pSHLWAPI_21 != 0, "No Ordinal 21\n");
239 pSHLWAPI_22 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22);
240 ok(pSHLWAPI_22 != 0, "No Ordinal 22\n");
241 pSHLWAPI_166 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166);
242 ok(pSHLWAPI_166 != 0, "No Ordinal 166\n");
243 pSHLWAPI_184 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184);
244 ok(pSHLWAPI_184 != 0, "No Ordinal 184\n");
245 pSHLWAPI_212 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212);
246 ok(pSHLWAPI_212 != 0, "No Ordinal 212\n");
247 pSHLWAPI_213 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213);
248 ok(pSHLWAPI_213 != 0, "No Ordinal 213\n");
249 pSHLWAPI_214 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214);
250 ok(pSHLWAPI_214 != 0, "No Ordinal 214\n");
251
252 return TRUE;
253 }
254
255 static void InitDummyStream(_IDummyStream* iface)
256 {
257 iface->lpVtbl = (void*)iclvt;
258 iface->ref = 1;
259 iface->readcalls = 0;
260 iface->failreadcall = FALSE;
261 iface->failreadsize = FALSE;
262 iface->readbeyondend = FALSE;
263 iface->readreturnlarge = FALSE;
264 iface->writecalls = 0;
265 iface->failwritecall = FALSE;
266 iface->failwritesize = FALSE;
267 iface->seekcalls = 0;
268 iface->statcalls = 0;
269 iface->failstatcall = FALSE;
270 iface->item = SHLWAPI_CLIST_items;
271 iface->pos.QuadPart = 0;
272 }
273
274
275 static void test_CList(void)
276 {
277 _IDummyStream streamobj;
278 LPSHLWAPI_CLIST list = NULL;
279 LPCSHLWAPI_CLIST item = SHLWAPI_CLIST_items;
280 HRESULT hRet;
281 LPSHLWAPI_CLIST inserted;
282 BYTE buff[64];
283 unsigned int i;
284
285 if (!pSHLWAPI_17 || !pSHLWAPI_18 || !pSHLWAPI_19 || !pSHLWAPI_20 ||
286 !pSHLWAPI_21 || !pSHLWAPI_22)
287 return;
288
289 /* Populate a list and test the items are added correctly */
290 while (item->ulSize)
291 {
292 /* Create item and fill with data */
293 inserted = (LPSHLWAPI_CLIST)buff;
294 inserted->ulSize = item->ulSize + sizeof(SHLWAPI_CLIST);
295 inserted->ulId = item->ulId;
296 for (i = 0; i < item->ulSize; i++)
297 buff[sizeof(SHLWAPI_CLIST)+i] = i*2;
298
299 /* Add it */
300 hRet = pSHLWAPI_20(&list, inserted);
301 ok(hRet > S_OK, "failed list add\n");
302
303 if (hRet > S_OK)
304 {
305 ok(list && list->ulSize, "item not added\n");
306
307 /* Find it */
308 inserted = pSHLWAPI_22(list, item->ulId);
309 ok(inserted != NULL, "lost after adding\n");
310
311 ok(!inserted || inserted->ulId != ~0U, "find returned a container\n");
312
313 /* Check size */
314 if (inserted && inserted->ulSize & 0x3)
315 {
316 /* Contained */
317 ok(inserted[-1].ulId == ~0U, "invalid size is not countained\n");
318 ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
319 "container too small\n");
320 }
321 else if (inserted)
322 {
323 ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
324 "id %d wrong size %d\n", inserted->ulId, inserted->ulSize);
325 }
326 if (inserted)
327 {
328 BOOL bDataOK = TRUE;
329 LPBYTE bufftest = (LPBYTE)inserted;
330
331 for (i = 0; i < inserted->ulSize - sizeof(SHLWAPI_CLIST); i++)
332 if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
333 bDataOK = FALSE;
334
335 ok(bDataOK == TRUE, "data corrupted on insert\n");
336 }
337 ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
338 }
339 item++;
340 }
341
342 /* Write the list */
343 InitDummyStream(&streamobj);
344
345 hRet = pSHLWAPI_17(&streamobj, list);
346 ok(hRet == S_OK, "write failed\n");
347 if (hRet == S_OK)
348 {
349 /* 1 call for each element, + 1 for OK (use our null element for this) */
350 ok(streamobj.writecalls == sizeof(SHLWAPI_CLIST_items)/sizeof(SHLWAPI_CLIST),
351 "wrong call count\n");
352 ok(streamobj.readcalls == 0,"called Read() in write\n");
353 ok(streamobj.seekcalls == 0,"called Seek() in write\n");
354 }
355
356 /* Failure cases for writing */
357 InitDummyStream(&streamobj);
358 streamobj.failwritecall = TRUE;
359 hRet = pSHLWAPI_17(&streamobj, list);
360 ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
361 ok(streamobj.writecalls == 1, "called object after failure\n");
362 ok(streamobj.readcalls == 0,"called Read() after failure\n");
363 ok(streamobj.seekcalls == 0,"called Seek() after failure\n");
364
365 InitDummyStream(&streamobj);
366 streamobj.failwritesize = TRUE;
367 hRet = pSHLWAPI_17(&streamobj, list);
368 ok(hRet == STG_E_MEDIUMFULL || broken(hRet == E_FAIL) /* Win7 */,
369 "changed size failure return\n");
370 ok(streamobj.writecalls == 1, "called object after size failure\n");
371 ok(streamobj.readcalls == 0,"called Read() after failure\n");
372 ok(streamobj.seekcalls == 0,"called Seek() after failure\n");
373
374 /* Invalid inputs for adding */
375 inserted = (LPSHLWAPI_CLIST)buff;
376 inserted->ulSize = sizeof(SHLWAPI_CLIST) -1;
377 inserted->ulId = 33;
378
379 /* The call succeeds but the item is not inserted, except on some early
380 * versions which return failure. Wine behaves like later versions.
381 */
382 pSHLWAPI_20(&list, inserted);
383
384 inserted = pSHLWAPI_22(list, 33);
385 ok(inserted == NULL, "inserted bad element size\n");
386
387 inserted = (LPSHLWAPI_CLIST)buff;
388 inserted->ulSize = 44;
389 inserted->ulId = ~0U;
390
391 /* See comment above, some early versions fail this call */
392 pSHLWAPI_20(&list, inserted);
393
394 item = SHLWAPI_CLIST_items;
395
396 /* Look for nonexistent item in populated list */
397 inserted = pSHLWAPI_22(list, 99999999);
398 ok(inserted == NULL, "found a nonexistent item\n");
399
400 while (item->ulSize)
401 {
402 /* Delete items */
403 BOOL bRet = pSHLWAPI_21(&list, item->ulId);
404 ok(bRet == TRUE, "couldn't find item to delete\n");
405 item++;
406 }
407
408 /* Look for nonexistent item in empty list */
409 inserted = pSHLWAPI_22(list, 99999999);
410 ok(inserted == NULL, "found an item in empty list\n");
411
412 /* Create a list by reading in data */
413 InitDummyStream(&streamobj);
414
415 hRet = pSHLWAPI_18(&streamobj, &list);
416 ok(hRet == S_OK, "failed create from Read()\n");
417 if (hRet == S_OK)
418 {
419 ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
420 /* 2 calls per item, but only 1 for the terminator */
421 ok(streamobj.readcalls == sizeof(SHLWAPI_CLIST_items)/sizeof(SHLWAPI_CLIST)*2-1,
422 "wrong call count\n");
423 ok(streamobj.writecalls == 0, "called Write() from create\n");
424 ok(streamobj.seekcalls == 0,"called Seek() from create\n");
425
426 item = SHLWAPI_CLIST_items;
427
428 /* Check the items were added correctly */
429 while (item->ulSize)
430 {
431 inserted = pSHLWAPI_22(list, item->ulId);
432 ok(inserted != NULL, "lost after adding\n");
433
434 ok(!inserted || inserted->ulId != ~0U, "find returned a container\n");
435
436 /* Check size */
437 if (inserted && inserted->ulSize & 0x3)
438 {
439 /* Contained */
440 ok(inserted[-1].ulId == ~0U, "invalid size is not countained\n");
441 ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
442 "container too small\n");
443 }
444 else if (inserted)
445 {
446 ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
447 "id %d wrong size %d\n", inserted->ulId, inserted->ulSize);
448 }
449 ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
450 if (inserted)
451 {
452 BOOL bDataOK = TRUE;
453 LPBYTE bufftest = (LPBYTE)inserted;
454
455 for (i = 0; i < inserted->ulSize - sizeof(SHLWAPI_CLIST); i++)
456 if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
457 bDataOK = FALSE;
458
459 ok(bDataOK == TRUE, "data corrupted on insert\n");
460 }
461 item++;
462 }
463 }
464
465 /* Failure cases for reading */
466 InitDummyStream(&streamobj);
467 streamobj.failreadcall = TRUE;
468 hRet = pSHLWAPI_18(&streamobj, &list);
469 ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
470 ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
471 ok(streamobj.readcalls == 1, "called object after read failure\n");
472 ok(streamobj.writecalls == 0,"called Write() after read failure\n");
473 ok(streamobj.seekcalls == 0,"called Seek() after read failure\n");
474
475 /* Read returns large object */
476 InitDummyStream(&streamobj);
477 streamobj.readreturnlarge = TRUE;
478 hRet = pSHLWAPI_18(&streamobj, &list);
479 ok(hRet == S_OK, "failed create from Read() with large item\n");
480 ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
481 ok(streamobj.readcalls == 1,"wrong call count\n");
482 ok(streamobj.writecalls == 0,"called Write() after read failure\n");
483 ok(streamobj.seekcalls == 2,"wrong Seek() call count (%d)\n", streamobj.seekcalls);
484
485 pSHLWAPI_19(list);
486 }
487
488 static BOOL test_SHLWAPI_166(void)
489 {
490 _IDummyStream streamobj;
491 BOOL bRet;
492
493 if (!pSHLWAPI_166)
494 return FALSE;
495
496 InitDummyStream(&streamobj);
497 bRet = pSHLWAPI_166(&streamobj);
498
499 if (bRet != TRUE)
500 return FALSE; /* This version doesn't support stream ops on clists */
501
502 ok(streamobj.readcalls == 0, "called Read()\n");
503 ok(streamobj.writecalls == 0, "called Write()\n");
504 ok(streamobj.seekcalls == 0, "called Seek()\n");
505 ok(streamobj.statcalls == 1, "wrong call count\n");
506
507 streamobj.statcalls = 0;
508 streamobj.pos.QuadPart = 50001;
509
510 bRet = pSHLWAPI_166(&streamobj);
511
512 ok(bRet == FALSE, "failed after seek adjusted\n");
513 ok(streamobj.readcalls == 0, "called Read()\n");
514 ok(streamobj.writecalls == 0, "called Write()\n");
515 ok(streamobj.seekcalls == 0, "called Seek()\n");
516 ok(streamobj.statcalls == 1, "wrong call count\n");
517
518 /* Failure cases */
519 InitDummyStream(&streamobj);
520 streamobj.pos.QuadPart = 50001;
521 streamobj.failstatcall = TRUE; /* 1: Stat() Bad, Read() OK */
522 bRet = pSHLWAPI_166(&streamobj);
523 ok(bRet == FALSE, "should be FALSE after read is OK\n");
524 ok(streamobj.readcalls == 1, "wrong call count\n");
525 ok(streamobj.writecalls == 0, "called Write()\n");
526 ok(streamobj.seekcalls == 1, "wrong call count\n");
527 ok(streamobj.statcalls == 1, "wrong call count\n");
528 ok(streamobj.pos.QuadPart == 0, "Didn't seek to start\n");
529
530 InitDummyStream(&streamobj);
531 streamobj.pos.QuadPart = 50001;
532 streamobj.failstatcall = TRUE;
533 streamobj.failreadcall = TRUE; /* 2: Stat() Bad, Read() Bad Also */
534 bRet = pSHLWAPI_166(&streamobj);
535 ok(bRet == TRUE, "Should be true after read fails\n");
536 ok(streamobj.readcalls == 1, "wrong call count\n");
537 ok(streamobj.writecalls == 0, "called Write()\n");
538 ok(streamobj.seekcalls == 0, "Called Seek()\n");
539 ok(streamobj.statcalls == 1, "wrong call count\n");
540 ok(streamobj.pos.QuadPart == 50001, "called Seek() after read failed\n");
541 return TRUE;
542 }
543
544 static void test_SHLWAPI_184(void)
545 {
546 _IDummyStream streamobj;
547 char buff[256];
548 HRESULT hRet;
549
550 if (!pSHLWAPI_184)
551 return;
552
553 InitDummyStream(&streamobj);
554 hRet = pSHLWAPI_184(&streamobj, buff, sizeof(buff));
555
556 ok(hRet == S_OK, "failed Read()\n");
557 ok(streamobj.readcalls == 1, "wrong call count\n");
558 ok(streamobj.writecalls == 0, "called Write()\n");
559 ok(streamobj.seekcalls == 0, "called Seek()\n");
560 }
561
562 static void test_SHLWAPI_212(void)
563 {
564 _IDummyStream streamobj;
565 char buff[256];
566 HRESULT hRet;
567
568 if (!pSHLWAPI_212)
569 return;
570
571 InitDummyStream(&streamobj);
572 hRet = pSHLWAPI_212(&streamobj, buff, sizeof(buff));
573
574 ok(hRet == S_OK, "failed Write()\n");
575 ok(streamobj.readcalls == 0, "called Read()\n");
576 ok(streamobj.writecalls == 1, "wrong call count\n");
577 ok(streamobj.seekcalls == 0, "called Seek()\n");
578 }
579
580 static void test_SHLWAPI_213(void)
581 {
582 _IDummyStream streamobj;
583 ULARGE_INTEGER ul;
584 LARGE_INTEGER ll;
585 HRESULT hRet;
586
587 if (!pSHLWAPI_213 || !pSHLWAPI_214)
588 return;
589
590 InitDummyStream(&streamobj);
591 ll.QuadPart = 5000l;
592 Seek(&streamobj, ll, 0, NULL); /* Seek to 5000l */
593
594 streamobj.seekcalls = 0;
595 pSHLWAPI_213(&streamobj); /* Should rewind */
596 ok(streamobj.statcalls == 0, "called Stat()\n");
597 ok(streamobj.readcalls == 0, "called Read()\n");
598 ok(streamobj.writecalls == 0, "called Write()\n");
599 ok(streamobj.seekcalls == 1, "wrong call count\n");
600
601 ul.QuadPart = 50001;
602 hRet = pSHLWAPI_214(&streamobj, &ul);
603 ok(hRet == S_OK, "failed Stat()\n");
604 ok(ul.QuadPart == 0, "213 didn't rewind stream\n");
605 }
606
607 static void test_SHLWAPI_214(void)
608 {
609 _IDummyStream streamobj;
610 ULARGE_INTEGER ul;
611 LARGE_INTEGER ll;
612 HRESULT hRet;
613
614 if (!pSHLWAPI_214)
615 return;
616
617 InitDummyStream(&streamobj);
618 ll.QuadPart = 5000l;
619 Seek(&streamobj, ll, 0, NULL);
620 ul.QuadPart = 0;
621 streamobj.seekcalls = 0;
622 hRet = pSHLWAPI_214(&streamobj, &ul);
623
624 ok(hRet == S_OK, "failed Stat()\n");
625 ok(streamobj.statcalls == 1, "wrong call count\n");
626 ok(streamobj.readcalls == 0, "called Read()\n");
627 ok(streamobj.writecalls == 0, "called Write()\n");
628 ok(streamobj.seekcalls == 0, "called Seek()\n");
629 ok(ul.QuadPart == 5000l, "Stat gave wrong size\n");
630 }
631
632 START_TEST(clist)
633 {
634 if(!InitFunctionPtrs())
635 return;
636
637 test_CList();
638
639 /* Test streaming if this version supports it */
640 if (test_SHLWAPI_166())
641 {
642 test_SHLWAPI_184();
643 test_SHLWAPI_212();
644 test_SHLWAPI_213();
645 test_SHLWAPI_214();
646 }
647 }