ReactOS  0.4.13-dev-257-gfabbd7c
recyclebin.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winver.h>
#include <shellapi.h>
#include <objbase.h>
Include dependency graph for recyclebin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DELETED_FILE_DETAILS_A
 
struct  _DELETED_FILE_DETAILS_W
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define ANY_SIZE   1
 
#define DELETED_FILE_DETAILS   DELETED_FILE_DETAILS_A
 
#define PDELETED_FILE_DETAILS   PDELETED_FILE_DETAILS_A
 
#define DeleteFileToRecycleBin   DeleteFileToRecycleBinA
 
#define EmptyRecycleBin   EmptyRecycleBinA
 
#define EnumerateRecycleBin   EnumerateRecycleBinA
 
#define GetDeletedFileDetails   GetDeletedFileDetailsA
 
#define INTERFACE   IRecycleBinFile
 
#define INTERFACE   IRecycleBinEnumList
 
#define INTERFACE   IRecycleBin
 

Typedefs

typedef struct _DELETED_FILE_DETAILS_A DELETED_FILE_DETAILS_A
 
typedef struct _DELETED_FILE_DETAILS_APDELETED_FILE_DETAILS_A
 
typedef struct _DELETED_FILE_DETAILS_W DELETED_FILE_DETAILS_W
 
typedef struct _DELETED_FILE_DETAILS_WPDELETED_FILE_DETAILS_W
 
typedef BOOL(WINAPIPENUMERATE_RECYCLEBIN_CALLBACK) (IN PVOID Context, IN HANDLE hDeletedFile)
 

Functions

BOOL WINAPI CloseRecycleBinHandle (IN HANDLE hDeletedFile)
 
BOOL WINAPI DeleteFileToRecycleBinA (IN LPCSTR FileName)
 
BOOL WINAPI DeleteFileToRecycleBinW (IN LPCWSTR FileName)
 
BOOL WINAPI DeleteFileHandleToRecycleBin (IN HANDLE hDeletedFile)
 
BOOL WINAPI EmptyRecycleBinA (IN LPCSTR pszRoot OPTIONAL)
 
BOOL WINAPI EmptyRecycleBinW (IN LPCWSTR pszRoot OPTIONAL)
 
