ReactOS  0.4.14-dev-833-g5f692ed
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 238 of file CRecycleBin.cpp.

239 {
240  return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
241 }

Referenced by Initialize().

◆ CBEnumRecycleBin() [2/2]

BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin ( IN HANDLE  hDeletedFile)

Definition at line 243 of file CRecycleBin.cpp.

244 {
245  PDELETED_FILE_DETAILS_W pFileDetails;
246  DWORD dwSize;
247  LPITEMIDLIST pidl = NULL;
248  BOOL ret;
249 
250  if (!GetDeletedFileDetailsW(hDeletedFile,
251  0,
252  NULL,
253  &dwSize) &&
255  {
256  ERR("GetDeletedFileDetailsW failed\n");
257  return FALSE;
258  }
259 
260  pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize);
261  if (!pFileDetails)
262  {
263  ERR("No memory\n");
264  return FALSE;
265  }
266 
267  if (!GetDeletedFileDetailsW(hDeletedFile,
268  dwSize,
269  pFileDetails,
270  NULL))
271  {
272  ERR("GetDeletedFileDetailsW failed\n");
273  SHFree(pFileDetails);
274  return FALSE;
275  }
276 
277  pidl = _ILCreateRecycleItem(pFileDetails);
278  if (!pidl)
279  {
280  SHFree(pFileDetails);
281  return FALSE;
282  }
283 
284  ret = AddToEnumList(pidl);
285 
286  if (!ret)
287  SHFree(pidl);
288  SHFree(pFileDetails);
289  TRACE("Returning %d\n", ret);
290  CloseRecycleBinHandle(hDeletedFile);
291  return ret;
292 }
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:109
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  static LPCWSTR szDrive = L"C:\\";
195 
196  if (dwFlags & SHCONTF_NONFOLDERS)
197  {
198  TRACE("Starting Enumeration\n");
199 
200  if (!EnumerateRecycleBinW(szDrive /* FIXME */ , CBEnumRecycleBin, (PVOID)this))
201  {
202  WARN("Error: EnumerateCRecycleBinW failed\n");
203  return E_FAIL;
204  }
205  }
206  else
207  {
208  // do nothing
209  }
210  return S_OK;
211 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define WARN(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
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 S_OK
Definition: intsafe.h:59
static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)

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