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