shell32: Handle TRASH_EnumItems failures correctly.
This commit is contained in:
parent
814ab9ee46
commit
d46862b487
|
@ -411,7 +411,7 @@ static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SH
|
|||
IEnumIDListImpl *list;
|
||||
LPITEMIDLIST *pidls;
|
||||
HRESULT ret = E_OUTOFMEMORY;
|
||||
int pidls_count;
|
||||
int pidls_count = 0;
|
||||
int i=0;
|
||||
|
||||
TRACE("(%p, %p, %x, %p)\n", This, hwnd, grfFlags, ppenumIDList);
|
||||
|
@ -860,10 +860,14 @@ HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryR
|
|||
LPITEMIDLIST *apidl;
|
||||
INT cidl;
|
||||
INT i=0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%s, %p)\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
|
||||
FIXME("Ignoring pszRootPath=%s\n",debugstr_w(pszRootPath));
|
||||
|
||||
TRASH_EnumItems(&apidl,&cidl);
|
||||
hr = TRASH_EnumItems(&apidl,&cidl);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
pSHQueryRBInfo->i64NumItems = cidl;
|
||||
pSHQueryRBInfo->i64Size = 0;
|
||||
for (; i<cidl; i++)
|
||||
|
@ -894,9 +898,14 @@ HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags)
|
|||
INT cidl;
|
||||
INT i=0;
|
||||
HRESULT ret;
|
||||
|
||||
TRACE("(%p, %s, 0x%08x)\n", hwnd, debugstr_w(pszRootPath) , dwFlags);
|
||||
FIXME("Ignoring pszRootPath=%s\n",debugstr_w(pszRootPath));
|
||||
TRASH_EnumItems(&apidl,&cidl);
|
||||
|
||||
ret = TRASH_EnumItems(&apidl,&cidl);
|
||||
if (FAILED(ret))
|
||||
return ret;
|
||||
|
||||
ret = erase_items(hwnd,(const LPCITEMIDLIST*)apidl,cidl,!(dwFlags & SHERB_NOCONFIRMATION));
|
||||
for (;i<cidl;i++)
|
||||
ILFree(apidl[i]);
|
||||
|
|
|
@ -70,9 +70,12 @@ static void test_query_recyclebin(void)
|
|||
ok(GetTempFileNameA(temp_path, "trash", 0, buf), "GetTempFileName failed\n");
|
||||
buf[strlen(buf) + 1] = '\0';
|
||||
hr = pSHQueryRecycleBinA(buf,&info1);
|
||||
ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
ok(info1.i64Size!=0xdeadbeef,"i64Size not set\n");
|
||||
ok(info1.i64NumItems!=0xdeadbeef,"i64NumItems not set\n");
|
||||
if(hr != S_OK) todo_wine ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
else {
|
||||
ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
ok(info1.i64Size!=0xdeadbeef,"i64Size not set\n");
|
||||
ok(info1.i64NumItems!=0xdeadbeef,"i64NumItems not set\n");
|
||||
}
|
||||
/*create and send a file to the recycle bin*/
|
||||
file = CreateFileA(buf,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",buf);
|
||||
|
@ -87,13 +90,11 @@ static void test_query_recyclebin(void)
|
|||
shfo.lpszProgressTitle = NULL;
|
||||
ok(!pSHFileOperationA(&shfo), "Deletion was not successful\n");
|
||||
hr = pSHQueryRecycleBinA(buf,&info2);
|
||||
ok(hr == S_OK, "SHQueryRecycleBinW failed with error 0x%x\n", hr);
|
||||
if(info2.i64Size!=info1.i64Size || info2.i64NumItems!=info1.i64NumItems) {
|
||||
ok(info2.i64Size==info1.i64Size+written,"Expected recycle bin to have 0x%s bytes\n",str_from_int64(info1.i64Size+written));
|
||||
ok(info2.i64NumItems==info1.i64NumItems+1,"Expected recycle bin to have 0x%s items\n",str_from_int64(info1.i64NumItems+1));
|
||||
} else todo_wine {
|
||||
ok(info2.i64Size==info1.i64Size+written,"Expected recycle bin to have 0x%s bytes\n",str_from_int64(info1.i64Size+written));
|
||||
ok(info2.i64NumItems==info1.i64NumItems+1,"Expected recycle bin to have 0x%s items\n",str_from_int64(info1.i64NumItems+1));
|
||||
if(hr != S_OK) todo_wine ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
else {
|
||||
ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
ok(info2.i64Size==info1.i64Size+written,"Expected recycle bin to have 0x%s bytes\n",str_from_int64(info1.i64Size+written));
|
||||
ok(info2.i64NumItems==info1.i64NumItems+1,"Expected recycle bin to have 0x%s items\n",str_from_int64(info1.i64NumItems+1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue