diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index 47d2775e4c9..4787ad71f65 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -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 (; imkid),&data); + pSHQueryRBInfo->i64Size += ((DWORDLONG)data.nFileSizeHigh << 32) + data.nFileSizeLow; + ILFree(apidl[i]); + } + SHFree(apidl); + return S_OK; +} + /************************************************************************* * SHUpdateRecycleBinIcon [SHELL32.@] * diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 051154d260a..8d7ce893f33 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -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.@) */ diff --git a/dlls/shell32/tests/recyclebin.c b/dlls/shell32/tests/recyclebin.c index ed3046456a2..ce101a67c3a 100644 --- a/dlls/shell32/tests/recyclebin.c +++ b/dlls/shell32/tests/recyclebin.c @@ -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)); }