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

Public Member Functions

 RecycleBin5File ()
 
virtual ~RecycleBin5File ()
 
HRESULT Init (_In_ IRecycleBin5 *prb, _In_ LPCWSTR Folder, _In_ PDELETED_FILE_RECORD pDeletedFile)
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObject) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP GetLastModificationTime (FILETIME *pLastModificationTime) override
 
STDMETHODIMP GetDeletionTime (FILETIME *pDeletionTime) override
 
STDMETHODIMP GetFileSize (ULARGE_INTEGER *pFileSize) override
 
STDMETHODIMP GetPhysicalFileSize (ULARGE_INTEGER *pPhysicalFileSize) override
 
STDMETHODIMP GetAttributes (DWORD *pAttributes) override
 
STDMETHODIMP GetFileName (SIZE_T BufferSize, LPWSTR Buffer, SIZE_T *RequiredSize) override
 
STDMETHODIMP GetTypeName (SIZE_T BufferSize, LPWSTR Buffer, SIZE_T *RequiredSize) override
 
STDMETHODIMP Delete () override
 
STDMETHODIMP Restore () override
 

Protected Attributes

LONG m_ref
 
IRecycleBin5m_recycleBin
 
DELETED_FILE_RECORD m_deletedFile
 
LPWSTR m_FullName
 

Detailed Description

Definition at line 14 of file recyclebin_v5_enumerator.cpp.

Constructor & Destructor Documentation

◆ RecycleBin5File()

RecycleBin5File::RecycleBin5File ( )

Definition at line 244 of file recyclebin_v5_enumerator.cpp.

245 : m_ref(1)
248{
250}
DELETED_FILE_RECORD m_deletedFile
#define NULL
Definition: types.h:112
#define ZeroMemory
Definition: winbase.h:1712

◆ ~RecycleBin5File()

RecycleBin5File::~RecycleBin5File ( )
virtual

Definition at line 81 of file recyclebin_v5_enumerator.cpp.

82{
83 TRACE("(%p)\n", this);
84 m_recycleBin->Release();
86}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ Delete()

STDMETHODIMP RecycleBin5File::Delete ( )
override

Definition at line 232 of file recyclebin_v5_enumerator.cpp.

233{
234 TRACE("(%p)\n", this);
235 return m_recycleBin->Delete(m_FullName, &m_deletedFile);
236}

◆ GetAttributes()

STDMETHODIMP RecycleBin5File::GetAttributes ( DWORD pAttributes)
override

Definition at line 169 of file recyclebin_v5_enumerator.cpp.

170{
172
173 TRACE("(%p, %p)\n", this, pAttributes);
174
178
179 *pAttributes = dwAttributes;
180 return S_OK;
181}
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
DWORD dwAttributes
Definition: vdmdbg.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by GetTypeName(), and QueryInterface().

◆ GetDeletionTime()

STDMETHODIMP RecycleBin5File::GetDeletionTime ( FILETIME pDeletionTime)
override

Definition at line 126 of file recyclebin_v5_enumerator.cpp.

127{
128 TRACE("(%p, %p)\n", this, pDeletionTime);
129 *pDeletionTime = m_deletedFile.DeletionTime;
130 return S_OK;
131}

◆ GetFileName()

STDMETHODIMP RecycleBin5File::GetFileName ( SIZE_T  BufferSize,
LPWSTR  Buffer,
SIZE_T RequiredSize 
)
override

Definition at line 183 of file recyclebin_v5_enumerator.cpp.

184{
185 DWORD dwRequired;
186
187 TRACE("(%p, %u, %p, %p)\n", this, BufferSize, Buffer, RequiredSize);
188
189 dwRequired = (DWORD)(wcslen(m_deletedFile.FileNameW) + 1) * sizeof(WCHAR);
190 if (RequiredSize)
191 *RequiredSize = dwRequired;
192
193 if (BufferSize == 0 && !Buffer)
194 return S_OK;
195
196 if (BufferSize < dwRequired)
197 return E_OUTOFMEMORY;
199 return S_OK;
200}
Definition: bufpool.h:45
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DWORD
Definition: nt_native.h:44
WCHAR FileNameW[MAX_PATH]
Definition: recyclebin_v5.h:20
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define CopyMemory
Definition: winbase.h:1710
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ GetFileSize()

STDMETHODIMP RecycleBin5File::GetFileSize ( ULARGE_INTEGER pFileSize)
override

Definition at line 133 of file recyclebin_v5_enumerator.cpp.

134{
135 TRACE("(%p, %p)\n", this, pFileSize);
136
141 {
142 pFileSize->QuadPart = 0;
143 return S_OK;
144 }
145
149 pFileSize->u.LowPart = ::GetFileSize(hFile, &pFileSize->u.HighPart);
150
151 HRESULT hr;
152 if (pFileSize->u.LowPart != INVALID_FILE_SIZE)
153 hr = S_OK;
154 else
156
158 return hr;
159}
STDMETHODIMP GetFileSize(ULARGE_INTEGER *pFileSize) override
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HRESULT hr
Definition: shlfolder.c:183
struct _ULARGE_INTEGER::@4136 u
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define INVALID_FILE_SIZE
Definition: winbase.h:548

Referenced by GetFileSize().

◆ GetLastModificationTime()

STDMETHODIMP RecycleBin5File::GetLastModificationTime ( FILETIME pLastModificationTime)
override

Definition at line 97 of file recyclebin_v5_enumerator.cpp.