BOOL WINAPI EnumerateRecycleBinA (IN LPCSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
 
BOOL WINAPI EnumerateRecycleBinW (IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
 
BOOL WINAPI GetDeletedFileDetailsA (IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_A FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
 
BOOL WINAPI GetDeletedFileDetailsW (IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
 
BOOL WINAPI GetRecycleBinDetails (IN LPCWSTR pszVolume OPTIONAL, OUT ULARGE_INTEGER *pulTotalItems, OUT ULARGE_INTEGER *pulTotalSize)
 
BOOL WINAPI RestoreFile (IN HANDLE hDeletedFile)
 
 DECLARE_INTERFACE_ (IRecycleBinFile, IUnknown)
 
 DECLARE_INTERFACE_ (IRecycleBinEnumList, IUnknown)
 
 DECLARE_INTERFACE_ (IRecycleBin, IUnknown)
 
HRESULT WINAPI GetDefaultRecycleBin (IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
 

Variables

EXTERN_C const IID IID_IRecycleBinFile
 
EXTERN_C const IID IID_IRecycleBinEnumList
 
EXTERN_C const IID IID_IRecycleBin
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 10 of file recyclebin.h.

◆ ANY_SIZE

#define ANY_SIZE   1

Definition at line 20 of file recyclebin.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 11 of file recyclebin.h.

◆ DELETED_FILE_DETAILS

#define DELETED_FILE_DETAILS   DELETED_FILE_DETAILS_A

Definition at line 46 of file recyclebin.h.

◆ DeleteFileToRecycleBin

#define DeleteFileToRecycleBin   DeleteFileToRecycleBinA

Definition at line 82 of file recyclebin.h.

◆ EmptyRecycleBin

#define EmptyRecycleBin   EmptyRecycleBinA

Definition at line 108 of file recyclebin.h.

◆ EnumerateRecycleBin

#define EnumerateRecycleBin   EnumerateRecycleBinA

Definition at line 131 of file recyclebin.h.

◆ GetDeletedFileDetails

#define GetDeletedFileDetails   GetDeletedFileDetailsA

Definition at line 157 of file recyclebin.h.

◆ INTERFACE [1/3]

#define INTERFACE   IRecycleBinFile

Definition at line 228 of file recyclebin.h.

◆ INTERFACE [2/3]

#define INTERFACE   IRecycleBinEnumList

Definition at line 228 of file recyclebin.h.

◆ INTERFACE [3/3]

#define INTERFACE   IRecycleBin

Definition at line 228 of file recyclebin.h.

◆ PDELETED_FILE_DETAILS

#define PDELETED_FILE_DETAILS   PDELETED_FILE_DETAILS_A

Definition at line 47 of file recyclebin.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 9 of file recyclebin.h.

Typedef Documentation

◆ DELETED_FILE_DETAILS_A

◆ DELETED_FILE_DETAILS_W

◆ PDELETED_FILE_DETAILS_A

◆ PDELETED_FILE_DETAILS_W

◆ PENUMERATE_RECYCLEBIN_CALLBACK

typedef BOOL(WINAPI * PENUMERATE_RECYCLEBIN_CALLBACK) (IN PVOID Context, IN HANDLE hDeletedFile)

Definition at line 58 of file recyclebin.h.

Function Documentation

◆ CloseRecycleBinHandle()

BOOL WINAPI CloseRecycleBinHandle ( IN HANDLE  hDeletedFile)

Definition at line 12 of file recyclebin.c.

14 {
15  IRecycleBinFile *rbf = (IRecycleBinFile *)hDeletedFile;
16  HRESULT hr;
17 
18  TRACE("(%p)\n", hDeletedFile);
19 
20  hr = IRecycleBinFile_Release(rbf);
21  if (SUCCEEDED(hr))
22  return TRUE;
25  else
27  return FALSE;
28 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CRecycleBinEnum::CBEnumRecycleBin(), and CBSearchRecycleBin().

◆ DECLARE_INTERFACE_() [1/3]

DECLARE_INTERFACE_ ( IRecycleBinFile  ,
IUnknown   
)

Definition at line 185 of file recyclebin.h.

186 {
188 
189  /* IUnknown methods */
193 
194  /* IRecycleBinFile methods */
195  STDMETHOD(GetLastModificationTime)(THIS_ FILETIME *pLastModificationTime) PURE;
196  STDMETHOD(GetDeletionTime)(THIS_ FILETIME *pDeletionTime) PURE;
198  STDMETHOD(GetPhysicalFileSize)(THIS_ ULARGE_INTEGER *pPhysicalFileSize) PURE;
199  STDMETHOD(GetAttributes)(THIS_ DWORD *pAttributes) PURE;
202  STDMETHOD(Restore)(THIS) PURE;
203 
205 };
#define REFIID
Definition: guiddef.h:113
#define THIS_
Definition: basetyps.h:65
_In_ BOOLEAN Release
Definition: classpnp.h:929
static PWCHAR GetFileName(PWCHAR Path)
Definition: cabinet.c:381
#define BEGIN_INTERFACE
Definition: objbase.h:231
#define THIS
Definition: basetyps.h:66
REFIID riid
Definition: precomp.h:44
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
#define STDMETHOD(m)
Definition: basetyps.h:62
#define END_INTERFACE
Definition: objbase.h:232
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
REFIID LPVOID * ppvObject
Definition: precomp.h:44
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define PURE
Definition: basetyps.h:64
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12

◆ DECLARE_INTERFACE_() [2/3]

DECLARE_INTERFACE_ ( IRecycleBinEnumList  ,
IUnknown   
)

Definition at line 210 of file recyclebin.h.

211 {
213 
214  /* IUnknown methods */
218 
219  /* IRecycleBinEnumList methods */
220  STDMETHOD(Next)(THIS_ DWORD celt, IRecycleBinFile **rgelt, DWORD *pceltFetched);
221  STDMETHOD(Skip)(THIS_ DWORD celt) PURE;
222  STDMETHOD(Reset)(THIS) PURE;
223 
225 };
#define REFIID
Definition: guiddef.h:113
#define THIS_
Definition: basetyps.h:65
_In_ BOOLEAN Release
Definition: classpnp.h:929
#define BEGIN_INTERFACE
Definition: objbase.h:231
#define THIS
Definition: basetyps.h:66
REFIID riid
Definition: precomp.h:44
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
#define STDMETHOD(m)
Definition: basetyps.h:62
#define END_INTERFACE
Definition: objbase.h:232
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define PURE
Definition: basetyps.h:64
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
unsigned int ULONG
Definition: retypes.h:1
#define STDMETHOD_(t, m)
Definition: basetyps.h:63

◆ DECLARE_INTERFACE_() [3/3]

DECLARE_INTERFACE_ ( IRecycleBin  ,
IUnknown   
)

Definition at line 230 of file recyclebin.h.

231 {
233 
234  /* IUnknown methods */
238 
239  /* IRecycleBin methods */
240  STDMETHOD(DeleteFile)(THIS_ LPCWSTR szFileName);
242  STDMETHOD(EnumObjects)(THIS_ IRecycleBinEnumList **ppEnumList);
243 
245 };
#define REFIID
Definition: guiddef.h:113
#define THIS_
Definition: basetyps.h:65
_In_ BOOLEAN Release
Definition: classpnp.h:929
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define BEGIN_INTERFACE
Definition: objbase.h:231
#define THIS
Definition: basetyps.h:66
REFIID riid
Definition: precomp.h:44
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
#define DeleteFile
Definition: winbase.h:3578
int WINAPI EnumObjects(_In_ HDC, _In_ int, _In_ GOBJENUMPROC, _In_ LPARAM)
#define STDMETHOD(m)
Definition: basetyps.h:62
#define END_INTERFACE
Definition: objbase.h:232
#define EmptyRecycleBin
Definition: recyclebin.h:108
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define PURE
Definition: basetyps.h:64
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
unsigned int ULONG
Definition: retypes.h:1
#define STDMETHOD_(t, m)
Definition: basetyps.h:63

◆ DeleteFileHandleToRecycleBin()

BOOL WINAPI DeleteFileHandleToRecycleBin ( IN HANDLE  hDeletedFile)

Definition at line 93 of file recyclebin.c.

95 {
96  IRecycleBinFile *rbf = (IRecycleBinFile *)hDeletedFile;
97  HRESULT hr;
98 
99  TRACE("(%p)\n", hDeletedFile);
100 
101  hr = IRecycleBinFile_Delete(rbf);
102 
103  if (SUCCEEDED(hr))
104  return TRUE;
107  else
109  return FALSE;
110 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CRecycleBinItemContextMenu::InvokeCommand().

◆ DeleteFileToRecycleBinA()

BOOL WINAPI DeleteFileToRecycleBinA ( IN LPCSTR  FileName)

Definition at line 31 of file recyclebin.c.

33 {
34  int len;
35  LPWSTR FileNameW = NULL;
36  BOOL ret = FALSE;
37 
38  TRACE("(%s)\n", debugstr_a(FileName));
39 
40  /* Check parameters */
41  if (FileName == NULL)
42  {
44  goto cleanup;
45  }
46 
48  if (len == 0)
49  goto cleanup;
50  FileNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
51  if (!FileNameW)
52  {
54  goto cleanup;
55  }
56  if (MultiByteToWideChar(CP_ACP, 0, FileName, -1, FileNameW, len) == 0)
57  goto cleanup;
58 
59  ret = DeleteFileToRecycleBinW(FileNameW);
60 
61 cleanup:
62  HeapFree(GetProcessHeap(), 0, FileNameW);
63  return ret;
64 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL WINAPI DeleteFileToRecycleBinW(IN LPCWSTR FileName)
Definition: recyclebin.c:67
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ DeleteFileToRecycleBinW()

BOOL WINAPI DeleteFileToRecycleBinW ( IN LPCWSTR  FileName)

Definition at line 67 of file recyclebin.c.

69 {
70  IRecycleBin *prb;
71  HRESULT hr;
72 
73  TRACE("(%s)\n", debugstr_w(FileName));
74 
75  hr = GetDefaultRecycleBin(NULL, &prb);
76  if (!SUCCEEDED(hr))
77  goto cleanup;
78 
79  hr = IRecycleBin_DeleteFile(prb, FileName);
80  IRecycleBin_Release(prb);
81 
82 cleanup:
83  if (SUCCEEDED(hr))
84  return TRUE;
87  else
89  return FALSE;
90 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:385
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define HRESULT_CODE(hr)
Definition: winerror.h:76
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by DeleteFileToRecycleBinA().

◆ EmptyRecycleBinA()

BOOL WINAPI EmptyRecycleBinA ( IN LPCSTR pszRoot  OPTIONAL)

Definition at line 113 of file recyclebin.c.

115 {
116  int len;
117  LPWSTR szRootW = NULL;
118  BOOL ret = FALSE;
119 
120  TRACE("(%s)\n", debugstr_a(pszRoot));
121 
122  if (pszRoot)
123  {
124  len = MultiByteToWideChar(CP_ACP, 0, pszRoot, -1, NULL, 0);
125  if (len == 0)
126  goto cleanup;
127  szRootW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
128  if (!szRootW)
129  {
131  goto cleanup;
132  }
133  if (MultiByteToWideChar(CP_ACP, 0, pszRoot, -1, szRootW, len) == 0)
134  goto cleanup;
135  }
136 
137  ret = EmptyRecycleBinW(szRootW);
138 
139 cleanup:
140  HeapFree(GetProcessHeap(), 0, szRootW);
141  return ret;
142 }
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
int ret
BOOL WINAPI EmptyRecycleBinW(IN LPCWSTR pszRoot OPTIONAL)
Definition: recyclebin.c:145
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ EmptyRecycleBinW()

BOOL WINAPI EmptyRecycleBinW ( IN LPCWSTR pszRoot  OPTIONAL)

Definition at line 145 of file recyclebin.c.

147 {
148  IRecycleBin *prb;
149  HRESULT hr;
150 
151  TRACE("(%s)\n", debugstr_w(pszRoot));
152 
153  hr = GetDefaultRecycleBin(pszRoot, &prb);
154  if (!SUCCEEDED(hr))
155  goto cleanup;
156 
157  hr = IRecycleBin_EmptyRecycleBin(prb);
158  IRecycleBin_Release(prb);
159 
160 cleanup:
161  if (SUCCEEDED(hr))
162  return TRUE;
165  else
167  return FALSE;
168 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:385
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define HRESULT_CODE(hr)
Definition: winerror.h:76
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by EmptyRecycleBinA(), and SHEmptyRecycleBinW().

◆ EnumerateRecycleBinA()

BOOL WINAPI EnumerateRecycleBinA ( IN LPCSTR pszRoot  OPTIONAL,
IN PENUMERATE_RECYCLEBIN_CALLBACK  pFnCallback,
IN PVOID Context  OPTIONAL 
)

Definition at line 171 of file recyclebin.c.

175 {
176  int len;
177  LPWSTR szRootW = NULL;
178  BOOL ret = FALSE;
179 
180  TRACE("(%s, %p, %p)\n", debugstr_a(pszRoot), pFnCallback, Context);
181 
182  if (pszRoot)
183  {
184  len = MultiByteToWideChar(CP_ACP, 0, pszRoot, -1, NULL, 0);
185  if (len == 0)
186  goto cleanup;
187  szRootW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
188  if (!szRootW)
189  {
191  goto cleanup;
192  }
193  if (MultiByteToWideChar(CP_ACP, 0, pszRoot, -1, szRootW, len) == 0)
194  goto cleanup;
195  }
196 
197  ret = EnumerateRecycleBinW(szRootW, pFnCallback, Context);
198 
199 cleanup:
200  HeapFree(GetProcessHeap(), 0, szRootW);
201  return ret;
202 }
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define MultiByteToWideChar
Definition: compat.h:100
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ EnumerateRecycleBinW()

BOOL WINAPI EnumerateRecycleBinW ( IN LPCWSTR pszRoot  OPTIONAL,
IN PENUMERATE_RECYCLEBIN_CALLBACK  pFnCallback,
IN PVOID Context  OPTIONAL 
)

Definition at line 205 of file recyclebin.c.

209 {
210  IRecycleBin *prb = NULL;
211  IRecycleBinEnumList *prbel = NULL;
212  IRecycleBinFile *prbf;
213  HRESULT hr;
214 
215  TRACE("(%s, %p, %p)\n", debugstr_w(pszRoot), pFnCallback, Context);
216 
217  hr = GetDefaultRecycleBin(NULL, &prb);
218  if (!SUCCEEDED(hr))
219  goto cleanup;
220 
221  hr = IRecycleBin_EnumObjects(prb, &prbel);
222  if (!SUCCEEDED(hr))
223  goto cleanup;
224  while (TRUE)
225  {
226  hr = IRecycleBinEnumList_Next(prbel, 1, &prbf, NULL);
227  if (hr == S_FALSE)
228  {
229  hr = S_OK;
230  goto cleanup;
231  }
232  else if (!SUCCEEDED(hr))
233  goto cleanup;
234  if (!pFnCallback(Context, (HANDLE)prbf))
235  {
237  goto cleanup;
238  }
239  }
240 
241 cleanup:
242  if (prb)
243  IRecycleBin_Release(prb);
244  if (prbel)
245  IRecycleBinEnumList_Release(prbel);
246  if (SUCCEEDED(hr))
247  return TRUE;
250  else
252  return FALSE;
253 }
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:385
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define S_OK
Definition: intsafe.h:59
#define HRESULT_CODE(hr)
Definition: winerror.h:76
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by EnumerateRecycleBinA(), CRecycleBinEnum::Initialize(), and CRecycleBinItemContextMenu::InvokeCommand().

◆ GetDefaultRecycleBin()

HRESULT WINAPI GetDefaultRecycleBin ( IN LPCWSTR pszVolume  OPTIONAL,
OUT IRecycleBin **  pprb 
)

Definition at line 385 of file recyclebin.c.

388 {
389  IUnknown *pUnk;
390  HRESULT hr;
391 
392  TRACE("(%s, %p)\n", debugstr_w(pszVolume), pprb);
393 
394  if (!pprb)
395  return E_POINTER;
396 
397  if (!pszVolume)
399  else
400  {
401  /* FIXME: do a better validation! */
402  if (wcslen(pszVolume) != 3 || pszVolume[1] != ':' || pszVolume[2] != '\\')
404 
405  /* For now, only support this type of recycle bins... */
406  hr = RecycleBin5_Constructor(pszVolume, &pUnk);
407  }
408  if (!SUCCEEDED(hr))
409  return hr;
410  hr = IUnknown_QueryInterface(pUnk, &IID_IRecycleBin, (void **)pprb);
411  IUnknown_Release(pUnk);
412  return hr;
413 }
EXTERN_C const IID IID_IRecycleBin
Definition: recyclebin.h:249
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
HRESULT RecycleBinGeneric_Constructor(OUT IUnknown **ppUnknown)
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT RecycleBin5_Constructor(IN LPCWSTR VolumePath, OUT IUnknown **ppUnknown)
#define ERROR_INVALID_NAME
Definition: compat.h:93
#define E_POINTER
Definition: winerror.h:2365
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by DeleteFileToRecycleBinW(), EmptyRecycleBinW(), EnumerateRecycleBinW(), RecycleBinGeneric_RecycleBin_DeleteFile(), RecycleBinGeneric_RecycleBin_EmptyRecycleBin(), and RecycleBinGenericEnum_RecycleBinEnumList_Next().

◆ GetDeletedFileDetailsA()

BOOL WINAPI GetDeletedFileDetailsA ( IN HANDLE  hDeletedFile,
IN DWORD  BufferSize,
IN OUT PDELETED_FILE_DETAILS_A FileDetails  OPTIONAL,
OUT LPDWORD RequiredSize  OPTIONAL 
)

Definition at line 256 of file recyclebin.c.

261 {
262  PDELETED_FILE_DETAILS_W FileDetailsW = NULL;
263  DWORD BufferSizeW = 0;
264  BOOL ret = FALSE;
265 
266  TRACE("(%p, %lu, %p, %p)\n", hDeletedFile, BufferSize, FileDetails, RequiredSize);
267 
269  {
272  }
273  if (FileDetails && BufferSizeW)
274  {
275  FileDetailsW = HeapAlloc(GetProcessHeap(), 0, BufferSizeW);
276  if (!FileDetailsW)
277  {
279  goto cleanup;
280  }
281  }
282 
283  ret = GetDeletedFileDetailsW(hDeletedFile, BufferSizeW, FileDetailsW, RequiredSize);
284  if (!ret)
285  goto cleanup;
286 
287  if (FileDetails)
288  {
289  CopyMemory(FileDetails, FileDetailsW, FIELD_OFFSET(DELETED_FILE_DETAILS_A, FileName));
290  if (0 == WideCharToMultiByte(CP_ACP, 0, FileDetailsW->FileName, -1, FileDetails->FileName, BufferSize - FIELD_OFFSET(DELETED_FILE_DETAILS_A, FileName), NULL, NULL))
291  goto cleanup;
292  }
293  ret = TRUE;
294 
295 cleanup:
296  HeapFree(GetProcessHeap(), 0, FileDetailsW);
297  return ret;
298 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
WCHAR FileName[ANY_SIZE]
Definition: recyclebin.h:40
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1633
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
char * cleanup(char *str)
Definition: wpickclick.c:99
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ GetDeletedFileDetailsW()

BOOL WINAPI GetDeletedFileDetailsW ( IN HANDLE  hDeletedFile,
IN DWORD  BufferSize,
IN OUT PDELETED_FILE_DETAILS_W FileDetails  OPTIONAL,
OUT LPDWORD RequiredSize  OPTIONAL 
)

Definition at line 301 of file recyclebin.c.

306 {
307  IRecycleBinFile *rbf = (IRecycleBinFile *)hDeletedFile;
308  HRESULT hr;
309  SIZE_T NameSize, Needed;
310 
311  TRACE("(%p, %lu, %p, %p)\n", hDeletedFile, BufferSize, FileDetails, RequiredSize);
312 
313  hr = IRecycleBinFile_GetFileName(rbf, 0, NULL, &NameSize);
314  if (!SUCCEEDED(hr))
315  goto cleanup;
316  Needed = FIELD_OFFSET(DELETED_FILE_DETAILS_W, FileName) + NameSize;
317  if (RequiredSize)
318  *RequiredSize = (DWORD)Needed;
319  if (Needed > BufferSize)
320  {
322  goto cleanup;
323  }
324  hr = IRecycleBinFile_GetFileName(rbf, NameSize, FileDetails->FileName, NULL);
325  if (!SUCCEEDED(hr))
326  goto cleanup;
327  hr = IRecycleBinFile_GetLastModificationTime(rbf, &FileDetails->LastModification);
328  if (!SUCCEEDED(hr))
329  goto cleanup;
330  hr = IRecycleBinFile_GetDeletionTime(rbf, &FileDetails->DeletionTime);
331  if (!SUCCEEDED(hr))
332  goto cleanup;
333  hr = IRecycleBinFile_GetFileSize(rbf, &FileDetails->FileSize);
334  if (!SUCCEEDED(hr))
335  goto cleanup;
336  hr = IRecycleBinFile_GetPhysicalFileSize(rbf, &FileDetails->PhysicalFileSize);
337  if (!SUCCEEDED(hr))
338  goto cleanup;
339  hr = IRecycleBinFile_GetAttributes(rbf, &FileDetails->Attributes);
340  if (!SUCCEEDED(hr))
341  goto cleanup;
342 
343 cleanup:
344  if (SUCCEEDED(hr))
345  return TRUE;
348  else
350  return FALSE;
351 }
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define DWORD
Definition: nt_native.h:44
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define BufferSize
Definition: classpnp.h:419
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define HRESULT_CODE(hr)
Definition: winerror.h:76
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by CRecycleBinEnum::CBEnumRecycleBin(), CBSearchRecycleBin(), and GetDeletedFileDetailsA().

◆ GetRecycleBinDetails()

BOOL WINAPI GetRecycleBinDetails ( IN LPCWSTR pszVolume  OPTIONAL,
OUT ULARGE_INTEGER pulTotalItems,
OUT ULARGE_INTEGER pulTotalSize 
)

Definition at line 354 of file recyclebin.c.

358 {
359  pulTotalItems->QuadPart = 0;
360  pulTotalSize->QuadPart = 0;
362  return FALSE;
363 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ RestoreFile()

BOOL WINAPI RestoreFile ( IN HANDLE  hDeletedFile)

Definition at line 366 of file recyclebin.c.

368 {
369  IRecycleBinFile *rbf = (IRecycleBinFile *)hDeletedFile;
370  HRESULT hr;
371 
372  TRACE("(%p)\n", hDeletedFile);
373 
374  hr = IRecycleBinFile_Restore(rbf);
375  if (SUCCEEDED(hr))
376  return TRUE;
379  else
381  return FALSE;
382 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SetLastError(x)
Definition: compat.h:409
#define FACILITY_WIN32
Definition: winerror.h:27
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CRecycleBinItemContextMenu::InvokeCommand().

Variable Documentation

◆ IID_IRecycleBin

◆ IID_IRecycleBinEnumList

◆ IID_IRecycleBinFile

EXTERN_C const IID IID_IRecycleBinFile

Definition at line 245 of file recyclebin.h.

Referenced by RecycleBin5File_RecycleBinFile_QueryInterface().