Index: dll/win32/shell32/folders/CRecycleBin.cpp =================================================================== --- dll/win32/shell32/folders/CRecycleBin.cpp (revision 66199) +++ dll/win32/shell32/folders/CRecycleBin.cpp (working copy) @@ -1604,18 +1604,66 @@ HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags) { WCHAR szPath[MAX_PATH] = {0}; - DWORD dwSize, dwType; + DWORD dwSize, dwType, count = 0; LONG ret; + IShellFolder *pDesktop = NULL, *m_pRecycleBin = NULL; + LPITEMIDLIST pidlRecycleBin = NULL, pidl = NULL; + HRESULT hr = S_OK; + LPMALLOC Malloc; + 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"); + SHGetMalloc(&Malloc); + SHGetDesktopFolder(&pDesktop); + SHGetSpecialFolderLocation (0, CSIDL_BITBUCKET, &pidlRecycleBin); + pDesktop->BindToObject(pidlRecycleBin, NULL, IID_IShellFolder, (LPVOID *)&m_pRecycleBin); + hr = m_pRecycleBin->EnumObjects(0, SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN, &penumFiles); + + if (SUCCEEDED(hr)) + { + while (penumFiles->Next(1, &pidl, NULL) != S_FALSE) + { + count++; + m_pRecycleBin->GetDisplayNameOf(pidl, SHGDN_NORMAL, &StrRet); + Malloc->Free(pidl); + } + } + + 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"); + Malloc->Free(StrRet.pOleStr); + Malloc->Release(); + 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, StrRet.pOleStr) == IDNO) + { + Malloc->Free(StrRet.pOleStr); + Malloc->Release(); + return S_OK; + } + break; + default: + /* we have more than one item, so show a message box with the count of the items */ + if (ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_DELETEMULTIPLE_TEXT), MAKEINTRESOURCEW(IDS_EMPTY_BITBUCKET), + MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, count) == IDNO) + { + Malloc->Free(StrRet.pOleStr); + Malloc->Release(); + return S_OK; + } + } + Malloc->Free(StrRet.pOleStr); + Malloc->Release(); } if (dwFlags & SHERB_NOPROGRESSUI)