shlwapi: SHAddDataBlock() returns BOOL, not HRESULT.

Signed-off-by: Hermès Bélusca-Maïto <hermes.belusca@sfr.fr>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hermès Bélusca-Maïto 2021-08-28 17:10:47 -05:00 committed by Alexandre Julliard
parent 00df0edb15
commit 2b37b075a6
2 changed files with 16 additions and 14 deletions

View file

@ -65,7 +65,7 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
* the call returns S_OK but does not actually add the element.
* See SHWriteDataBlockList.
*/
HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem)
BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem)
{
LPDATABLOCK_HEADER lpInsertAt = NULL;
ULONG ulSize;
@ -73,11 +73,11 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
TRACE("(%p,%p)\n", lppList, lpNewItem);
if(!lppList || !lpNewItem )
return E_INVALIDARG;
return FALSE;
if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) ||
lpNewItem->dwSignature == CLIST_ID_CONTAINER)
return S_OK;
return FALSE;
ulSize = lpNewItem->cbSize;
@ -134,9 +134,9 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
lpInsertAt = NextItem(lpInsertAt);
lpInsertAt->cbSize = 0;
return lpNewItem->cbSize;
return TRUE;
}
return S_OK;
return FALSE;
}
/*************************************************************************

View file

@ -289,6 +289,7 @@ static void test_CList(void)
DATABLOCK_HEADER *inserted;
BYTE buff[64];
unsigned int i;
BOOL ret;
if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock ||
!pSHRemoveDataBlock || !pSHFindDataBlock)
@ -304,10 +305,10 @@ static void test_CList(void)
for (i = 0; i < item->cbSize; i++)
buff[sizeof(DATABLOCK_HEADER) + i] = i * 2;
hRet = pSHAddDataBlock(&list, inserted);
ok(hRet > S_OK, "failed list add\n");
ret = pSHAddDataBlock(&list, inserted);
ok(ret == TRUE, "got %d\n", ret);
if (hRet > S_OK)
if (ret == TRUE)
{
ok(list && list->cbSize, "item not added\n");
@ -381,10 +382,11 @@ static void test_CList(void)
inserted->cbSize = sizeof(DATABLOCK_HEADER) - 1;
inserted->dwSignature = 33;
/* The call succeeds but the item is not inserted, except on some early
* versions which return failure. Wine behaves like later versions.
*/
pSHAddDataBlock(&list, inserted);
ret = pSHAddDataBlock(NULL, inserted);
ok(!ret, "got %d\n", ret);
ret = pSHAddDataBlock(&list, inserted);
ok(!ret, "got %d\n", ret);
inserted = pSHFindDataBlock(list, 33);
ok(inserted == NULL, "inserted bad element size\n");
@ -393,8 +395,8 @@ static void test_CList(void)
inserted->cbSize = 44;
inserted->dwSignature = ~0U;
/* See comment above, some early versions fail this call */
pSHAddDataBlock(&list, inserted);
ret = pSHAddDataBlock(&list, inserted);
ok(!ret, "got %d\n", ret);
item = clist_items;