Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/shlwapi/tests/clist.c | 153 ++++++++++++++++++------------------- dlls/shlwapi/tests/clsid.c | 27 ++++--- 2 files changed, 88 insertions(+), 92 deletions(-)
diff --git a/dlls/shlwapi/tests/clist.c b/dlls/shlwapi/tests/clist.c index 2fa22e5e762..8c63f31af7b 100644 --- a/dlls/shlwapi/tests/clist.c +++ b/dlls/shlwapi/tests/clist.c @@ -210,18 +210,18 @@ static IStreamVtbl iclvt = /* Function ptrs for ordinal calls */ static HMODULE SHLWAPI_hshlwapi = 0;
-static void (WINAPI *pSHLWAPI_19)(DATABLOCK_HEADER *); -static HRESULT (WINAPI *pSHLWAPI_20)(DATABLOCK_HEADER **, DATABLOCK_HEADER *); -static BOOL (WINAPI *pSHLWAPI_21)(DATABLOCK_HEADER **,ULONG); -static DATABLOCK_HEADER *(WINAPI *pSHLWAPI_22)(DATABLOCK_HEADER *,ULONG); -static HRESULT (WINAPI *pSHLWAPI_17)(IStream *, DATABLOCK_HEADER *); -static HRESULT (WINAPI *pSHLWAPI_18)(IStream *, DATABLOCK_HEADER **); +static void (WINAPI *pSHFreeDataBlockList)(DATABLOCK_HEADER *); +static HRESULT (WINAPI *pSHAddDataBlock)(DATABLOCK_HEADER **, DATABLOCK_HEADER *); +static BOOL (WINAPI *pSHRemoveDataBlock)(DATABLOCK_HEADER **,ULONG); +static DATABLOCK_HEADER *(WINAPI *pSHFindDataBlock)(DATABLOCK_HEADER *,ULONG); +static HRESULT (WINAPI *pSHWriteDataBlockList)(IStream *, DATABLOCK_HEADER *); +static HRESULT (WINAPI *pSHReadDataBlockList)(IStream *, DATABLOCK_HEADER **);
-static BOOL (WINAPI *pSHLWAPI_166)(IStream*); -static HRESULT (WINAPI *pSHLWAPI_184)(IStream*, void*, ULONG); -static HRESULT (WINAPI *pSHLWAPI_212)(IStream*, const void*, ULONG); -static HRESULT (WINAPI *pSHLWAPI_213)(IStream*); -static HRESULT (WINAPI *pSHLWAPI_214)(IStream*, ULARGE_INTEGER*); +static BOOL (WINAPI *pSHIsEmptyStream)(IStream *); +static HRESULT (WINAPI *pIStream_Read)(IStream *, void *, ULONG); +static HRESULT (WINAPI *pIStream_Write)(IStream *, const void *, ULONG); +static HRESULT (WINAPI *pIStream_Reset)(IStream *); +static HRESULT (WINAPI *pIStream_Size)(IStream *, ULARGE_INTEGER *);
static BOOL InitFunctionPtrs(void) @@ -234,28 +234,28 @@ static BOOL InitFunctionPtrs(void) 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); - ok(pSHLWAPI_18 != 0, "No Ordinal 18\n"); - pSHLWAPI_19 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19); - ok(pSHLWAPI_19 != 0, "No Ordinal 19\n"); - pSHLWAPI_20 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20); - ok(pSHLWAPI_20 != 0, "No Ordinal 20\n"); - pSHLWAPI_21 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21); - ok(pSHLWAPI_21 != 0, "No Ordinal 21\n"); - pSHLWAPI_22 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22); - ok(pSHLWAPI_22 != 0, "No Ordinal 22\n"); - pSHLWAPI_166 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166); - ok(pSHLWAPI_166 != 0, "No Ordinal 166\n"); - pSHLWAPI_184 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184); - ok(pSHLWAPI_184 != 0, "No Ordinal 184\n"); - pSHLWAPI_212 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212); - ok(pSHLWAPI_212 != 0, "No Ordinal 212\n"); - pSHLWAPI_213 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213); - ok(pSHLWAPI_213 != 0, "No Ordinal 213\n"); - pSHLWAPI_214 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214); - ok(pSHLWAPI_214 != 0, "No Ordinal 214\n"); + pSHWriteDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17); + ok(pSHWriteDataBlockList != 0, "No Ordinal 17\n"); + pSHReadDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18); + ok(pSHReadDataBlockList != 0, "No Ordinal 18\n"); + pSHFreeDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19); + ok(pSHFreeDataBlockList != 0, "No Ordinal 19\n"); + pSHAddDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20); + ok(pSHAddDataBlock != 0, "No Ordinal 20\n"); + pSHRemoveDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21); + ok(pSHRemoveDataBlock != 0, "No Ordinal 21\n"); + pSHFindDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22); + ok(pSHFindDataBlock != 0, "No Ordinal 22\n"); + pSHIsEmptyStream = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166); + ok(pSHIsEmptyStream != 0, "No Ordinal 166\n"); + pIStream_Read = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184); + ok(pIStream_Read != 0, "No Ordinal 184\n"); + pIStream_Write = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212); + ok(pIStream_Write != 0, "No Ordinal 212\n"); + pIStream_Reset = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213); + ok(pIStream_Reset != 0, "No Ordinal 213\n"); + pIStream_Size = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214); + ok(pIStream_Size != 0, "No Ordinal 214\n");
return TRUE; } @@ -290,8 +290,8 @@ static void test_CList(void) BYTE buff[64]; unsigned int i;
- if (!pSHLWAPI_17 || !pSHLWAPI_18 || !pSHLWAPI_19 || !pSHLWAPI_20 || - !pSHLWAPI_21 || !pSHLWAPI_22) + if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock || + !pSHRemoveDataBlock || !pSHFindDataBlock) return;
/* Populate a list and test the items are added correctly */ @@ -304,16 +304,14 @@ static void test_CList(void) for (i = 0; i < item->cbSize; i++) buff[sizeof(DATABLOCK_HEADER) + i] = i * 2;
- /* Add it */ - hRet = pSHLWAPI_20(&list, inserted); + hRet = pSHAddDataBlock(&list, inserted); ok(hRet > S_OK, "failed list add\n");
if (hRet > S_OK) { ok(list && list->cbSize, "item not added\n");
- /* Find it */ - inserted = pSHLWAPI_22(list, item->dwSignature); + inserted = pSHFindDataBlock(list, item->dwSignature); ok(inserted != NULL, "lost after adding\n");
ok(!inserted || inserted->dwSignature != ~0U, "find returned a container\n"); @@ -350,7 +348,7 @@ static void test_CList(void) /* Write the list */ InitDummyStream(&streamobj);
- hRet = pSHLWAPI_17(&streamobj.IStream_iface, list); + hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list); ok(hRet == S_OK, "write failed\n"); if (hRet == S_OK) { @@ -363,7 +361,7 @@ static void test_CList(void) /* Failure cases for writing */ InitDummyStream(&streamobj); streamobj.failwritecall = TRUE; - hRet = pSHLWAPI_17(&streamobj.IStream_iface, list); + hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list); ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n"); ok(streamobj.writecalls == 1, "called object after failure\n"); ok(streamobj.readcalls == 0,"called Read() after failure\n"); @@ -371,7 +369,7 @@ static void test_CList(void)
InitDummyStream(&streamobj); streamobj.failwritesize = TRUE; - hRet = pSHLWAPI_17(&streamobj.IStream_iface, list); + hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list); ok(hRet == STG_E_MEDIUMFULL || broken(hRet == E_FAIL) /* Win7 */, "changed size failure return\n"); ok(streamobj.writecalls == 1, "called object after size failure\n"); @@ -386,9 +384,9 @@ static void test_CList(void) /* The call succeeds but the item is not inserted, except on some early * versions which return failure. Wine behaves like later versions. */ - pSHLWAPI_20(&list, inserted); + pSHAddDataBlock(&list, inserted);
- inserted = pSHLWAPI_22(list, 33); + inserted = pSHFindDataBlock(list, 33); ok(inserted == NULL, "inserted bad element size\n");
inserted = (DATABLOCK_HEADER *)buff; @@ -396,30 +394,29 @@ static void test_CList(void) inserted->dwSignature = ~0U;
/* See comment above, some early versions fail this call */ - pSHLWAPI_20(&list, inserted); + pSHAddDataBlock(&list, inserted);
item = clist_items;
/* Look for nonexistent item in populated list */ - inserted = pSHLWAPI_22(list, 99999999); + inserted = pSHFindDataBlock(list, 99999999); ok(inserted == NULL, "found a nonexistent item\n");
while (item->cbSize) { - /* Delete items */ - BOOL bRet = pSHLWAPI_21(&list, item->dwSignature); + BOOL bRet = pSHRemoveDataBlock(&list, item->dwSignature); ok(bRet == TRUE, "couldn't find item to delete\n"); item++; }
/* Look for nonexistent item in empty list */ - inserted = pSHLWAPI_22(list, 99999999); + inserted = pSHFindDataBlock(list, 99999999); ok(inserted == NULL, "found an item in empty list\n");
/* Create a list by reading in data */ InitDummyStream(&streamobj);
- hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list); + hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list); ok(hRet == S_OK, "failed create from Read()\n"); if (hRet == S_OK) { @@ -434,7 +431,7 @@ static void test_CList(void) /* Check the items were added correctly */ while (item->cbSize) { - inserted = pSHLWAPI_22(list, item->dwSignature); + inserted = pSHFindDataBlock(list, item->dwSignature); ok(inserted != NULL, "lost after adding\n");
ok(!inserted || inserted->dwSignature != ~0U, "find returned a container\n"); @@ -471,7 +468,7 @@ static void test_CList(void) /* Failure cases for reading */ InitDummyStream(&streamobj); streamobj.failreadcall = TRUE; - hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list); + hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list); ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n"); ok(streamobj.readbeyondend == FALSE, "read beyond end\n"); ok(streamobj.readcalls == 1, "called object after read failure\n"); @@ -481,26 +478,26 @@ static void test_CList(void) /* Read returns large object */ InitDummyStream(&streamobj); streamobj.readreturnlarge = TRUE; - hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list); + hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list); ok(hRet == S_OK, "failed create from Read() with large item\n"); ok(streamobj.readbeyondend == FALSE, "read beyond end\n"); ok(streamobj.readcalls == 1,"wrong call count\n"); ok(streamobj.writecalls == 0,"called Write() after read failure\n"); ok(streamobj.seekcalls == 2,"wrong Seek() call count (%d)\n", streamobj.seekcalls);
- pSHLWAPI_19(list); + pSHFreeDataBlockList(list); }
-static BOOL test_SHLWAPI_166(void) +static BOOL test_SHIsEmptyStream(void) { struct dummystream streamobj; BOOL bRet;
- if (!pSHLWAPI_166) + if (!pSHIsEmptyStream) return FALSE;
InitDummyStream(&streamobj); - bRet = pSHLWAPI_166(&streamobj.IStream_iface); + bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
if (bRet != TRUE) return FALSE; /* This version doesn't support stream ops on clists */ @@ -513,7 +510,7 @@ static BOOL test_SHLWAPI_166(void) streamobj.statcalls = 0; streamobj.pos.QuadPart = 50001;
- bRet = pSHLWAPI_166(&streamobj.IStream_iface); + bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
ok(bRet == FALSE, "failed after seek adjusted\n"); ok(streamobj.readcalls == 0, "called Read()\n"); @@ -525,7 +522,7 @@ static BOOL test_SHLWAPI_166(void) InitDummyStream(&streamobj); streamobj.pos.QuadPart = 50001; streamobj.failstatcall = TRUE; /* 1: Stat() Bad, Read() OK */ - bRet = pSHLWAPI_166(&streamobj.IStream_iface); + bRet = pSHIsEmptyStream(&streamobj.IStream_iface); ok(bRet == FALSE, "should be FALSE after read is OK\n"); ok(streamobj.readcalls == 1, "wrong call count\n"); ok(streamobj.writecalls == 0, "called Write()\n"); @@ -537,7 +534,7 @@ static BOOL test_SHLWAPI_166(void) streamobj.pos.QuadPart = 50001; streamobj.failstatcall = TRUE; streamobj.failreadcall = TRUE; /* 2: Stat() Bad, Read() Bad Also */ - bRet = pSHLWAPI_166(&streamobj.IStream_iface); + bRet = pSHIsEmptyStream(&streamobj.IStream_iface); ok(bRet == TRUE, "Should be true after read fails\n"); ok(streamobj.readcalls == 1, "wrong call count\n"); ok(streamobj.writecalls == 0, "called Write()\n"); @@ -547,17 +544,17 @@ static BOOL test_SHLWAPI_166(void) return TRUE; }
-static void test_SHLWAPI_184(void) +static void test_IStream_Read(void) { struct dummystream streamobj; char buff[256]; HRESULT hRet;
- if (!pSHLWAPI_184) + if (!pIStream_Read) return;
InitDummyStream(&streamobj); - hRet = pSHLWAPI_184(&streamobj.IStream_iface, buff, sizeof(buff)); + hRet = pIStream_Read(&streamobj.IStream_iface, buff, sizeof(buff));
ok(hRet == S_OK, "failed Read()\n"); ok(streamobj.readcalls == 1, "wrong call count\n"); @@ -565,17 +562,17 @@ static void test_SHLWAPI_184(void) ok(streamobj.seekcalls == 0, "called Seek()\n"); }
-static void test_SHLWAPI_212(void) +static void test_IStream_Write(void) { struct dummystream streamobj; char buff[256]; HRESULT hRet;
- if (!pSHLWAPI_212) + if (!pIStream_Write) return;
InitDummyStream(&streamobj); - hRet = pSHLWAPI_212(&streamobj.IStream_iface, buff, sizeof(buff)); + hRet = pIStream_Write(&streamobj.IStream_iface, buff, sizeof(buff));
ok(hRet == S_OK, "failed Write()\n"); ok(streamobj.readcalls == 0, "called Read()\n"); @@ -583,14 +580,14 @@ static void test_SHLWAPI_212(void) ok(streamobj.seekcalls == 0, "called Seek()\n"); }
-static void test_SHLWAPI_213(void) +static void test_IStream_Reset(void) { struct dummystream streamobj; ULARGE_INTEGER ul; LARGE_INTEGER ll; HRESULT hRet;
- if (!pSHLWAPI_213 || !pSHLWAPI_214) + if (!pIStream_Reset || !pIStream_Size) return;
InitDummyStream(&streamobj); @@ -598,26 +595,26 @@ static void test_SHLWAPI_213(void) Seek(&streamobj.IStream_iface, ll, 0, NULL); /* Seek to 5000l */
streamobj.seekcalls = 0; - pSHLWAPI_213(&streamobj.IStream_iface); /* Should rewind */ + pIStream_Reset(&streamobj.IStream_iface); ok(streamobj.statcalls == 0, "called Stat()\n"); ok(streamobj.readcalls == 0, "called Read()\n"); ok(streamobj.writecalls == 0, "called Write()\n"); ok(streamobj.seekcalls == 1, "wrong call count\n");
ul.QuadPart = 50001; - hRet = pSHLWAPI_214(&streamobj.IStream_iface, &ul); + hRet = pIStream_Size(&streamobj.IStream_iface, &ul); ok(hRet == S_OK, "failed Stat()\n"); ok(ul.QuadPart == 0, "213 didn't rewind stream\n"); }
-static void test_SHLWAPI_214(void) +static void test_IStream_Size(void) { struct dummystream streamobj; ULARGE_INTEGER ul; LARGE_INTEGER ll; HRESULT hRet;
- if (!pSHLWAPI_214) + if (!pIStream_Size) return;
InitDummyStream(&streamobj); @@ -625,7 +622,7 @@ static void test_SHLWAPI_214(void) Seek(&streamobj.IStream_iface, ll, 0, NULL); ul.QuadPart = 0; streamobj.seekcalls = 0; - hRet = pSHLWAPI_214(&streamobj.IStream_iface, &ul); + hRet = pIStream_Size(&streamobj.IStream_iface, &ul);
ok(hRet == S_OK, "failed Stat()\n"); ok(streamobj.statcalls == 1, "wrong call count\n"); @@ -643,11 +640,11 @@ START_TEST(clist) test_CList();
/* Test streaming if this version supports it */ - if (test_SHLWAPI_166()) + if (test_SHIsEmptyStream()) { - test_SHLWAPI_184(); - test_SHLWAPI_212(); - test_SHLWAPI_213(); - test_SHLWAPI_214(); + test_IStream_Read(); + test_IStream_Write(); + test_IStream_Reset(); + test_IStream_Size(); } } diff --git a/dlls/shlwapi/tests/clsid.c b/dlls/shlwapi/tests/clsid.c index e664f63cf76..7f2d375a35b 100644 --- a/dlls/shlwapi/tests/clsid.c +++ b/dlls/shlwapi/tests/clsid.c @@ -36,8 +36,8 @@ DEFINE_OLEGUID(WINE_IID_IDelayedRelease, 0x000214EDL, 0, 0);
/* Function ptrs for ordinal calls */ static HMODULE hShlwapi = 0; -static BOOL (WINAPI *pSHLWAPI_269)(LPCSTR, CLSID *) = 0; -static DWORD (WINAPI *pSHLWAPI_23)(REFGUID, LPSTR, INT) = 0; +static BOOL (WINAPI *pGUIDFromStringA)(LPCSTR, CLSID *) = 0; +static DWORD (WINAPI *pSHStringFromGUIDA)(REFGUID, LPSTR, INT) = 0;
/* GUIDs to test */ static const GUID * TEST_guids[] = { @@ -109,16 +109,16 @@ static void test_ClassIDs(void) int i = 0; BOOL is_vista = FALSE;
- if (!pSHLWAPI_269 || !pSHLWAPI_23) + if (!pGUIDFromStringA || !pSHStringFromGUIDA) return;
while (*guids) { - dwLen = pSHLWAPI_23(*guids, szBuff, 256); + dwLen = pSHStringFromGUIDA(*guids, szBuff, 256); if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */ ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i);
- bRet = pSHLWAPI_269(szBuff, &guid); + bRet = pGUIDFromStringA(szBuff, &guid); ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
if (bRet) @@ -129,7 +129,7 @@ static void test_ClassIDs(void) }
/* Test endianness */ - dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 256); + dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 256); ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianness\n", dwLen);
ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"), @@ -137,26 +137,25 @@ static void test_ClassIDs(void)
/* test lengths */ szBuff[0] = ':'; - dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 0); + dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 0); ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n"); ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':'; - dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 38); + dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 38); ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n"); ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':'; - dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39); + dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 39); ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n"); ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
- /* Test string */ strcpy(szBuff, "{xxx-"); - bRet = pSHLWAPI_269(szBuff, &guid); + bRet = pGUIDFromStringA(szBuff, &guid); ok(bRet == FALSE, "accepted invalid string\n");
- dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39); + dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 39); ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n"); ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n"); } @@ -192,8 +191,8 @@ START_TEST(clsid) return; }
- pSHLWAPI_269 = (void*)GetProcAddress(hShlwapi, (LPSTR)269); - pSHLWAPI_23 = (void*)GetProcAddress(hShlwapi, (LPSTR)23); + pGUIDFromStringA = (void*)GetProcAddress(hShlwapi, (LPSTR)269); + pSHStringFromGUIDA = (void*)GetProcAddress(hShlwapi, (LPSTR)23);
test_ClassIDs(); test_CLSIDFromProgIDWrap();