shell32: Implement SHQueryRecycleBin.

This commit is contained in:
Jay Yang 2011-07-08 10:46:44 -04:00 committed by Alexandre Julliard
parent a77d50b6f3
commit 52838e687a
3 changed files with 33 additions and 22 deletions

View file

@ -2,6 +2,7 @@
* Trash virtual folder support. The trashing engine is implemented in trash.c
*
* Copyright (C) 2006 Mikolaj Zalewski
* Copyright 2011 Jay Yang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -34,6 +35,7 @@
#include "shlwapi.h"
#include "shlobj.h"
#include "shresdef.h"
#include "shellapi.h"
#include "wine/debug.h"
#include "shell32_main.h"
@ -524,6 +526,35 @@ static const IPersistFolder2Vtbl recycleBinPersistVtbl =
RecycleBin_GetCurFolder
};
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
WCHAR wszRootPath[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, wszRootPath, MAX_PATH);
return SHQueryRecycleBinW(wszRootPath, pSHQueryRBInfo);
}
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
LPITEMIDLIST *apidl;
INT cidl;
INT i=0;
TRACE("(%s, %p)\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
FIXME("Ignoring pszRootPath=%s\n",debugstr_w(pszRootPath));
TRASH_EnumItems(&apidl,&cidl);
pSHQueryRBInfo->i64NumItems = cidl;
pSHQueryRBInfo->i64Size = 0;
for (; i<cidl; i++)
{
WIN32_FIND_DATAW data;
TRASH_UnpackItemID(&((apidl[i])->mkid),&data);
pSHQueryRBInfo->i64Size += ((DWORDLONG)data.nFileSizeHigh << 32) + data.nFileSizeLow;
ILFree(apidl[i]);
}
SHFree(apidl);
return S_OK;
}
/*************************************************************************
* SHUpdateRecycleBinIcon [SHELL32.@]
*

View file

@ -2119,26 +2119,6 @@ DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
return SHFMT_NOFORMAT;
}
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
FIXME("%s, %p - stub\n", debugstr_a(pszRootPath), pSHQueryRBInfo);
pSHQueryRBInfo->i64Size = 0;
pSHQueryRBInfo->i64NumItems = 0;
return S_OK;
}
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
{
FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
pSHQueryRBInfo->i64Size = 0;
pSHQueryRBInfo->i64NumItems = 0;
return S_OK;
}
/*************************************************************************
* SHSetLocalizedName (SHELL32.@)
*/

View file

@ -90,8 +90,8 @@ static void test_query_recyclebin(void)
ok(!pSHFileOperationA(&shfo), "Deletion was not successful\n");
hr = pSHQueryRecycleBinA(buf,&info2);
ok(hr == S_OK, "SHQueryRecycleBinW failed with error 0x%x\n", hr);
todo_wine ok(info2.i64Size==info1.i64Size+written,"Expected recycle bin to have 0x%s bytes\n",str_from_int64(info1.i64Size+written));
todo_wine ok(info2.i64NumItems==info1.i64NumItems+1,"Expected recycle bin to have 0x%s items\n",str_from_int64(info1.i64NumItems+1));
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));
}