ReactOS 0.4.15-dev-8207-gd73a838
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
30typedef struct
31{
33 const GUID *fmtId;
36 int fmt;
39
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
65BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HDELFILE hDeletedFile);
66
67static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl);
68
69typedef struct _SEARCH_CONTEXT
70{
71 PIDLRecycleStruct *pFileDetails;
72 HDELFILE hDeletedFile;
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
103fallback:
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;
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:
125 static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HDELFILE hDeletedFile);
126 BOOL WINAPI CBEnumRecycleBin(IN HDELFILE hDeletedFile);
127
129 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
131};
132
134 public CComObjectRootEx<CComMultiThreadModelNoCS>,
135 public IContextMenu2
136{
137 private:
139 public:
143
144 // IContextMenu
145 STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
147 STDMETHOD(GetCommandString)(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
148
149 // IContextMenu2
151
153 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
154 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
156};
157
159{
161
162 PDELETED_FILE_DETAILS_W pFileDetails;
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
206static 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;
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
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
516HRESULT 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
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
637
638 if (SUCCEEDED(hr) && !pObj)
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);
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
832HRESULT 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);
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
891HRESULT 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
931BOOL
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));
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 {
992 {
993 /* restore key and enable bitbucket */
994 dwNukeOnDelete = 0;
995 RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD));
996 }
998 return TRUE;
999 }
1000 else if (dwNukeOnDelete)
1001 {
1002 /* do not delete to bitbucket */
1004 return FALSE;
1005 }
1006 /* FIXME
1007 * check if bitbucket is full
1008 */
1010 return TRUE;
1011 }
1012}
1013
1014BOOL
1016{
1017 TRACE("(%s)\n", debugstr_w(wszPath));
1018 return DeleteFileToRecycleBin(wszPath);
1019}
1020
1022{
1023 CRegKey regKey;
1024 CHeapPtr<WCHAR> pszValue;
1025 CHeapPtr<WCHAR> pszSndPath;
1026 DWORD dwType, dwSize;
1027 LONG lError;
1028
1029 lError = regKey.Open(HKEY_CURRENT_USER,
1030 L"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current",
1031 KEY_READ);
1032 if (lError != ERROR_SUCCESS)
1033 return;
1034
1035 lError = regKey.QueryValue(NULL, &dwType, NULL, &dwSize);
1036 if (lError != ERROR_SUCCESS)
1037 return;
1038
1039 if (!pszValue.AllocateBytes(dwSize))
1040 return;
1041
1042 lError = regKey.QueryValue(NULL, &dwType, pszValue, &dwSize);
1043 if (lError != ERROR_SUCCESS)
1044 return;
1045
1046 if (dwType == REG_EXPAND_SZ)
1047 {
1048 dwSize = ExpandEnvironmentStringsW(pszValue, NULL, 0);
1049 if (dwSize == 0)
1050 return;
1051
1052 if (!pszSndPath.Allocate(dwSize))
1053 return;
1054
1055 if (ExpandEnvironmentStringsW(pszValue, pszSndPath, dwSize) == 0)
1056 return;
1057 }
1058 else if (dwType == REG_SZ)
1059 {
1060 /* The type is REG_SZ, no need to expand */
1061 pszSndPath.Attach(pszValue.Detach());
1062 }
1063 else
1064 {
1065 /* Invalid type */
1066 return;
1067 }
1068
1070}
1071
1072/*************************************************************************
1073 * SHUpdateCRecycleBinIcon [SHELL32.@]
1074 *
1075 * Undocumented
1076 */
1078{
1079 FIXME("stub\n");
1080
1081 // HACK! This dwItem2 should be the icon index in the system image list that has changed.
1082 // FIXME: Call SHMapPIDLToSystemImageListIndex
1083 DWORD dwItem2 = -1;
1084
1086 return S_OK;
1087}
1088
1089/*************************************************************************
1090 * SHEmptyRecycleBinA (SHELL32.@)
1091 */
1093{
1094 LPWSTR szRootPathW = NULL;
1095 int len;
1096 HRESULT hr;
1097
1098 TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_a(pszRootPath), dwFlags);
1099
1100 if (pszRootPath)
1101 {
1102 len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0);
1103 if (len == 0)
1105 szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1106 if (!szRootPathW)
1107 return E_OUTOFMEMORY;
1108 if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0)
1109 {
1110 HeapFree(GetProcessHeap(), 0, szRootPathW);
1112 }
1113 }
1114
1115 hr = SHEmptyRecycleBinW(hwnd, szRootPathW, dwFlags);
1116 HeapFree(GetProcessHeap(), 0, szRootPathW);
1117
1118 return hr;
1119}
1120
1122{
1123 WCHAR szBuffer[MAX_PATH];
1124 DWORD count;
1125 LONG ret;
1126 IShellFolder *pDesktop, *pRecycleBin;
1127 PIDLIST_ABSOLUTE pidlRecycleBin;
1128 PITEMID_CHILD pidl;
1129 HRESULT hr = S_OK;
1130 LPENUMIDLIST penumFiles;
1131 STRRET StrRet;
1132
1133 TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags);
1134
1136 {
1137 hr = SHGetDesktopFolder(&pDesktop);
1138 if (FAILED(hr))
1139 return hr;
1140 hr = SHGetFolderLocation(NULL, CSIDL_BITBUCKET, NULL, 0, &pidlRecycleBin);
1141 if (FAILED(hr))
1142 {
1143 pDesktop->Release();
1144 return hr;
1145 }
1146 hr = pDesktop->BindToObject(pidlRecycleBin, NULL, IID_PPV_ARG(IShellFolder, &pRecycleBin));
1147 CoTaskMemFree(pidlRecycleBin);
1148 pDesktop->Release();
1149 if (FAILED(hr))
1150 return hr;
1151 hr = pRecycleBin->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penumFiles);
1152 if (FAILED(hr))
1153 {
1154 pRecycleBin->Release();
1155 return hr;
1156 }
1157
1158 count = 0;
1159 if (hr != S_FALSE)
1160 {
1161 while (penumFiles->Next(1, &pidl, NULL) == S_OK)
1162 {
1163 count++;
1164 pRecycleBin->GetDisplayNameOf(pidl, SHGDN_NORMAL, &StrRet);
1165 StrRetToBuf(&StrRet, pidl, szBuffer, _countof(szBuffer));
1166 CoTaskMemFree(pidl);
1167 }
1168 penumFiles->Release();
1169 }
1170 pRecycleBin->Release();
1171
1172 switch (count)
1173 {
1174 case 0:
1175 /* no files, don't need confirmation */
1176 break;
1177
1178 case 1:
1179 /* we have only one item inside the bin, so show a message box with its name */
1182 {
1183 return S_OK;
1184 }
1185 break;
1186
1187 default:
1188 /* we have more than one item, so show a message box with the count of the items */
1189 StringCbPrintfW(szBuffer, sizeof(szBuffer), L"%u", count);
1192 {
1193 return S_OK;
1194 }
1195 break;
1196 }
1197 }
1198
1200 {
1201 ret = EmptyRecycleBinW(pszRootPath);
1202 }
1203 else
1204 {
1205 /* FIXME
1206 * show a progress dialog
1207 */
1208 ret = EmptyRecycleBinW(pszRootPath);
1209 }
1210
1211 if (!ret)
1213
1214 if (!(dwFlags & SHERB_NOSOUND))
1215 {
1217 }
1218 return S_OK;
1219}
1220
1222{
1223 LPWSTR szRootPathW = NULL;
1224 int len;
1225 HRESULT hr;
1226
1227 TRACE("%s, %p\n", debugstr_a(pszRootPath), pSHQueryRBInfo);
1228
1229 if (pszRootPath)
1230 {
1231 len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0);
1232 if (len == 0)
1234 szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1235 if (!szRootPathW)
1236 return E_OUTOFMEMORY;
1237 if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0)
1238 {
1239 HeapFree(GetProcessHeap(), 0, szRootPathW);
1241 }
1242 }
1243
1244 hr = SHQueryRecycleBinW(szRootPathW, pSHQueryRBInfo);
1245 HeapFree(GetProcessHeap(), 0, szRootPathW);
1246
1247 return hr;
1248}
1249
1251{
1252 TRACE("%s, %p\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
1253
1254 if (!pszRootPath || (pszRootPath[0] == 0) ||
1255 !pSHQueryRBInfo || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO)))
1256 {
1257 return E_INVALIDARG;
1258 }
1259
1260 pSHQueryRBInfo->i64Size = 0;
1261 pSHQueryRBInfo->i64NumItems = 0;
1262
1263 CComPtr<IRecycleBin> spRecycleBin;
1264 HRESULT hr;
1265 if (FAILED_UNEXPECTEDLY((hr = GetDefaultRecycleBin(pszRootPath, &spRecycleBin))))
1266 return hr;
1267
1268 CComPtr<IRecycleBinEnumList> spEnumList;
1269 hr = spRecycleBin->EnumObjects(&spEnumList);
1270 if (!SUCCEEDED(hr))
1271 return hr;
1272
1273 while (TRUE)
1274 {
1275 CComPtr<IRecycleBinFile> spFile;
1276 hr = spEnumList->Next(1, &spFile, NULL);
1277 if (hr == S_FALSE)
1278 return S_OK;
1279
1281 return hr;
1282
1283 ULARGE_INTEGER Size = {};
1284 if (FAILED_UNEXPECTEDLY((hr = spFile->GetFileSize(&Size))))
1285 return hr;
1286
1287 pSHQueryRBInfo->i64Size += Size.QuadPart;
1288 pSHQueryRBInfo->i64NumItems++;
1289 }
1290
1291 return S_OK;
1292}
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4372
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define COLUMN_SIZE
Definition: CRecycleBin.cpp:55
static HRESULT FormatDateTime(LPWSTR buffer, int size, FILETIME *ft)
static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
static const columninfo RecycleBinColumns[]
Definition: CRecycleBin.cpp:40
BOOL TRASH_TrashFile(LPCWSTR wszPath)
HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags)
BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HDELFILE hDeletedFile)
#define COLUMNS_COUNT
Definition: CRecycleBin.cpp:59
HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
EXTERN_C HRESULT WINAPI SHUpdateRecycleBinIcon(void)
#define COLUMN_MTIME
Definition: CRecycleBin.cpp:57
struct _SEARCH_CONTEXT * PSEARCH_CONTEXT
HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags)
HRESULT CRecyclerExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CRecycleBin.cpp:76
struct _SEARCH_CONTEXT SEARCH_CONTEXT
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
#define COLUMN_DATEDEL
Definition: CRecycleBin.cpp:54
PDELETED_FILE_DETAILS_W UnpackDetailsFromPidl(LPCITEMIDLIST pidl)
static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
#define COLUMN_DELFROM
Definition: CRecycleBin.cpp:53
static void TRASH_PlayEmptyRecycleBinSound()
HRESULT CRecyclerDropTarget_CreateInstance(REFIID riid, LPVOID *ppvOut)
#define shell32_hInstance
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define IDS_DELETE
Definition: resource.h:40
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
LPWSTR FormatDateTime(IN LPSYSTEMTIME pDateTime)
Definition: utils.c:41
#define IDS_PROPERTIES
Definition: resource.h:102
#define EXTERN_C
Definition: basetyps.h:12
#define STDMETHOD(m)
Definition: basetyps.h:62
#define FIXME(fmt,...)
Definition: debug.h:114
#define WARN(fmt,...)
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:113
#define RegCloseKey(hKey)
Definition: registry.h:49
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
BOOL AddToEnumList(LPITEMIDLIST pidl)
bool AllocateBytes(_In_ size_t nBytes)
Definition: atlalloc.h:127
T * Detach()
Definition: atlalloc.h:168
bool Allocate(_In_ size_t nElements=1)
Definition: atlalloc.h:143
void Attach(T *lp)
Definition: atlalloc.h:162
HRESULT WINAPI Initialize(DWORD dwFlags)
static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HDELFILE hDeletedFile)
STDMETHOD() QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
HRESULT WINAPI Initialize(LPCITEMIDLIST pidl)
STDMETHOD() GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
STDMETHOD() HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
LPITEMIDLIST pidl
Definition: CRecycleBin.h:39
STDMETHOD() AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
STDMETHOD() GetClassID(CLSID *pClassID) override
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
STDMETHOD() GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
STDMETHOD() GetCurFolder(PIDLIST_ABSOLUTE *pidl) override
STDMETHOD() ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam) override
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
STDMETHOD() ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidl) override
BOOL RecycleBinIsEmpty()
STDMETHOD() QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:75
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
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:1096
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
UINT uFlags
Definition: api.c:59
#define GetProcessHeap()
Definition: compat.h:736
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
#define wcsicmp
Definition: compat.h:15
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
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
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
#define ShellMessageBoxW
Definition: precomp.h:62
BOOL WINAPI RestoreFile(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:380
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
BOOL WINAPI CloseRecycleBinHandle(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:12
BOOL WINAPI GetDeletedFileTypeNameW(IN HDELFILE hDeletedFile, OUT LPWSTR pTypeName, IN DWORD BufferSize, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:256
BOOL WINAPI GetDeletedFileDetailsW(IN HDELFILE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:327
BOOL WINAPI EmptyRecycleBinW(IN LPCWSTR pszRoot OPTIONAL)
Definition: recyclebin.c:145
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:93
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:399
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3150
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
LPWSTR WINAPI StrFormatKBSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:1751
LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
Definition: string.c:1093
#define swprintf
Definition: precomp.h:40
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
FxAutoRegKey hKey
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
ULONG SFGAOF
Definition: shobjidl.idl:221
HRESULT EnumObjects([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
@ SHCONTF_NONFOLDERS
Definition: shobjidl.idl:174
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
DWORD SHGDNF
Definition: shobjidl.idl:169
HRESULT Refresh()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1093
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:993
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define END_COM_MAP()
Definition: atlcom.h:592
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define SND_FILENAME
Definition: mmsystem.h:162
#define SND_ASYNC
Definition: mmsystem.h:154
#define SND_NODEFAULT
Definition: mmsystem.h:155
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static LPSTR pName
Definition: security.c:75
static LPOLESTR
Definition: stg_prop.c:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static PROTOCOLDATA * pdata
Definition: protocol.c:158
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
unsigned int UINT
Definition: ndis.h:50
int Count
Definition: noreturn.cpp:7
#define KEY_READ
Definition: nt_native.h:1023
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define LOCALE_USER_DEFAULT
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define PID_STG_WRITETIME
Definition: ntquery.h:60
#define PID_STG_SIZE
Definition: ntquery.h:58
#define PID_STG_NAME
Definition: ntquery.h:56
#define L(x)
Definition: ntvdm.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define PathAddBackslashW
Definition: pathcch.h:301
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2228
BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:653
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define DeleteFileToRecycleBin
Definition: recyclebin.h:85
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_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 SHERB_NOSOUND
Definition: shellapi.h:398
#define SHERB_NOPROGRESSUI
Definition: shellapi.h:397
#define SHERB_NOCONFIRMATION
Definition: shellapi.h:396
#define StrRet
Definition: shellclasses.h:871
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:607
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define COLUMN_NAME
#define COLUMN_TYPE
HRESULT hr
Definition: shlfolder.c:183
#define PID_DISPLACED_FROM
Definition: shlguid.h:181
#define PID_DISPLACED_DATE
Definition: shlguid.h:182
#define SHCNE_UPDATEIMAGE
Definition: shlobj.h:1898
#define SHCNF_DWORD
Definition: shlobj.h:1917
struct _SFV_CREATE SFV_CREATE
#define CSIDL_BITBUCKET
Definition: shlobj.h:2176
#define StrRetToBuf
Definition: shlwapi.h:1769
LPARAM LPFNSVADDPROPSHEETPAGE
Definition: shobjidl.idl:117
#define IDS_SHV_COLUMN_DELFROM
Definition: shresdef.h:60
#define IDS_CUT
Definition: shresdef.h:229
#define IDS_RESTORE
Definition: shresdef.h:230
#define IDS_SHV_COLUMN_SIZE
Definition: shresdef.h:52
#define IDS_ANY_FILE
Definition: shresdef.h:186
#define IDS_SHV_COLUMN_MODIFIED
Definition: shresdef.h:54
#define IDS_DELETEITEM_TEXT
Definition: shresdef.h:126
#define IDS_EMPTY_BITBUCKET
Definition: shresdef.h:188
#define IDS_SHV_COLUMN_DELDATE
Definition: shresdef.h:61
#define IDS_DELETEMULTIPLE_TEXT
Definition: shresdef.h:127
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_WSTR
Definition: shtypes.idl:85
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
@ SHCOLSTATE_TYPE_INT
Definition: shtypes.idl:122
@ SHCOLSTATE_TYPE_DATE
Definition: shtypes.idl:123
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
STRRET str
Definition: shtypes.idl:108
WCHAR FileName[ANY_SIZE]
Definition: recyclebin.h:40
PIDLRecycleStruct * pFileDetails
Definition: CRecycleBin.cpp:71
HDELFILE hDeletedFile
Definition: CRecycleBin.cpp:72
__int64 i64Size
Definition: shellapi.h:380
__int64 i64NumItems
Definition: shellapi.h:381
DWORD cbSize
Definition: shellapi.h:379
const GUID * fmtId
Definition: CRecycleBin.cpp:33
int column_name_id
Definition: CRecycleBin.cpp:32
LPWSTR dwTypeData
Definition: winuser.h:3269
unsigned char * LPBYTE
Definition: typedefs.h:53
int64_t LONGLONG
Definition: typedefs.h:68
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define CWM_GETISHELLBROWSER
Definition: undocshell.h:205
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DRIVE_FIXED
Definition: winbase.h:252
_Reserved_ DWORD _In_ DWORD _Out_ DWORD _Out_writes_bytes_to_opt_ pcbTypeName LPSTR szTypeName
Definition: wincrypt.h:4283
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define E_UNEXPECTED
Definition: winerror.h:2456
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define TIME_NOSECONDS
Definition: winnls.h:278
#define DATE_SHORTDATE
Definition: winnls.h:196
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define MIIM_ID
Definition: winuser.h:722
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MFS_DISABLED
Definition: winuser.h:749
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_YESNO
Definition: winuser.h:817
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MIIM_STATE
Definition: winuser.h:721
#define MFS_DEFAULT
Definition: winuser.h:748
#define IDNO
Definition: winuser.h:836
#define MB_ICONEXCLAMATION
Definition: winuser.h:785
#define MFS_ENABLED
Definition: winuser.h:750
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define MB_DEFBUTTON2
Definition: winuser.h:799
#define MFT_STRING
Definition: winuser.h:746
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MIIM_TYPE
Definition: winuser.h:725
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
static void Initialize()
Definition: xlate.c:212
#define IID_PPV_ARG(Itype, ppType)
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185