ReactOS 0.4.15-dev-7942-gd23573b
CRecycleBinEnum Class Reference
Inheritance diagram for CRecycleBinEnum:
Collaboration diagram for CRecycleBinEnum:

Public Member Functions

 CRecycleBinEnum ()
 
 ~CRecycleBinEnum ()
 
HRESULT WINAPI Initialize (DWORD dwFlags)
 
BOOL WINAPI CBEnumRecycleBin (IN HANDLE hDeletedFile)
 
- Public Member Functions inherited from CEnumIDListBase
 CEnumIDListBase ()
 
virtual ~CEnumIDListBase ()
 
BOOL AddToEnumList (LPITEMIDLIST pidl)
 
BOOL DeleteList ()
 
BOOL HasItemWithCLSID (LPITEMIDLIST pidl)
 
HRESULT AppendItemsFromEnumerator (IEnumIDList *pEnum)
 
STDMETHOD() Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
 
STDMETHOD() Skip (ULONG celt) override
 
STDMETHOD() Reset () override
 
STDMETHOD() Clone (IEnumIDList **ppenum) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IEnumIDList
HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *rgelt, [out] ULONG *pceltFetched)
 
HRESULT Skip ([in] ULONG celt)
 
HRESULT Reset ()
 
HRESULT Clone ([out] IEnumIDList **ppenum)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Static Public Member Functions

static BOOL WINAPI CBEnumRecycleBin (IN PVOID Context, IN HANDLE hDeletedFile)
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 

Additional Inherited Members

- Public Types inherited from IEnumIDList
typedef IEnumIDListLPENUMIDLIST
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 117 of file CRecycleBin.cpp.

Constructor & Destructor Documentation

◆ CRecycleBinEnum()

CRecycleBinEnum::CRecycleBinEnum ( )

Definition at line 216 of file CRecycleBin.cpp.

217{
218}

◆ ~CRecycleBinEnum()

CRecycleBinEnum::~CRecycleBinEnum ( )

Definition at line 220 of file CRecycleBin.cpp.

221{
222}

Member Function Documentation

◆ CBEnumRecycleBin() [1/2]

BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin ( IN HANDLE  hDeletedFile)

Definition at line 281 of file CRecycleBin.cpp.

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}
static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
#define ERR(fmt,...)
Definition: debug.h:110
BOOL AddToEnumList(LPITEMIDLIST pidl)
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
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
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define TRACE(s)
Definition: solgame.cpp:4
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ CBEnumRecycleBin() [2/2]

BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin ( IN PVOID  Context,
IN HANDLE  hDeletedFile 
)
static

Definition at line 276 of file CRecycleBin.cpp.

277{
278 return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
279}
static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)

Referenced by CBEnumRecycleBin(), and Initialize().

◆ Initialize()

HRESULT WINAPI CRecycleBinEnum::Initialize ( DWORD  dwFlags)

Definition at line 224 of file CRecycleBin.cpp.

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}
#define WARN(fmt,...)
Definition: debug.h:112
#define E_FAIL
Definition: ddrawi.h:102
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
#define PathAddBackslashW
Definition: pathcch.h:301
#define _countof(array)
Definition: sndvol32.h:68
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
__wchar_t WCHAR
Definition: xmlstorage.h:180

The documentation for this class was generated from the following file: