ReactOS  0.4.15-dev-3719-g41b8715
CRecycleBin.cpp
Go to the documentation of this file.
1 /*
2  * Trash virtual folder support. The trashing engine is implemented in trash.c
3  *
4  * Copyright (C) 2006 Mikolaj Zalewski
5  * Copyright (C) 2009 Andrew Hill
6  * Copyright (C) 2018 Russell Johnson
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #include <precomp.h>
24 
25 #include <mmsystem.h>
26 #include <ntquery.h>
27 
29 
30 typedef struct
31 {
33  const GUID *fmtId;
35  int pcsFlags;
36  int fmt;
37  int cxChars;
38 } columninfo;
39 
40 static const columninfo RecycleBinColumns[] =
41 {
48  /* {"creation time", &FMTID_Storage, PID_STG_CREATETIME, SHCOLSTATE_TYPE_DATE, LVCFMT_LEFT, 20}, */
49  /* {"attribs", &FMTID_Storage, PID_STG_ATTRIBUTES, SHCOLSTATE_TYPE_STR, LVCFMT_LEFT, 20}, */
50 };
51 
52 #define COLUMN_NAME 0
53 #define COLUMN_DELFROM 1
54 #define COLUMN_DATEDEL 2
55 #define COLUMN_SIZE 3
56 #define COLUMN_TYPE 4
57 #define COLUMN_MTIME 5
58 
59 #define COLUMNS_COUNT 6
60 
61 /*
62  * Recycle Bin folder
63  */
64 
66 
67 static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl);
68 
69 typedef struct _SEARCH_CONTEXT
70 {
71  PIDLRecycleStruct *pFileDetails;
75 
77  LPCITEMIDLIST pidl, REFIID riid, LPVOID * ppvOut)
78 {
79  PIDLRecycleStruct *pFileDetails = _ILGetRecycleStruct(pidl);
80  if (pFileDetails == NULL)
81  goto fallback;
82 
83  // Try to obtain the file
85  Context.pFileDetails = pFileDetails;
86  Context.bFound = FALSE;
87 
89  if (Context.bFound)
90  {
91  // This should be executed any time, if not, there are some errors in the implementation
92  IRecycleBinFile* pRecycleFile = (IRecycleBinFile*)Context.hDeletedFile;
93 
94  // Query the interface from the private interface
95  HRESULT hr = pRecycleFile->QueryInterface(riid, ppvOut);
96 
97  // Close the file handle as we don't need it anymore
98  CloseRecycleBinHandle(Context.hDeletedFile);
99 
100  return hr;
101  }
102 
103 fallback:
104  // In case the search fails we use a default icon
105  ERR("Recycler could not retrieve the icon, this shouldn't happen\n");
106 
107  CComPtr<IDefaultExtractIconInit> initIcon;
109  if (FAILED_UNEXPECTEDLY(hr))
110  return hr;
111 
112  initIcon->SetNormalIcon(swShell32Name, 0);
113 
114  return initIcon->QueryInterface(riid, ppvOut);
115 }
116 
118  public CEnumIDListBase
119 {
120  private:
121  public:
122  CRecycleBinEnum();
125  static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile);
126  BOOL WINAPI CBEnumRecycleBin(IN HANDLE hDeletedFile);
127 
129  COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
130  END_COM_MAP()
131 };
132 
134  public CComObjectRootEx<CComMultiThreadModelNoCS>,
135  public IContextMenu2
136 {
137  private:
139  public:
143 
144  // IContextMenu
145  virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
147  virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen);
148 
149  // IContextMenu2
151 
153  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
154  COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
155  END_COM_MAP()
156 };
157 
159 {
161 
162  PDELETED_FILE_DETAILS_W pFileDetails;
163  DWORD dwSize;
164  BOOL ret;
165 
166  if (!GetDeletedFileDetailsW(hDeletedFile,
167  0,
168  NULL,
169  &dwSize) &&
171  {
172  ERR("GetDeletedFileDetailsW failed\n");
173  return FALSE;
174  }
175 
176  pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize);
177  if (!pFileDetails)
178  {
179  ERR("No memory\n");
180  return FALSE;
181  }
182 
183  if (!GetDeletedFileDetailsW(hDeletedFile,
184  dwSize,
185  pFileDetails,
186  NULL))
187  {
188  ERR("GetDeletedFileDetailsW failed\n");
189  SHFree(pFileDetails);
190  return FALSE;
191  }
192 
193  ret = memcmp(pFileDetails, pContext->pFileDetails, dwSize);
194  if (!ret)
195  {
196  pContext->hDeletedFile = hDeletedFile;
197  pContext->bFound = TRUE;
198  }
199  else
200  CloseRecycleBinHandle(hDeletedFile);
201 
202  SHFree(pFileDetails);
203  return ret;
204 }
205 
206 static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
207 {
209 
210  if (pdata && pdata->type == 0x00)
211  return (PIDLRecycleStruct*) & (pdata->u.crecycle);
212 
213  return NULL;
214 }
215 
217 {
218 }
219 
221 {
222 }
223 
225 {
226  WCHAR szDrive[8];
227  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
228  {
229  ERR("GetEnvironmentVariableW failed\n");
230  return E_FAIL;
231  }
232  PathAddBackslashW(szDrive);
233 
234  if (dwFlags & SHCONTF_NONFOLDERS)
235  {
236  TRACE("Starting Enumeration\n");
237 
238  if (!EnumerateRecycleBinW(szDrive, CBEnumRecycleBin, this))
239  {
240  WARN("Error: EnumerateCRecycleBinW failed\n");
241  return E_FAIL;
242  }
243  }
244  else
245  {
246  // do nothing
247  }
248  return S_OK;
249 }
250 
252 {
253  PIDLDATA tmp;
254  LPITEMIDLIST pidl;
255  PIDLRecycleStruct * p;
256  int size0 = (char*)&tmp.u.crecycle.szName - (char*)&tmp.u.crecycle;
257  int size = size0;
258 
259  tmp.type = 0x00;
260  size += (wcslen(pFileDetails->FileName) + 1) * sizeof(WCHAR);
261 
262  pidl = (LPITEMIDLIST)SHAlloc(size + 4);
263  if (!pidl)
264  return pidl;
265 
266  pidl->mkid.cb = size + 2;
267  memcpy(pidl->mkid.abID, &tmp, 2 + size0);
268 
269  p = &((PIDLDATA*)pidl->mkid.abID)->u.crecycle;
270  RtlCopyMemory(p, pFileDetails, sizeof(DELETED_FILE_DETAILS_W));
271  wcscpy(p->szName, pFileDetails->FileName);
272  *(WORD*)((char*)pidl + (size + 2)) = 0;
273  return pidl;
274 }
275 
277 {
278  return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
279 }
280 
282 {
283  PDELETED_FILE_DETAILS_W pFileDetails;
284  DWORD dwSize;
285  LPITEMIDLIST pidl = NULL;
286  BOOL ret;
287 
288  if (!GetDeletedFileDetailsW(hDeletedFile,
289  0,
290  NULL,
291  &dwSize) &&
293  {
294  ERR("GetDeletedFileDetailsW failed\n");
295  return FALSE;
296  }
297 
298  pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize);
299  if (!pFileDetails)
300  {
301  ERR("No memory\n");
302  return FALSE;
303  }
304 
305  if (!GetDeletedFileDetailsW(hDeletedFile,
306  dwSize,
307  pFileDetails,
308  NULL))
309  {
310  ERR("GetDeletedFileDetailsW failed\n");
311  SHFree(pFileDetails);
312  return FALSE;
313  }
314 
315  pidl = _ILCreateRecycleItem(pFileDetails);
316  if (!pidl)
317  {
318  SHFree(pFileDetails);
319  return FALSE;
320  }
321 
322  ret = AddToEnumList(pidl);
323 
324  if (!ret)
325  SHFree(pidl);
326  SHFree(pFileDetails);
327  TRACE("Returning %d\n", ret);
328  CloseRecycleBinHandle(hDeletedFile);
329  return ret;
330 }
331 
332 /**************************************************************************
333 * IContextMenu2 Bitbucket Item Implementation
334 */
335 
337 {
338  apidl = NULL;
339 }
340 
342 {
343  ILFree(apidl);
344 }
345 
347 {
348  apidl = ILClone(pidl);
349  if (apidl == NULL)
350  return E_OUTOFMEMORY;
351  return S_OK;
352 }
353 
355 {
356  WCHAR szBuffer[30] = {0};
357  ULONG Count = 1;
358 
359  TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
360 
361  if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, _countof(szBuffer)))
362  {
363  szBuffer[_countof(szBuffer)-1] = L'\0';
364  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
365  Count++;
366  }
367 
368  if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, _countof(szBuffer)))
369  {
370  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
371  szBuffer[_countof(szBuffer)-1] = L'\0';
372  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
373  }
374 
375  if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, _countof(szBuffer)))
376  {
377  szBuffer[_countof(szBuffer)-1] = L'\0';
378  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
379  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
380  }
381 
382  if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, _countof(szBuffer)))
383  {
384  szBuffer[_countof(szBuffer)-1] = L'\0';
385  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
386  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
387  }
388 
389  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
390 }
391 
393 {
395  WCHAR szDrive[8];
396 
397  TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
398 
399  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb == MAKEINTRESOURCEA(5))
400  {
401  Context.pFileDetails = _ILGetRecycleStruct(apidl);
402  Context.bFound = FALSE;
403 
404  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
405  {
406  ERR("GetEnvironmentVariableW failed\n");
407  return E_FAIL;
408  }
409  PathAddBackslashW(szDrive);
410 
412  if (!Context.bFound)
413  return E_FAIL;
414 
415  BOOL ret = TRUE;
416 
417  /* restore file */
418  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
419  ret = RestoreFile(Context.hDeletedFile);
420  /* delete file */
421  else
423 
424  CloseRecycleBinHandle(Context.hDeletedFile);
425 
426  return (ret ? S_OK : E_FAIL);
427  }
428  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3))
429  {
430  FIXME("implement cut\n");
431  return E_NOTIMPL;
432  }
433  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7))
434  {
435  FIXME("implement properties\n");
436  return E_NOTIMPL;
437  }
438 
439  return S_OK;
440 }
441 
443 {
444  TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
445 
446  return E_FAIL;
447 }
448 
450 {
451  TRACE("CRecycleBin_IContextMenu2Item_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
452 
453  return E_NOTIMPL;
454 }
455 
457 {
458  pidl = NULL;
459 }
460 
462 {
463  SHFree(pidl);
464 }
465 
466 /*************************************************************************
467  * RecycleBin IPersistFolder2 interface
468  */
469 
471 {
472  TRACE("(%p, %p)\n", this, pClassID);
473  if (pClassID == NULL)
474  return E_INVALIDARG;
475  memcpy(pClassID, &CLSID_RecycleBin, sizeof(CLSID));
476  return S_OK;
477 }
478 
480 {
481  TRACE("(%p, %p)\n", this, pidl);
482 
483  SHFree((LPVOID)this->pidl);
484  this->pidl = ILClone(pidl);
485  if (this->pidl == NULL)
486  return E_OUTOFMEMORY;
487  return S_OK;
488 }
489 
491 {
492  TRACE("\n");
493  *ppidl = ILClone(pidl);
494  return S_OK;
495 }
496 
497 /*************************************************************************
498  * RecycleBin IShellFolder2 interface
499  */
500 
502  LPOLESTR pszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl,
503  ULONG *pdwAttributes)
504 {
505  FIXME("stub\n");
506  return E_NOTIMPL;
507 }
508 
509 
512 {
513  return (PDELETED_FILE_DETAILS_W)&pidl->mkid.abID;
514 }
515 
516 HRESULT WINAPI CRecycleBin::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
517 {
518  return ShellObjectCreatorInit<CRecycleBinEnum>(dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
519 }
520 
522 {
523  FIXME("(%p, %p, %p, %s, %p) - stub\n", this, pidl, pbc, debugstr_guid(&riid), ppv);
524  return E_NOTIMPL;
525 }
526 
528 {
529  FIXME("(%p, %p, %p, %s, %p) - stub\n", this, pidl, pbc, debugstr_guid(&riid), ppv);
530  return E_NOTIMPL;
531 }
532 
534 {
535  PIDLRecycleStruct* pData1 = _ILGetRecycleStruct(pidl1);
536  PIDLRecycleStruct* pData2 = _ILGetRecycleStruct(pidl2);
537  LPWSTR pName1, pName2;
538 
539  if(!pData1 || !pData2 || LOWORD(lParam) >= COLUMNS_COUNT)
540  return E_INVALIDARG;
541 
542  SHORT result;
543  LONGLONG diff;
544  switch (LOWORD(lParam))
545  {
546  case 0: /* Name */
547  pName1 = PathFindFileNameW(pData1->szName);
548  pName2 = PathFindFileNameW(pData2->szName);
549  result = wcsicmp(pName1, pName2);
550  break;
551  case 1: /* Orig. Location */
552  result = wcsicmp(pData1->szName, pData2->szName);
553  break;
554  case 2: /* Date Deleted */
555  result = CompareFileTime(&pData1->DeletionTime, &pData2->DeletionTime);
556  break;
557  case 3: /* Size */
558  diff = pData1->FileSize.QuadPart - pData2->FileSize.QuadPart;
559  return MAKE_COMPARE_HRESULT(diff);
560  case 4: /* Type */
561  pName1 = PathFindExtensionW(pData1->szName);
562  pName2 = PathFindExtensionW(pData2->szName);
563  result = wcsicmp(pName1, pName2);
564  break;
565  case 5: /* Modified */
566  result = CompareFileTime(&pData1->LastModification, &pData2->LastModification);
567  break;
568  }
570 }
571 
573 {
574  CComPtr<IShellView> pShellView;
576 
577  TRACE("(%p, %p, %s, %p)\n", this, hwndOwner, debugstr_guid(&riid), ppv);
578 
579  if (!ppv)
580  return hr;
581 
582  *ppv = NULL;
583 
584  if (IsEqualIID (riid, IID_IDropTarget))
585  {
587  }
588  else if (IsEqualIID (riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2))
589  {
590  hr = this->QueryInterface(riid, ppv);
591  }
592  else if (IsEqualIID (riid, IID_IShellView))
593  {
594  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
595  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppv);
596  }
597  else
598  return hr;
599 
600  TRACE ("-- (%p)->(interface=%p)\n", this, ppv);
601  return hr;
602 
603 }
604 
606  SFGAOF *rgfInOut)
607 {
608  TRACE("(%p, %d, {%p, ...}, {%x})\n", this, cidl, apidl ? apidl[0] : NULL, (unsigned int)*rgfInOut);
609  *rgfInOut &= SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
610  return S_OK;
611 }
612 
614  REFIID riid, UINT *prgfInOut, void **ppv)
615 {
616  LPVOID pObj = NULL;
618 
619  TRACE ("(%p)->(%p,%u,apidl=%p, %p %p)\n", this,
620  hwndOwner, cidl, apidl, prgfInOut, ppv);
621 
622  if (!ppv)
623  return hr;
624 
625  *ppv = NULL;
626 
627  if ((IsEqualIID (riid, IID_IContextMenu) || IsEqualIID(riid, IID_IContextMenu2)) && (cidl >= 1))
628  {
629  hr = ShellObjectCreatorInit<CRecycleBinItemContextMenu>(apidl[0], riid, &pObj);
630  }
631  else if((IsEqualIID(riid, IID_IExtractIconA) || IsEqualIID(riid, IID_IExtractIconW)) && (cidl == 1))
632  {
633  hr = CRecyclerExtractIcon_CreateInstance(apidl[0], riid, &pObj);
634  }
635  else
636  hr = E_NOINTERFACE;
637 
638  if (SUCCEEDED(hr) && !pObj)
639  hr = E_OUTOFMEMORY;
640 
641  *ppv = pObj;
642  TRACE ("(%p)->hr=0x%08x\n", this, hr);
643  return hr;
644 }
645 
647 {
648  PIDLRecycleStruct *pFileDetails;
649  LPWSTR pFileName;
650 
651  TRACE("(%p, %p, %x, %p)\n", this, pidl, (unsigned int)uFlags, pName);
652 
653  pFileDetails = _ILGetRecycleStruct(pidl);
654  if (!pFileDetails)
655  {
656  pName->cStr[0] = 0;
657  pName->uType = STRRET_CSTR;
658  return E_INVALIDARG;
659  }
660 
661  pFileName = wcsrchr(pFileDetails->szName, L'\\');
662  if (!pFileName)
663  {
664  pName->cStr[0] = 0;
665  pName->uType = STRRET_CSTR;
666  return E_UNEXPECTED;
667  }
668 
669  pName->pOleStr = StrDupW(pFileName + 1);
670  if (pName->pOleStr == NULL)
671  return E_OUTOFMEMORY;
672 
673  pName->uType = STRRET_WSTR;
674  return S_OK;
675 }
676 
678  SHGDNF uFlags, PITEMID_CHILD *ppidlOut)
679 {
680  TRACE("\n");
681  return E_FAIL; /* not supported */
682 }
683 
685 {
686  FIXME("stub\n");
687  return E_NOTIMPL;
688 }
689 
691 {
692  FIXME("stub\n");
693  *ppEnum = NULL;
694  return E_NOTIMPL;
695 }
696 
698 {
699  TRACE("(%p, %x, %p, %p)\n", this, (unsigned int)dwReserved, pSort, pDisplay);
700  if (pSort)
701  *pSort = 0;
702  if (pDisplay)
703  *pDisplay = 0;
704  return S_OK;
705 }
706 
708 {
709  TRACE("(%p, %d, %p)\n", this, iColumn, pcsFlags);
710  if (iColumn >= COLUMNS_COUNT)
711  return E_INVALIDARG;
712  *pcsFlags = RecycleBinColumns[iColumn].pcsFlags;
713  return S_OK;
714 }
715 
717 {
718  FIXME("stub\n");
719  return E_NOTIMPL;
720 }
721 
723 {
724  FILETIME lft;
726  int ret;
727 
728  FileTimeToLocalFileTime(ft, &lft);
729  FileTimeToSystemTime(&lft, &time);
730 
732  if (ret > 0 && ret < size)
733  {
734  /* Append space + time without seconds */
735  buffer[ret-1] = ' ';
737  }
738 
739  return (ret != 0 ? E_FAIL : S_OK);
740 }
741 
743 {
744  PIDLRecycleStruct * pFileDetails;
746  WCHAR szTypeName[100];
747  LPWSTR pszBackslash;
748  UINT Length;
749 
750  TRACE("(%p, %p, %d, %p)\n", this, pidl, iColumn, pDetails);
751  if (iColumn >= COLUMNS_COUNT)
752  return E_FAIL;
753  pDetails->fmt = RecycleBinColumns[iColumn].fmt;
754  pDetails->cxChar = RecycleBinColumns[iColumn].cxChars;
755  if (pidl == NULL)
756  return SHSetStrRet(&pDetails->str, RecycleBinColumns[iColumn].column_name_id);
757 
758  if (iColumn == COLUMN_NAME)
759  return GetDisplayNameOf(pidl, SHGDN_NORMAL, &pDetails->str);
760 
761  pFileDetails = _ILGetRecycleStruct(pidl);
762  switch (iColumn)
763  {
764  case COLUMN_DATEDEL:
765  FormatDateTime(buffer, MAX_PATH, &pFileDetails->DeletionTime);
766  break;
767  case COLUMN_DELFROM:
768  pszBackslash = wcsrchr(pFileDetails->szName, L'\\');
769  Length = (pszBackslash - pFileDetails->szName);
770  memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR));
771  buffer[Length] = L'\0';
772  break;
773  case COLUMN_SIZE:
774  StrFormatKBSizeW(pFileDetails->FileSize.QuadPart, buffer, MAX_PATH);
775  break;
776  case COLUMN_MTIME:
777  FormatDateTime(buffer, MAX_PATH, &pFileDetails->LastModification);
778  break;
779  case COLUMN_TYPE:
780  {
782  Context.pFileDetails = pFileDetails;
783  Context.bFound = FALSE;
785 
786  if (Context.bFound)
787  {
789 
790  CloseRecycleBinHandle(Context.hDeletedFile);
791  }
792  /* load localized file string */
794  {
796  }
797 
798  return SHSetStrRet(&pDetails->str, buffer);
799  }
800  default:
801  return E_FAIL;
802  }
803 
804  return SHSetStrRet(&pDetails->str, buffer);
805 }
806 
808 {
809  TRACE("(%p, %d, %p)\n", this, iColumn, pscid);
810  if (iColumn >= COLUMNS_COUNT)
811  return E_INVALIDARG;
812  pscid->fmtid = *RecycleBinColumns[iColumn].fmtId;
813  pscid->pid = RecycleBinColumns[iColumn].pid;
814  return S_OK;
815 }
816 
818 {
819  CComPtr<IEnumIDList> spEnumFiles;
821  if (FAILED(hr))
822  return TRUE;
823  CComHeapPtr<ITEMIDLIST> spPidl;
824  ULONG itemcount;
825  return spEnumFiles->Next(1, &spPidl, &itemcount) != S_OK;
826  }
827 
828 /*************************************************************************
829  * RecycleBin IContextMenu interface
830  */
831 
832 HRESULT WINAPI CRecycleBin::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
833 {
834  WCHAR szBuffer[100];
835  MENUITEMINFOW mii;
836  int id = 1;
837 
838  TRACE("QueryContextMenu %p %p %u %u %u %u\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags );
839 
840  if (!hMenu)
841  return E_INVALIDARG;
842 
843  ZeroMemory(&mii, sizeof(mii));
844  mii.cbSize = sizeof(mii);
845  mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
847  szBuffer[0] = L'\0';
849  mii.dwTypeData = szBuffer;
850  mii.cch = wcslen(mii.dwTypeData);
851  mii.wID = idCmdFirst + id++;
852  mii.fType = MFT_STRING;
853  iIdEmpty = 1;
854 
855  if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii))
856  return E_FAIL;
857 
858  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id);
859 }
860 
862 {
863  HRESULT hr;
864  LPSHELLBROWSER lpSB;
865  IShellView * lpSV = NULL;
866  WCHAR szDrive[8];
867 
868  TRACE("%p %p verb %p\n", this, lpcmi, lpcmi->lpVerb);
869 
870  if (LOWORD(lpcmi->lpVerb) == iIdEmpty)
871  {
872  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
873  {
874  ERR("GetEnvironmentVariableW failed\n");
875  return E_FAIL;
876  }
877  PathAddBackslashW(szDrive);
878 
879  hr = SHEmptyRecycleBinW(lpcmi->hwnd, szDrive, 0);
880  TRACE("result %x\n", hr);
881  if (hr != S_OK)
882  return hr;
883 
884  lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0);
885  if (lpSB && SUCCEEDED(lpSB->QueryActiveShellView(&lpSV)))
886  lpSV->Refresh();
887  }
888  return S_OK;
889 }
890 
891 HRESULT WINAPI CRecycleBin::GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
892 {
893  FIXME("%p %lu %u %p %p %u\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
894 
895  return E_NOTIMPL;
896 }
897 
898 /*************************************************************************
899  * RecycleBin IShellPropSheetExt interface
900  */
901 
903 {
904  FIXME("%p %p %lu\n", this, pfnAddPage, lParam);
905 
906  return E_NOTIMPL;
907 }
908 
910 {
911  FIXME("%p %lu %p %lu\n", this, uPageID, pfnReplaceWith, lParam);
912 
913  return E_NOTIMPL;
914 }
915 
916 /*************************************************************************
917  * RecycleBin IShellExtInit interface
918  */
919 
921 {
922  TRACE("%p %p %p %p\n", this, pidlFolder, pdtobj, hkeyProgID );
923  return S_OK;
924 }
925 
931 BOOL
933 {
934  LONG ret;
935  DWORD dwNukeOnDelete, dwType, VolSerialNumber, MaxComponentLength;
936  DWORD FileSystemFlags, dwSize, dwDisposition;
937  HKEY hKey;
938  WCHAR szBuffer[10];
939  WCHAR szKey[150] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket\\Volume\\";
940 
941  if (wszPath[1] != L':')
942  {
943  /* path is UNC */
944  return FALSE;
945  }
946 
947  // Copy and retrieve the root path from get given string
948  WCHAR wszRootPathName[MAX_PATH];
949  StringCbCopyW(wszRootPathName, sizeof(wszRootPathName), wszPath);
950  PathStripToRootW(wszRootPathName);
951 
952  // Test to see if the drive is fixed (non removable)
953  if (GetDriveTypeW(wszRootPathName) != DRIVE_FIXED)
954  {
955  /* no bitbucket on removable media */
956  return FALSE;
957  }
958 
959  if (!GetVolumeInformationW(wszRootPathName, NULL, 0, &VolSerialNumber, &MaxComponentLength, &FileSystemFlags, NULL, 0))
960  {
961  ERR("GetVolumeInformationW failed with %u wszRootPathName=%s\n", GetLastError(), debugstr_w(wszRootPathName));
962  return FALSE;
963  }
964 
965  swprintf(szBuffer, L"%04X-%04X", LOWORD(VolSerialNumber), HIWORD(VolSerialNumber));
966  wcscat(szKey, szBuffer);
967 
968  if (RegCreateKeyExW(HKEY_CURRENT_USER, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dwDisposition) != ERROR_SUCCESS)
969  {
970  ERR("RegCreateKeyExW failed\n");
971  return FALSE;
972  }
973 
974  if (dwDisposition & REG_CREATED_NEW_KEY)
975  {
976  /* per default move to bitbucket */
977  dwNukeOnDelete = 0;
978  RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD));
979  /* per default unlimited size */
980  dwSize = -1;
981  RegSetValueExW(hKey, L"MaxCapacity", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD));
982  RegCloseKey(hKey);
983  return TRUE;
984  }
985  else
986  {
987  dwSize = sizeof(dwNukeOnDelete);
988  ret = RegQueryValueExW(hKey, L"NukeOnDelete", NULL, &dwType, (LPBYTE)&dwNukeOnDelete, &dwSize);
989  if (ret != ERROR_SUCCESS)
990  {
991  if (ret == ERROR_FILE_NOT_FOUND)
992  {
993  /* restore key and enable bitbucket */
994  dwNukeOnDelete = 0;
995  RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD));
996  }
997  RegCloseKey(hKey);
998  return TRUE;
999  }
1000  else if (dwNukeOnDelete)
1001  {
1002  /* do not delete to bitbucket */
1003  RegCloseKey(hKey);
1004  return FALSE;
1005  }
1006  /* FIXME
1007  * check if bitbucket is full
1008  */
1009  RegCloseKey(hKey);
1010  return TRUE;
1011  }
1012 }
1013 
1014 BOOL
1016 {
1017  TRACE("(%s)\n", debugstr_w(wszPath));
1018  return DeleteFileToRecycleBin(wszPath);
1019 }
1020 
1021 /*************************************************************************
1022  * SHUpdateCRecycleBinIcon [SHELL32.@]
1023  *
1024  * Undocumented
1025  */
1027 {
1028  FIXME("stub\n");
1029 
1030  return S_OK;
1031 }
1032 
1033 /*************************************************************************
1034  * SHEmptyRecycleBinA (SHELL32.@)
1035  */
1037 {
1038  LPWSTR szRootPathW = NULL;
1039  int len;
1040  HRESULT hr;
1041 
1042  TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_a(pszRootPath), dwFlags);
1043 
1044  if (pszRootPath)
1045  {
1046  len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0);
1047  if (len == 0)
1048  return HRESULT_FROM_WIN32(GetLastError());
1049  szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1050  if (!szRootPathW)
1051  return E_OUTOFMEMORY;
1052  if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0)
1053  {
1054  HeapFree(GetProcessHeap(), 0, szRootPathW);
1055  return HRESULT_FROM_WIN32(GetLastError());
1056  }
1057  }
1058 
1059  hr = SHEmptyRecycleBinW(hwnd, szRootPathW, dwFlags);
1060  HeapFree(GetProcessHeap(), 0, szRootPathW);
1061 
1062  return hr;
1063 }
1064 
1066 {
1067  WCHAR szPath[MAX_PATH] = {0}, szBuffer[MAX_PATH];
1068  DWORD dwSize, dwType, count;
1069  LONG ret;
1070  IShellFolder *pDesktop, *pRecycleBin;
1071  PIDLIST_ABSOLUTE pidlRecycleBin;
1072  PITEMID_CHILD pidl;
1073  HRESULT hr = S_OK;
1074  LPENUMIDLIST penumFiles;
1075  STRRET StrRet;
1076 
1077  TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags);
1078 
1079  if (!(dwFlags & SHERB_NOCONFIRMATION))
1080  {
1081  hr = SHGetDesktopFolder(&pDesktop);
1082  if (FAILED(hr))
1083  return hr;
1084  hr = SHGetFolderLocation(NULL, CSIDL_BITBUCKET, NULL, 0, &pidlRecycleBin);
1085  if (FAILED(hr))
1086  {
1087  pDesktop->Release();
1088  return hr;
1089  }
1090  hr = pDesktop->BindToObject(pidlRecycleBin, NULL, IID_PPV_ARG(IShellFolder, &pRecycleBin));
1091  CoTaskMemFree(pidlRecycleBin);
1092  pDesktop->Release();
1093  if (FAILED(hr))
1094  return hr;
1095  hr = pRecycleBin->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penumFiles);
1096  if (FAILED(hr))
1097  {
1098  pRecycleBin->Release();
1099  return hr;
1100  }
1101 
1102  count = 0;
1103  if (hr != S_FALSE)
1104  {
1105  while (penumFiles->Next(1, &pidl, NULL) == S_OK)
1106  {
1107  count++;
1108  pRecycleBin->GetDisplayNameOf(pidl, SHGDN_NORMAL, &StrRet);
1109  StrRetToBuf(&StrRet, pidl, szBuffer, _countof(szBuffer));
1110  CoTaskMemFree(pidl);
1111  }
1112  penumFiles->Release();
1113  }
1114  pRecycleBin->Release();
1115 
1116  switch (count)
1117  {
1118  case 0:
1119  /* no files, don't need confirmation */
1120  break;
1121 
1122  case 1:
1123  /* we have only one item inside the bin, so show a message box with its name */
1125  MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO)
1126  {
1127  return S_OK;
1128  }
1129  break;
1130 
1131  default:
1132  /* we have more than one item, so show a message box with the count of the items */
1133  StringCbPrintfW(szBuffer, sizeof(szBuffer), L"%u", count);
1135  MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO)
1136  {
1137  return S_OK;
1138  }
1139  break;
1140  }
1141  }
1142 
1144  {
1145  ret = EmptyRecycleBinW(pszRootPath);
1146  }
1147  else
1148  {
1149  /* FIXME
1150  * show a progress dialog
1151  */
1152  ret = EmptyRecycleBinW(pszRootPath);
1153  }
1154 
1155  if (!ret)
1156  return HRESULT_FROM_WIN32(GetLastError());
1157 
1158  if (!(dwFlags & SHERB_NOSOUND))
1159  {
1160  dwSize = sizeof(szPath);
1162  L"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current",
1163  NULL,
1164  RRF_RT_REG_SZ,
1165  &dwType,
1166  (PVOID)szPath,
1167  &dwSize);
1168  if (ret != ERROR_SUCCESS)
1169  return S_OK;
1170 
1171  if (dwType != REG_EXPAND_SZ) /* type dismatch */
1172  return S_OK;
1173 
1174  szPath[_countof(szPath)-1] = L'\0';
1176  }
1177  return S_OK;
1178 }
1179 
1181 {
1182  LPWSTR szRootPathW = NULL;
1183  int len;
1184  HRESULT hr;
1185 
1186  TRACE("%s, %p\n", debugstr_a(pszRootPath), pSHQueryRBInfo);
1187 
1188  if (pszRootPath)
1189  {
1190  len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0);
1191  if (len == 0)
1192  return HRESULT_FROM_WIN32(GetLastError());
1193  szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1194  if (!szRootPathW)
1195  return E_OUTOFMEMORY;
1196  if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0)
1197  {
1198  HeapFree(GetProcessHeap(), 0, szRootPathW);
1199  return HRESULT_FROM_WIN32(GetLastError());
1200  }
1201  }
1202 
1203  hr = SHQueryRecycleBinW(szRootPathW, pSHQueryRBInfo);
1204  HeapFree(GetProcessHeap(), 0, szRootPathW);
1205 
1206  return hr;
1207 }
1208 
1210 {
1211  FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
1212 
1213  if (!(pszRootPath) || (pszRootPath[0] == 0) ||
1214  !(pSHQueryRBInfo) || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO)))
1215  {
1216  return E_INVALIDARG;
1217  }
1218 
1219  pSHQueryRBInfo->i64Size = 0;
1220  pSHQueryRBInfo->i64NumItems = 0;
1221 
1222  return S_OK;
1223 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define PID_STG_WRITETIME
Definition: ntquery.h:60
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_CUT
Definition: shresdef.h:223
#define IN
Definition: typedefs.h:39
#define MFT_STRING
Definition: winuser.h:741
DWORD cbSize
Definition: shellapi.h:377
#define REFIID
Definition: guiddef.h:118
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
HRESULT Refresh()
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
interface IBindCtx * LPBC
Definition: objfwd.h:18
virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL AddToEnumList(LPITEMIDLIST pidl)
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
#define CP_ACP
Definition: compat.h:109
#define LOCALE_USER_DEFAULT
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define DATE_SHORTDATE
Definition: winnls.h:196
GLuint GLuint GLsizei count
Definition: gl.h:1545
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
#define COLUMN_MTIME
Definition: CRecycleBin.cpp:57
virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
#define WARN(fmt,...)
Definition: debug.h:112
#define IDS_RESTORE
Definition: shresdef.h:224
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
LPITEMIDLIST pidl
Definition: CRecycleBin.h:39
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
REFIID LPVOID * ppv
Definition: atlbase.h:39
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
#define IDS_SHV_COLUMN_DELFROM
Definition: shresdef.h:60
#define MFS_DISABLED
Definition: winuser.h:744
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define RRF_RT_REG_SZ
Definition: driver.c:575
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1664
#define COLUMN_DELFROM
Definition: CRecycleBin.cpp:53
GLuint buffer
Definition: glext.h:5915
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
PDELETED_FILE_DETAILS_W UnpackDetailsFromPidl(LPCITEMIDLIST pidl)
#define PID_STG_NAME
Definition: ntquery.h:56
LPWSTR dwTypeData
Definition: winuser.h:3249
#define CSIDL_BITBUCKET
Definition: shlobj.h:2022
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:546
UINT_PTR WPARAM
Definition: windef.h:207
static HRESULT FormatDateTime(LPWSTR buffer, int size, FILETIME *ft)
BOOL RecycleBinIsEmpty()
__u16 time
Definition: mkdosfs.c:366
#define IDS_PROPERTIES
Definition: resource.h:101
#define swprintf
Definition: precomp.h:40
UINT uFlags
Definition: api.c:59
#define MFS_DEFAULT
Definition: winuser.h:743
char * LPSTR
Definition: xmlstorage.h:182
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
HRESULT CRecyclerExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CRecycleBin.cpp:76
static LPOLESTR
Definition: stg_prop.c:27
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3791
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1089
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
STRRET str
Definition: shtypes.idl:108
BOOL WINAPI GetDeletedFileDetailsW(IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:327
WPARAM wParam
Definition: combotst.c:138
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:75
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HANDLE hDeletedFile)
Definition: recyclebin.c:93
#define IDS_SHV_COLUMN_SIZE
Definition: shresdef.h:52
#define COLUMNS_COUNT
Definition: CRecycleBin.cpp:59
HRESULT WINAPI Initialize(LPCITEMIDLIST pidl)
#define L(x)
Definition: ntvdm.h:50
struct _SEARCH_CONTEXT SEARCH_CONTEXT
unsigned char * LPBYTE
Definition: typedefs.h:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define MFS_ENABLED
Definition: winuser.h:745
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
#define StrRetToBuf
Definition: shlwapi.h:1769
virtual HRESULT WINAPI GetCurFolder(PIDLIST_ABSOLUTE *pidl)
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
HRESULT EnumObjects([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
#define FIXME(fmt,...)
Definition: debug.h:111
const GUID * fmtId
Definition: CRecycleBin.cpp:33
#define StrRet
Definition: shellclasses.h:871
#define IDS_SHV_COLUMN_DELDATE
Definition: shresdef.h:61
ULONG Release()
#define S_FALSE
Definition: winerror.h:2357
#define IDS_ANY_FILE
Definition: shresdef.h:180
#define E_INVALIDARG
Definition: ddrawi.h:101
virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define PID_DISPLACED_FROM
Definition: shlguid.h:181
_Reserved_ DWORD _In_ DWORD _Out_ DWORD _Out_writes_bytes_to_opt_ pcbTypeName LPSTR szTypeName
Definition: wincrypt.h:4283
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
const char * LPCSTR
Definition: xmlstorage.h:183
struct _SFV_CREATE SFV_CREATE
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define debugstr_guid
Definition: kernel32.h:35
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PROTOCOLDATA * pdata
Definition: protocol.c:158
#define PID_STG_SIZE
Definition: ntquery.h:58
WCHAR FileName[ANY_SIZE]
Definition: recyclebin.h:40
#define MIIM_ID
Definition: winuser.h:717
#define IDS_DELETEITEM_TEXT
Definition: shresdef.h:124
#define DeleteFileToRecycleBin
Definition: recyclebin.h:82
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
__int64 i64Size
Definition: shellapi.h:378
#define KEY_WRITE
Definition: nt_native.h:1031
virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
int64_t LONGLONG
Definition: typedefs.h:68
int Count
Definition: noreturn.cpp:7
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
#define TRACE(s)
Definition: solgame.cpp:4
virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum)
virtual HRESULT WINAPI Initialize(PCIDLIST_ABSOLUTE pidl)
static LPSTR pName
Definition: security.c:75
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
EXTERN_C HRESULT WINAPI SHUpdateRecycleBinIcon(void)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
#define debugstr_a
Definition: kernel32.h:31
virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
LONG HRESULT
Definition: typedefs.h:79
#define COLUMN_NAME
Definition: CRecycleBin.cpp:52
#define _countof(array)
Definition: sndvol32.h:68
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI RestoreFile(IN HANDLE hDeletedFile)
Definition: recyclebin.c:392
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPARAM LPFNSVADDPROPSHEETPAGE
Definition: shobjidl.idl:117
HRESULT WINAPI Initialize(DWORD dwFlags)
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define SHERB_NOSOUND
Definition: shellapi.h:396
virtual HRESULT WINAPI ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam)
#define MFT_SEPARATOR
Definition: winuser.h:739
static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
#define wcsicmp
Definition: compat.h:15
int ret
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
BOOL WINAPI GetDeletedFileTypeNameW(IN HANDLE hDeletedFile, OUT LPWSTR pTypeName, IN DWORD BufferSize, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:256
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const columninfo RecycleBinColumns[]
Definition: CRecycleBin.cpp:40
LPWSTR WINAPI StrFormatKBSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:1743
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MIIM_TYPE
Definition: winuser.h:720
virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
BOOL WINAPI EmptyRecycleBinW(IN LPCWSTR pszRoot OPTIONAL)
Definition: recyclebin.c:145
HRESULT CRecyclerDropTarget_CreateInstance(REFIID riid, LPVOID *ppvOut)
virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define IDS_DELETEMULTIPLE_TEXT
Definition: shresdef.h:125
virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
#define wcsrchr
Definition: compat.h:16
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define IDS_EMPTY_BITBUCKET
Definition: shresdef.h:182
#define IDS_SHV_COLUMN_MODIFIED
Definition: shresdef.h:54
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define DRIVE_FIXED
Definition: winbase.h:249
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
#define PID_DISPLACED_DATE
Definition: shlguid.h:182
struct _SEARCH_CONTEXT * PSEARCH_CONTEXT
#define COLUMN_SIZE
Definition: CRecycleBin.cpp:55
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
#define SND_FILENAME
Definition: mmsystem.h:162
#define COLUMN_TYPE
Definition: CRecycleBin.cpp:56
#define S_OK
Definition: intsafe.h:52
#define shell32_hInstance
HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags)
FxAutoRegKey hKey
LPCWSTR szPath
Definition: env.c:37
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
BOOL TRASH_TrashFile(LPCWSTR wszPath)
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SHERB_NOCONFIRMATION
Definition: shellapi.h:394
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define ShellMessageBoxW
Definition: precomp.h:59
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
#define CWM_GETISHELLBROWSER
Definition: undocshell.h:201
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
virtual HRESULT WINAPI GetClassID(CLSID *pClassID)
WINE_DEFAULT_DEBUG_CHANNEL(CRecycleBin)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MultiByteToWideChar
Definition: compat.h:110
#define E_UNEXPECTED
Definition: winerror.h:2456
virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags)
#define MB_DEFBUTTON2
Definition: winuser.h:793
struct tagContext Context
Definition: acpixf.h:1034
virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
int column_name_id
Definition: CRecycleBin.cpp:32
virtual HRESULT WINAPI AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2883
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
#define TIME_NOSECONDS
Definition: winnls.h:278
#define IDS_DELETE
Definition: resource.h:40
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDNO
Definition: winuser.h:830
#define END_COM_MAP()
Definition: atlcom.h:553
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
__int64 i64NumItems
Definition: shellapi.h:379
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define EXTERN_C
Definition: basetyps.h:12
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:614
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
#define REG_DWORD
Definition: sdbapi.c:596
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
#define LOWORD(l)
Definition: pedump.c:82
#define SHERB_NOPROGRESSUI
Definition: shellapi.h:395
#define COLUMN_DATEDEL
Definition: CRecycleBin.cpp:54
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
#define HeapFree(x, y, z)
Definition: compat.h:594
virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
#define RegCloseKey(hKey)
Definition: registry.h:40
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD SHGDNF
Definition: shobjidl.idl:169
PIDLRecycleStruct * pFileDetails
Definition: CRecycleBin.cpp:71
BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:531