Module: wine Branch: master Commit: 52838e687adbf04b12629ed12f7a095f9133e854 URL: http://source.winehq.org/git/wine.git/?a=commit;h=52838e687adbf04b12629ed12f...
Author: Jay Yang jkelleyy@gmail.com Date: Fri Jul 8 10:46:44 2011 -0400
shell32: Implement SHQueryRecycleBin.
---
dlls/shell32/recyclebin.c | 31 +++++++++++++++++++++++++++++++ dlls/shell32/shellord.c | 20 -------------------- dlls/shell32/tests/recyclebin.c | 4 ++-- 3 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index 47d2775..4787ad7 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 (; 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.@] * diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 051154d..8d7ce89 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 ed30464..ce101a6 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)); }