ReactOS  0.4.15-dev-499-g1f31905
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)
 
virtual HRESULT STDMETHODCALLTYPE Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
 
virtual HRESULT STDMETHODCALLTYPE Skip (ULONG celt)
 
virtual HRESULT STDMETHODCALLTYPE Reset ()
 
virtual HRESULT STDMETHODCALLTYPE Clone (IEnumIDList **ppenum)
 
- 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)
 
- 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 78 of file CRecycleBin.cpp.

Constructor & Destructor Documentation

◆ CRecycleBinEnum()

CRecycleBinEnum::CRecycleBinEnum ( )

Definition at line 184 of file CRecycleBin.cpp.

185 {
186 }

◆ ~CRecycleBinEnum()

CRecycleBinEnum::~CRecycleBinEnum ( )

Definition at line 188 of file CRecycleBin.cpp.

189 {
190 }

Member Function Documentation

◆ CBEnumRecycleBin() [1/2]

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

Definition at line 244 of file CRecycleBin.cpp.

245 {
246  return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
247 }

Referenced by Initialize().

◆ CBEnumRecycleBin() [2/2]

BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin ( IN HANDLE  hDeletedFile)

Definition at line 249 of file CRecycleBin.cpp.

250 {
251  PDELETED_FILE_DETAILS_W pFileDetails;
252  DWORD dwSize;
253  LPITEMIDLIST pidl = NULL;
254  BOOL ret;
255 
256  if (!GetDeletedFileDetailsW(hDeletedFile,
257  0,
258  NULL,
259  &dwSize) &&
261  {
262  ERR("GetDeletedFileDetailsW failed\n");
263  return FALSE;
264  }
265 
266  pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize);
267  if (!pFileDetails)
268  {
269  ERR("No memory\n");
270  return FALSE;
271  }
272 
273  if (!GetDeletedFileDetailsW(hDeletedFile,
274  dwSize,
275  pFileDetails,
276  NULL))
277  {
278  ERR("GetDeletedFileDetailsW failed\n");
279  SHFree(pFileDetails);
280  return FALSE;
281  }
282 
283  pidl = _ILCreateRecycleItem(pFileDetails);
284  if (!pidl)
285  {
286  SHFree(pFileDetails);
287  return FALSE;
288  }
289 
290  ret = AddToEnumList(pidl);
291 
292  if (!ret)
293  SHFree(pidl);
294  SHFree(pFileDetails);
295  TRACE("Returning %d\n", ret);
296  CloseRecycleBinHandle(hDeletedFile);
297  return ret;
298 }
BOOL AddToEnumList(LPITEMIDLIST pidl)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetDeletedFileDetailsW(IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:301
static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ERR(fmt,...)
Definition: debug.h:110
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ Initialize()

HRESULT WINAPI CRecycleBinEnum::Initialize ( DWORD  dwFlags)

Definition at line 192 of file CRecycleBin.cpp.

193 {
194  WCHAR szDrive[8];
195  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
196  {
197  ERR("GetEnvironmentVariableW failed\n");
198  return E_FAIL;
199  }
200  PathAddBackslashW(szDrive);
201 
202  if (dwFlags & SHCONTF_NONFOLDERS)
203  {
204  TRACE("Starting Enumeration\n");
205 
206  if (!EnumerateRecycleBinW(szDrive, CBEnumRecycleBin, this))
207  {
208  WARN("Error: EnumerateCRecycleBinW failed\n");
209  return E_FAIL;
210  }
211  }
212  else
213  {
214  // do nothing
215  }
216  return S_OK;
217 }
#define WARN(fmt,...)
Definition: debug.h:112
#define E_FAIL
Definition: ddrawi.h:102
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:421

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