Index: dll/win32/shell32/folders/CRecycleBin.cpp =================================================================== --- dll/win32/shell32/folders/CRecycleBin.cpp (revision 66199) +++ dll/win32/shell32/folders/CRecycleBin.cpp (working copy) @@ -1603,19 +1603,59 @@ HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags) { - WCHAR szPath[MAX_PATH] = {0}; - DWORD dwSize, dwType; + WCHAR szPath[MAX_PATH] = {0}, szBuffer[MAX_PATH] = {0}; + DWORD dwSize, dwType, count = 0; LONG ret; + IShellFolder *pDesktop = NULL, *pRecycleBin = NULL; + LPITEMIDLIST pidlRecycleBin = NULL, pidl = NULL; + HRESULT hr = S_OK; + LPENUMIDLIST penumFiles; + STRRET StrRet; TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags); if (!(dwFlags & SHERB_NOCONFIRMATION)) { - /* FIXME - * enumerate available files - * show confirmation dialog - */ - FIXME("show confirmation dialog\n"); + SHGetDesktopFolder(&pDesktop); + SHGetSpecialFolderLocation (0, CSIDL_BITBUCKET, &pidlRecycleBin); + pDesktop->BindToObject(pidlRecycleBin, NULL, IID_IShellFolder, (LPVOID *)&pRecycleBin); + hr = pRecycleBin->EnumObjects(0, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN, &penumFiles); + + if (SUCCEEDED(hr)) + { + while (penumFiles->Next(1, &pidl, NULL) != S_FALSE) + { + count++; + pRecycleBin->GetDisplayNameOf(pidl, SHGDN_NORMAL, &StrRet); + StrRetToBuf(&StrRet, pidl, szBuffer, _countof(szBuffer)); + SHFree(pidl); + SHFree(StrRet.pOleStr); + } + } + SHFree(pidlRecycleBin); + pDesktop->Release(); + pRecycleBin->Release(); + penumFiles->Release(); + switch(count) + { + case 0: + /* this should never happen as the option to empty the recycle bin should be disabled if there are no files inside of it. */ + FIXME("This shouldn't happen, Recycle bin is empty!\n"); + return S_FALSE; + break; + case 1: + /* we have only one item inside the bin, so show a message box with its name */ + if (ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_DELETEITEM_TEXT), MAKEINTRESOURCEW(IDS_EMPTY_BITBUCKET), + MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO) + return S_OK; + break; + default: + /* we have more than one item, so show a message box with the count of the items */ + swprintf(szBuffer,L"%u", count); + if (ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_DELETEMULTIPLE_TEXT), MAKEINTRESOURCEW(IDS_EMPTY_BITBUCKET), + MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO) + return S_OK; + } } if (dwFlags & SHERB_NOPROGRESSUI)