ReactOS  0.4.14-dev-358-gbef841c
recyclebin.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #include <stdarg.h>
8 
9 #define WIN32_NO_STATUS
10 #define _INC_WINDOWS
11 #define COM_NO_WINDOWS_H
12 
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winnls.h>
16 #include <winver.h>
17 #include <shellapi.h>
18 #include <objbase.h>
19 
20 #define ANY_SIZE 1
21 
22 /* Structures used by the API Interface */
23 
25 {
34 {
42 #ifdef UNICODE
43 #define DELETED_FILE_DETAILS DELETED_FILE_DETAILS_W
44 #define PDELETED_FILE_DETAILS PDELETED_FILE_DETAILS_W
45 #else
46 #define DELETED_FILE_DETAILS DELETED_FILE_DETAILS_A
47 #define PDELETED_FILE_DETAILS PDELETED_FILE_DETAILS_A
48 #endif
49 
50 /* API Interface */
51 
52 /* Function called for each deleted file in the recycle bin
53  * Context: value given by the caller of the EnumerateRecycleBin function
54  * hDeletedFile: a handle to the deleted file
55  * Returning FALSE stops the enumeration.
56  * Remarks: the handle must be closed with the CloseRecycleBinHandle function
57  */
59 
60 /* Closes a file deleted handle.
61  * hDeletedFile: the handle to close
62  * Returns TRUE if operation succeeded, FALSE otherwise.
63  * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
64  */
67  IN HANDLE hDeletedFile);
68 
69 /* Moves a file to the recycle bin.
70  * FileName: the name of the file to move the recycle bin
71  * Returns TRUE if operation succeeded, FALSE otherwise.
72  */
79 #ifdef UNICODE
80 #define DeleteFileToRecycleBin DeleteFileToRecycleBinW
81 #else
82 #define DeleteFileToRecycleBin DeleteFileToRecycleBinA
83 #endif
84 
85 /* Moves a file to the recycle bin.
86  * hDeletedFile: handle of the deleted file to delete
87  * Returns TRUE if operation succeeded, FALSE otherwise.
88  * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
89  */
92  IN HANDLE hDeletedFile);
93 
94 /* Removes all elements contained in a recycle bin
95  * pszRoot: the name of the drive containing the recycle bin
96  * Returns TRUE if operation succeeded, FALSE otherwise.
97  * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
98  */
101  IN LPCSTR pszRoot OPTIONAL);
102 BOOL WINAPI
104  IN LPCWSTR pszRoot OPTIONAL);
105 #ifdef UNICODE
106 #define EmptyRecycleBin EmptyRecycleBinW
107 #else
108 #define EmptyRecycleBin EmptyRecycleBinA
109 #endif
110 
111 /* Enumerate contents of a recycle bin.
112  * pszRoot: the name of the drive containing the recycle bin
113  * pFnCallback: callback function to be called for each deleted item found
114  * Context: some value which will be given back in the callback function
115  * Returns TRUE if operation succeeded, FALSE otherwise.
116  * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
117  */
118 BOOL WINAPI
120  IN LPCSTR pszRoot OPTIONAL,
123 BOOL WINAPI
125  IN LPCWSTR pszRoot OPTIONAL,
128 #ifdef UNICODE
129 #define EnumerateRecycleBin EnumerateRecycleBinW
130 #else
131 #define EnumerateRecycleBin EnumerateRecycleBinA
132 #endif
133 
134 /* Gets details about a deleted file
135  * hDeletedFile: handle of the deleted file to get details about
136  * BufferSize: size of the 'FileDetails' buffer, in bytes
137  * FileDetails: if the function succeeded, contains details about the deleted file
138  * RequiredSize: contains the minimal buffer size required to get file information details
139  * Returns TRUE if operation succeeded, FALSE otherwise.
140  * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
141  */
142 BOOL WINAPI
144  IN HANDLE hDeletedFile,
148 BOOL WINAPI
150  IN HANDLE hDeletedFile,
154 #ifdef UNICODE
155 #define GetDeletedFileDetails GetDeletedFileDetailsW
156 #else
157 #define GetDeletedFileDetails GetDeletedFileDetailsA
158 #endif
159 
160 /* Get details about a whole recycle bin
161  * pszVolume:
162  * pulTotalItems:
163  * pulTotalSize
164  */
165 BOOL WINAPI
167  IN LPCWSTR pszVolume OPTIONAL,
168  OUT ULARGE_INTEGER *pulTotalItems,
169  OUT ULARGE_INTEGER *pulTotalSize);
170 
171 /* Restores a deleted file
172  * hDeletedFile: handle of the deleted file to restore
173  * Returns TRUE if operation succeeded, FALSE otherwise.
174  * Remarks: if the function succeeds, the handle is not valid anymore.
175  */
176 BOOL WINAPI
178  IN HANDLE hDeletedFile);
179 
180 /* COM interface */
181 
182 #undef INTERFACE
183 #define INTERFACE IRecycleBinFile
184 
185 DECLARE_INTERFACE_(IRecycleBinFile, IUnknown)
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 };
206 
207 #undef INTERFACE
208 #define INTERFACE IRecycleBinEnumList
209 
210 DECLARE_INTERFACE_(IRecycleBinEnumList, IUnknown)
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 };
226 
227 #undef INTERFACE
228 #define INTERFACE IRecycleBin
229 
231 {
233 
234  /* IUnknown methods */
238 
239  /* IRecycleBin methods */
240  STDMETHOD(DeleteFile)(THIS_ LPCWSTR szFileName);
242  STDMETHOD(EnumObjects)(THIS_ IRecycleBinEnumList **ppEnumList);
243 
245 };
246 
250 
251 #if (!defined(__cplusplus) || defined(CINTERFACE)) && defined(COBJMACROS)
252 #define IRecycleBinFile_QueryInterface(This, riid, ppvObject) \
253  (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
254 #define IRecycleBinFile_AddRef(This) \
255  (This)->lpVtbl->AddRef(This)
256 #define IRecycleBinFile_Release(This) \
257  (This)->lpVtbl->Release(This)
258 #define IRecycleBinFile_GetLastModificationTime(This, pLastModificationTime) \
259  (This)->lpVtbl->GetLastModificationTime(This, pLastModificationTime)
260 #define IRecycleBinFile_GetDeletionTime(This, pDeletionTime) \
261  (This)->lpVtbl->GetDeletionTime(This, pDeletionTime)
262 #define IRecycleBinFile_GetFileSize(This, pFileSize) \
263  (This)->lpVtbl->GetFileSize(This, pFileSize)
264 #define IRecycleBinFile_GetPhysicalFileSize(This, pPhysicalFileSize) \
265  (This)->lpVtbl->GetPhysicalFileSize(This, pPhysicalFileSize)
266 #define IRecycleBinFile_GetAttributes(This, pAttributes) \
267  (This)->lpVtbl->GetAttributes(This, pAttributes)
268 #define IRecycleBinFile_GetFileName(This, BufferSize, Buffer, RequiredSize) \
269  (This)->lpVtbl->GetFileName(This, BufferSize, Buffer, RequiredSize)
270 #define IRecycleBinFile_Delete(This) \
271  (This)->lpVtbl->Delete(This)
272 #define IRecycleBinFile_Restore(This) \
273  (This)->lpVtbl->Restore(This)
274 
275 #define IRecycleBinEnumList_QueryInterface(This, riid, ppvObject) \
276  (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
277 #define IRecycleBinEnumList_AddRef(This) \
278  (This)->lpVtbl->AddRef(This)
279 #define IRecycleBinEnumList_Release(This) \
280  (This)->lpVtbl->Release(This)
281 #define IRecycleBinEnumList_Next(This, celt, rgelt, pceltFetched) \
282  (This)->lpVtbl->Next(This, celt, rgelt, pceltFetched)
283 #define IRecycleBinEnumList_Skip(This, celt) \
284  (This)->lpVtbl->Skip(This, celt)
285 #define IRecycleBinEnumList_Reset(This) \
286  (This)->lpVtbl->Reset(This)
287 
288 #define IRecycleBin_QueryInterface(This, riid, ppvObject) \
289  (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
290 #define IRecycleBin_AddRef(This) \
291  (This)->lpVtbl->AddRef(This)
292 #define IRecycleBin_Release(This) \
293  (This)->lpVtbl->Release(This)
294 #define IRecycleBin_DeleteFile(This, szFileName) \
295  (This)->lpVtbl->DeleteFile(This, szFileName)
296 #define IRecycleBin_EmptyRecycleBin(This) \
297  (This)->lpVtbl->EmptyRecycleBin(This)
298 #define IRecycleBin_EnumObjects(This, ppEnumList) \
299  (This)->lpVtbl->EnumObjects(This, ppEnumList)
300 #endif
301 
304  IN LPCWSTR pszVolume OPTIONAL,
305  OUT IRecycleBin **pprb);
306 
307 #ifdef __cplusplus
308 }
309 #endif
#define IN
Definition: typedefs.h:38
EXTERN_C const IID IID_IRecycleBin
Definition: recyclebin.h:249
#define REFIID
Definition: guiddef.h:118
#define THIS_
Definition: basetyps.h:65
_In_ BOOLEAN Release
Definition: classpnp.h:929
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
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
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:248
char CHAR
Definition: xmlstorage.h:175
ULARGE_INTEGER PhysicalFileSize
Definition: recyclebin.h:38
EXTERN_C const IID IID_IRecycleBinFile
Definition: recyclebin.h:245
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
BOOL WINAPI RestoreFile(IN HANDLE hDeletedFile)
Definition: recyclebin.c:366
#define DeleteFile
Definition: winbase.h:3588
#define BOOL
Definition: nt_native.h:43
struct _DELETED_FILE_DETAILS_A * PDELETED_FILE_DETAILS_A
int WINAPI EnumObjects(_In_ HDC, _In_ int, _In_ GOBJENUMPROC, _In_ LPARAM)
#define STDMETHOD(m)
Definition: basetyps.h:62
struct _DELETED_FILE_DETAILS_A DELETED_FILE_DETAILS_A
BOOL(WINAPI * PENUMERATE_RECYCLEBIN_CALLBACK)(IN PVOID Context, IN HANDLE hDeletedFile)
Definition: recyclebin.h:58
BOOL WINAPI EnumerateRecycleBinA(IN LPCSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:171
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI EmptyRecycleBinA(IN LPCSTR pszRoot OPTIONAL)
Definition: recyclebin.c:113
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
ULARGE_INTEGER PhysicalFileSize
Definition: recyclebin.h:29
DECLARE_INTERFACE_(IRecycleBinFile, IUnknown)
Definition: recyclebin.h:185
#define END_INTERFACE
Definition: objbase.h:232
const char * LPCSTR
Definition: xmlstorage.h:183
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
struct _DELETED_FILE_DETAILS_W DELETED_FILE_DETAILS_W
BOOL WINAPI GetDeletedFileDetailsA(IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_A FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:256
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define EmptyRecycleBin
Definition: recyclebin.h:108
#define WINAPI
Definition: msvc.h:8
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:385
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
ULARGE_INTEGER FileSize
Definition: recyclebin.h:37
ULARGE_INTEGER FileSize
Definition: recyclebin.h:28
REFIID LPVOID * ppvObject
Definition: precomp.h:44
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
BOOL WINAPI DeleteFileToRecycleBinW(IN LPCWSTR FileName)
Definition: recyclebin.c:67
ULONG_PTR SIZE_T
Definition: typedefs.h:78
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HANDLE hDeletedFile)
Definition: recyclebin.c:93
struct _DELETED_FILE_DETAILS_W * PDELETED_FILE_DETAILS_W
#define PURE
Definition: basetyps.h:64
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define ANY_SIZE
Definition: recyclebin.h:20
BOOL WINAPI EmptyRecycleBinW(IN LPCWSTR pszRoot OPTIONAL)
Definition: recyclebin.c:145
#define OUT
Definition: typedefs.h:39
uint32_t * LPDWORD
Definition: typedefs.h:57
struct tagContext Context
Definition: acpixf.h:1030
unsigned int ULONG
Definition: retypes.h:1
BOOL WINAPI DeleteFileToRecycleBinA(IN LPCSTR FileName)
Definition: recyclebin.c:31
BOOL WINAPI GetRecycleBinDetails(IN LPCWSTR pszVolume OPTIONAL, OUT ULARGE_INTEGER *pulTotalItems, OUT ULARGE_INTEGER *pulTotalSize)
Definition: recyclebin.c:354
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define EXTERN_C
Definition: basetyps.h:12
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68