[SHLWAPI_WINETEST]: Sync to Wine 1.5.13.
[reactos.git] / rostests / winetests / shlwapi / clist.c
index 3b979fd..65d3178 100755 (executable)
@@ -212,10 +212,16 @@ static HRESULT (WINAPI *pSHLWAPI_213)(_IDummyStream*);
 static HRESULT (WINAPI *pSHLWAPI_214)(_IDummyStream*,ULARGE_INTEGER*);
 
 
-static void InitFunctionPtrs(void)
+static BOOL InitFunctionPtrs(void)
 {
   SHLWAPI_hshlwapi = GetModuleHandleA("shlwapi.dll");
 
+  /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
+  if(!GetProcAddress(SHLWAPI_hshlwapi, "SHCreateStreamOnFileEx")){
+      win_skip("Too old shlwapi version\n");
+      return FALSE;
+  }
+
   pSHLWAPI_17 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17);
   ok(pSHLWAPI_17 != 0, "No Ordinal 17\n");
   pSHLWAPI_18 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18);
@@ -238,6 +244,8 @@ static void InitFunctionPtrs(void)
   ok(pSHLWAPI_213 != 0, "No Ordinal 213\n");
   pSHLWAPI_214 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214);
   ok(pSHLWAPI_214 != 0, "No Ordinal 214\n");
+
+  return TRUE;
 }
 
 static void InitDummyStream(_IDummyStream* iface)
@@ -363,26 +371,22 @@ static void test_CList(void)
   inserted = (LPSHLWAPI_CLIST)buff;
   inserted->ulSize = sizeof(SHLWAPI_CLIST) -1;
   inserted->ulId = 33;
-  hRet = pSHLWAPI_20(&list, inserted);
+
   /* The call succeeds but the item is not inserted, except on some early
    * versions which return failure. Wine behaves like later versions.
    */
-  if (0)
-  {
-  ok(hRet == S_OK, "failed bad element size\n");
-  }
+  pSHLWAPI_20(&list, inserted);
+
   inserted = pSHLWAPI_22(list, 33);
   ok(inserted == NULL, "inserted bad element size\n");
 
   inserted = (LPSHLWAPI_CLIST)buff;
   inserted->ulSize = 44;
   inserted->ulId = ~0U;
-  hRet = pSHLWAPI_20(&list, inserted);
+
   /* See comment above, some early versions fail this call */
-  if (0)
-  {
-  ok(hRet == S_OK, "failed adding a container\n");
-  }
+  pSHLWAPI_20(&list, inserted);
+
   item = SHLWAPI_CLIST_items;
 
   /* Look for nonexistent item in populated list */
@@ -623,7 +627,8 @@ static void test_SHLWAPI_214(void)
 
 START_TEST(clist)
 {
-  InitFunctionPtrs();
+  if(!InitFunctionPtrs())
+    return;
 
   test_CList();