ReactOS 0.4.16-dev-106-g10b08aa
RecycleBin5Enum Class Reference
Inheritance diagram for RecycleBin5Enum:
Collaboration diagram for RecycleBin5Enum:

Public Member Functions

 RecycleBin5Enum ()
 
virtual ~RecycleBin5Enum ()
 
HRESULT Init (_In_ IRecycleBin5 *prb, _In_ HANDLE hInfo, _In_ HANDLE hInfoMapped, _In_ LPCWSTR pszPrefix)
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObject) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP Next (DWORD celt, IRecycleBinFile **rgelt, DWORD *pceltFetched) override
 
STDMETHODIMP Skip (DWORD celt) override
 
STDMETHODIMP Reset () override
 

Protected Attributes

LONG m_ref
 
IRecycleBin5m_recycleBin
 
HANDLE m_hInfo
 
INFO2_HEADERm_pInfo
 
DWORD m_dwCurrent
 
LPWSTR m_pszPrefix
 

Detailed Description

Definition at line 303 of file recyclebin_v5_enumerator.cpp.

Constructor & Destructor Documentation

◆ RecycleBin5Enum()

RecycleBin5Enum::RecycleBin5Enum ( )

Definition at line 431 of file recyclebin_v5_enumerator.cpp.

◆ ~RecycleBin5Enum()

RecycleBin5Enum::~RecycleBin5Enum ( )
virtual

Definition at line 359 of file recyclebin_v5_enumerator.cpp.

360{
361 TRACE("(%p)\n", this);
362
363 m_recycleBin->OnClosing(this);
365 m_recycleBin->Release();
367}
#define UnmapViewOfFile
Definition: compat.h:746
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ Init()

HRESULT RecycleBin5Enum::Init ( _In_ IRecycleBin5 prb,
_In_ HANDLE  hInfo,
_In_ HANDLE  hInfoMapped,
_In_ LPCWSTR  pszPrefix 
)

Definition at line 442 of file recyclebin_v5_enumerator.cpp.

447{
448 m_recycleBin = prb;
449 m_recycleBin->AddRef();
450
451 HRESULT hr = SHStrDup(pszPrefix, &m_pszPrefix);
452 if (FAILED(hr))
453 return hr;
454
455 m_hInfo = hInfo;
456 m_pInfo = (PINFO2_HEADER)MapViewOfFile(hInfoMapped, FILE_MAP_READ, 0, 0, 0);
457 if (!m_pInfo)
459
461 return E_FAIL;
462
463 return S_OK;
464}
#define E_FAIL
Definition: ddrawi.h:102
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
struct _INFO2_HEADER * PINFO2_HEADER
HRESULT hr
Definition: shlfolder.c:183
#define SHStrDup
Definition: shlwapi.h:1537
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by RecycleBin5Enum_Constructor().

◆ Next()

STDMETHODIMP RecycleBin5Enum::Next ( DWORD  celt,
IRecycleBinFile **  rgelt,
DWORD pceltFetched 
)
override

Definition at line 379 of file recyclebin_v5_enumerator.cpp.

380{
381 HRESULT hr;
382
383 TRACE("(%p, %u, %p, %p)\n", this, celt, rgelt, pceltFetched);
384
385 if (!rgelt)
386 return E_POINTER;
387 if (!pceltFetched && celt > 1)
388 return E_INVALIDARG;
389
391 FileSize.u.LowPart = GetFileSize(m_hInfo, &FileSize.u.HighPart);
392 if (FileSize.u.LowPart == 0)
394
395 DWORD dwEntries =
396 (DWORD)((FileSize.QuadPart - sizeof(INFO2_HEADER)) / sizeof(DELETED_FILE_RECORD));
397
398 DWORD iEntry = m_dwCurrent, fetched = 0;
399 PDELETED_FILE_RECORD pDeletedFile = (PDELETED_FILE_RECORD)(m_pInfo + 1) + iEntry;
400 for (; iEntry < dwEntries && fetched < celt; ++iEntry)
401 {
402 hr = RecycleBin5File_Constructor(m_recycleBin, m_pszPrefix, pDeletedFile, &rgelt[fetched]);
403 if (SUCCEEDED(hr))
404 fetched++;
405 pDeletedFile++;
406 }
407
408 m_dwCurrent = iEntry;
409 if (pceltFetched)
410 *pceltFetched = fetched;
411 if (fetched == celt)
412 return S_OK;
413 else
414 return S_FALSE;
415}
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define DWORD
Definition: nt_native.h:44
struct _DELETED_FILE_RECORD * PDELETED_FILE_RECORD
struct _DELETED_FILE_RECORD DELETED_FILE_RECORD
static HRESULT RecycleBin5File_Constructor(_In_ IRecycleBin5 *prb, _In_ LPCWSTR Folder, _In_ PDELETED_FILE_RECORD pDeletedFile, _Out_ IRecycleBinFile **ppFile)
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2299 u
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365

◆ QueryInterface()

STDMETHODIMP RecycleBin5Enum::QueryInterface ( REFIID  riid,
void **  ppvObject 
)
override

Definition at line 334 of file recyclebin_v5_enumerator.cpp.

335{
336 TRACE("(%p, %s, %p)\n", this, debugstr_guid(&riid), ppvObject);
337
338 if (!ppvObject)
339 return E_POINTER;
340
342 *ppvObject = static_cast<IRecycleBinEnumList *>(this);
343 else
344 {
345 *ppvObject = NULL;
346 return E_NOINTERFACE;
347 }
348
349 AddRef();
350 return S_OK;
351}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:245
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ Reset()

STDMETHODIMP RecycleBin5Enum::Reset ( )
override

Definition at line 424 of file recyclebin_v5_enumerator.cpp.

425{
426 TRACE("(%p)\n", this);
427 m_dwCurrent = 0;
428 return S_OK;
429}

◆ Skip()

STDMETHODIMP RecycleBin5Enum::Skip ( DWORD  celt)
override

Definition at line 417 of file recyclebin_v5_enumerator.cpp.

418{
419 TRACE("(%p, %u)\n", this, celt);
420 m_dwCurrent += celt;
421 return S_OK;
422}

◆ STDMETHODIMP_() [1/2]

RecycleBin5Enum::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

RecycleBin5Enum::STDMETHODIMP_ ( ULONG  )
override

Member Data Documentation

◆ m_dwCurrent

DWORD RecycleBin5Enum::m_dwCurrent
protected

Definition at line 330 of file recyclebin_v5_enumerator.cpp.

Referenced by Next(), Reset(), and Skip().

◆ m_hInfo

HANDLE RecycleBin5Enum::m_hInfo
protected

Definition at line 328 of file recyclebin_v5_enumerator.cpp.

Referenced by Init(), and Next().

◆ m_pInfo

INFO2_HEADER* RecycleBin5Enum::m_pInfo
protected

Definition at line 329 of file recyclebin_v5_enumerator.cpp.

Referenced by Init(), Next(), and ~RecycleBin5Enum().

◆ m_pszPrefix

LPWSTR RecycleBin5Enum::m_pszPrefix
protected

Definition at line 331 of file recyclebin_v5_enumerator.cpp.

Referenced by Init(), Next(), and ~RecycleBin5Enum().

◆ m_recycleBin

IRecycleBin5* RecycleBin5Enum::m_recycleBin
protected

Definition at line 327 of file recyclebin_v5_enumerator.cpp.

Referenced by Init(), Next(), and ~RecycleBin5Enum().

◆ m_ref

LONG RecycleBin5Enum::m_ref
protected

Definition at line 326 of file recyclebin_v5_enumerator.cpp.


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