98{
99 TRACE("(%p, %p)\n", this, pLastModificationTime);
100
104
110 NULL,
113 NULL);
116
117 HRESULT hr;
118 if (GetFileTime(hFile, NULL, NULL, pLastModificationTime))
119 hr = S_OK;
120 else
123 return hr;
124}
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:896
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_DELETE
Definition: nt_native.h:682

◆ GetPhysicalFileSize()

STDMETHODIMP RecycleBin5File::GetPhysicalFileSize ( ULARGE_INTEGER pPhysicalFileSize)
override

Definition at line 161 of file recyclebin_v5_enumerator.cpp.

162{
163 TRACE("(%p, %p)\n", this, pPhysicalFileSize);
164 pPhysicalFileSize->u.HighPart = 0;
165 pPhysicalFileSize->u.LowPart = m_deletedFile.dwPhysicalFileSize;
166 return S_OK;
167}

◆ GetTypeName()

STDMETHODIMP RecycleBin5File::GetTypeName ( SIZE_T  BufferSize,
LPWSTR  Buffer,
SIZE_T RequiredSize 
)
override

Definition at line 202 of file recyclebin_v5_enumerator.cpp.

203{
204 HRESULT hr;
205 DWORD dwRequired;
207 SHFILEINFOW shFileInfo;
208
209 TRACE("(%p, %u, %p, %p)\n", this, BufferSize, Buffer, RequiredSize);
210
212 if (!SUCCEEDED(hr))
213 return hr;
214
215 hr = SHGetFileInfoW(m_FullName, dwAttributes, &shFileInfo, sizeof(shFileInfo), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES);
216 if (!SUCCEEDED(hr))
217 return hr;
218
219 dwRequired = (DWORD)(wcslen(shFileInfo.szTypeName) + 1) * sizeof(WCHAR);
220 if (RequiredSize)
221 *RequiredSize = dwRequired;
222
223 if (BufferSize == 0 && !Buffer)
224 return S_OK;
225
226 if (BufferSize < dwRequired)
227 return E_OUTOFMEMORY;
228 CopyMemory(Buffer, shFileInfo.szTypeName, dwRequired);
229 return S_OK;
230}
STDMETHODIMP GetAttributes(DWORD *pAttributes) override
#define SUCCEEDED(hr)
Definition: intsafe.h:50
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:414
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
WCHAR szTypeName[80]
Definition: shellapi.h:376

◆ Init()

HRESULT RecycleBin5File::Init ( _In_ IRecycleBin5 prb,
_In_ LPCWSTR  Folder,
_In_ PDELETED_FILE_RECORD  pDeletedFile 
)

Definition at line 253 of file recyclebin_v5_enumerator.cpp.

257{
258 m_recycleBin = prb;
259 m_recycleBin->AddRef();
260 m_deletedFile = *pDeletedFile;
261
262 WCHAR szUniqueId[32];
263 StringCchPrintfW(szUniqueId, _countof(szUniqueId), L"%lu", pDeletedFile->dwRecordUniqueId);
264
265 CStringW strFullName(Folder);
266 strFullName += L"\\D";
267 strFullName += (WCHAR)(L'a' + pDeletedFile->dwDriveNumber);
268 strFullName += szUniqueId;
269 strFullName += PathFindExtensionW(pDeletedFile->FileNameW);
271 return E_FAIL;
272
273 return SHStrDup(strFullName, &m_FullName);
274}
#define E_FAIL
Definition: ddrawi.h:102
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define L(x)
Definition: ntvdm.h:50
#define SHStrDup
Definition: shlwapi.h:1537
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by RecycleBin5File_Constructor().

◆ QueryInterface()

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

Definition at line 48 of file recyclebin_v5_enumerator.cpp.

49{
50 TRACE("(%p, %s, %p)\n", this, debugstr_guid(&riid), ppvObject);
51
52 if (!ppvObject)
53 return E_POINTER;
54
56 *ppvObject = static_cast<IRecycleBinFile *>(this);
57 else if (IsEqualIID(riid, IID_IExtractIconA) || IsEqualIID(riid, IID_IExtractIconW))
58 {
62 else
63 return S_FALSE;
64 }
65 else
66 {
67 *ppvObject = NULL;
68 return E_NOINTERFACE;
69 }
70
71 AddRef();
72 return S_OK;
73}
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(_In_ LPCWSTR pszFile, _In_ DWORD dwFileAttributes, _In_ REFIID riid, _Outptr_ void **ppv)
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_IRecycleBinFile
Definition: recyclebin.h:244
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365

◆ Restore()

STDMETHODIMP RecycleBin5File::Restore ( )
override

Definition at line 238 of file recyclebin_v5_enumerator.cpp.

239{
240 TRACE("(%p)\n", this);
241 return m_recycleBin->Restore(m_FullName, &m_deletedFile);
242}

◆ STDMETHODIMP_() [1/2]

RecycleBin5File::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

RecycleBin5File::STDMETHODIMP_ ( ULONG  )
override

Member Data Documentation

◆ m_deletedFile

DELETED_FILE_RECORD RecycleBin5File::m_deletedFile
protected

◆ m_FullName

LPWSTR RecycleBin5File::m_FullName
protected

◆ m_recycleBin

IRecycleBin5* RecycleBin5File::m_recycleBin
protected

Definition at line 43 of file recyclebin_v5_enumerator.cpp.

Referenced by Delete(), Init(), Restore(), and ~RecycleBin5File().

◆ m_ref

LONG RecycleBin5File::m_ref
protected

Definition at line 42 of file recyclebin_v5_enumerator.cpp.

Referenced by STDMETHODIMP_().


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