ReactOS 0.4.15-dev-7924-g5949c20
recyclebin.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef __cplusplus
4extern "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);
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 */
120 IN LPCSTR pszRoot OPTIONAL,
125 IN LPCWSTR pszRoot OPTIONAL,
128#ifdef UNICODE
129#define EnumerateRecycleBin EnumerateRecycleBinW
130#else
131#define EnumerateRecycleBin EnumerateRecycleBinA
132#endif
133
136 IN HANDLE hDeletedFile,
137 OUT LPWSTR pTypeName,
140
141/* Gets details about a deleted file
142 * hDeletedFile: handle of the deleted file to get details about
143 * BufferSize: size of the 'FileDetails' buffer, in bytes
144 * FileDetails: if the function succeeded, contains details about the deleted file
145 * RequiredSize: contains the minimal buffer size required to get file information details
146 * Returns TRUE if operation succeeded, FALSE otherwise.
147 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
148 */
151 IN HANDLE hDeletedFile,
157 IN HANDLE hDeletedFile,
161#ifdef UNICODE
162#define GetDeletedFileDetails GetDeletedFileDetailsW
163#else
164#define GetDeletedFileDetails GetDeletedFileDetailsA
165#endif
166
167/* Restores a deleted file
168 * hDeletedFile: handle of the deleted file to restore
169 * Returns TRUE if operation succeeded, FALSE otherwise.
170 * Remarks: if the function succeeds, the handle is not valid anymore.
171 */
174 IN HANDLE hDeletedFile);
175
176/* COM interface */
177
178#define INTERFACE IRecycleBinFile
180{
182
183 /* IUnknown methods */
187
188 /* IRecycleBinFile methods */
189 STDMETHOD(GetLastModificationTime)(THIS_ FILETIME *pLastModificationTime) PURE;
190 STDMETHOD(GetDeletionTime)(THIS_ FILETIME *pDeletionTime) PURE;
193 STDMETHOD(GetAttributes)(THIS_ DWORD *pAttributes) PURE;
197 STDMETHOD(Restore)(THIS) PURE;
198
200};
201#undef INTERFACE
202
203#define INTERFACE IRecycleBinEnumList
204DECLARE_INTERFACE_(IRecycleBinEnumList, IUnknown)
205{
207
208 /* IUnknown methods */
212
213 /* IRecycleBinEnumList methods */
214 STDMETHOD(Next)(THIS_ DWORD celt, IRecycleBinFile **rgelt, DWORD *pceltFetched);
215 STDMETHOD(Skip)(THIS_ DWORD celt) PURE;
216 STDMETHOD(Reset)(THIS) PURE;
217
219};
220#undef INTERFACE
221
222#define INTERFACE IRecycleBin
224{
226
227 /* IUnknown methods */
231
232 /* IRecycleBin methods */
233 STDMETHOD(DeleteFile)(THIS_ LPCWSTR szFileName);
235 STDMETHOD(EnumObjects)(THIS_ IRecycleBinEnumList **ppEnumList);
236
238};
239#undef INTERFACE
240
244
245#if (!defined(__cplusplus) || defined(CINTERFACE)) && defined(COBJMACROS)
246#define IRecycleBinFile_QueryInterface(This, riid, ppvObject) \
247 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
248#define IRecycleBinFile_AddRef(This) \
249 (This)->lpVtbl->AddRef(This)
250#define IRecycleBinFile_Release(This) \
251 (This)->lpVtbl->Release(This)
252#define IRecycleBinFile_GetLastModificationTime(This, pLastModificationTime) \
253 (This)->lpVtbl->GetLastModificationTime(This, pLastModificationTime)
254#define IRecycleBinFile_GetDeletionTime(This, pDeletionTime) \
255 (This)->lpVtbl->GetDeletionTime(This, pDeletionTime)
256#define IRecycleBinFile_GetFileSize(This, pFileSize) \
257 (This)->lpVtbl->GetFileSize(This, pFileSize)
258#define IRecycleBinFile_GetPhysicalFileSize(This, pPhysicalFileSize) \
259 (This)->lpVtbl->GetPhysicalFileSize(This, pPhysicalFileSize)
260#define IRecycleBinFile_GetAttributes(This, pAttributes) \
261 (This)->lpVtbl->GetAttributes(This, pAttributes)
262#define IRecycleBinFile_GetFileName(This, BufferSize, Buffer, RequiredSize) \
263 (This)->lpVtbl->GetFileName(This, BufferSize, Buffer, RequiredSize)
264#define IRecycleBinFile_GetTypeName(This, BufferSize, Buffer, RequiredSize) \
265 (This)->lpVtbl->GetTypeName(This, BufferSize, Buffer, RequiredSize)
266#define IRecycleBinFile_Delete(This) \
267 (This)->lpVtbl->Delete(This)
268#define IRecycleBinFile_Restore(This) \
269 (This)->lpVtbl->Restore(This)
270
271#define IRecycleBinEnumList_QueryInterface(This, riid, ppvObject) \
272 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
273#define IRecycleBinEnumList_AddRef(This) \
274 (This)->lpVtbl->AddRef(This)
275#define IRecycleBinEnumList_Release(This) \
276 (This)->lpVtbl->Release(This)
277#define IRecycleBinEnumList_Next(This, celt, rgelt, pceltFetched) \
278 (This)->lpVtbl->Next(This, celt, rgelt, pceltFetched)
279#define IRecycleBinEnumList_Skip(This, celt) \
280 (This)->lpVtbl->Skip(This, celt)
281#define IRecycleBinEnumList_Reset(This) \
282 (This)->lpVtbl->Reset(This)
283
284#define IRecycleBin_QueryInterface(This, riid, ppvObject) \
285 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
286#define IRecycleBin_AddRef(This) \
287 (This)->lpVtbl->AddRef(This)
288#define IRecycleBin_Release(This) \
289 (This)->lpVtbl->Release(This)
290#define IRecycleBin_DeleteFile(This, szFileName) \
291 (This)->lpVtbl->DeleteFile(This, szFileName)
292#define IRecycleBin_EmptyRecycleBin(This) \
293 (This)->lpVtbl->EmptyRecycleBin(This)
294#define IRecycleBin_EnumObjects(This, ppEnumList) \
295 (This)->lpVtbl->EnumObjects(This, ppEnumList)
296#endif
297
300 IN LPCWSTR pszVolume OPTIONAL,
301 OUT IRecycleBin **pprb);
302
303#ifdef __cplusplus
304}
305#endif
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
#define DECLARE_INTERFACE_(i, b)
Definition: basetyps.h:78
#define PURE
Definition: basetyps.h:64
#define THIS_
Definition: basetyps.h:65
#define EXTERN_C
Definition: basetyps.h:12
#define THIS
Definition: basetyps.h:66
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
#define STDMETHOD(m)
Definition: basetyps.h:62
static PWCHAR GetFileName(PWCHAR Path)
Definition: cabinet.c:387
_In_ BOOLEAN Release
Definition: cdrom.h:920
Definition: bufpool.h:45
#define BufferSize
Definition: mmc.h:75
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL GetPhysicalFileSize(LPCWSTR PathBuffer, PULARGE_INTEGER Size)
Definition: filedefext.cpp:32
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
TCHAR * GetTypeName(HANDLE handle)
Definition: handlelist.c:127
REFIID riid
Definition: atlbase.h:39
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define BOOL
Definition: nt_native.h:43
#define END_INTERFACE
Definition: objbase.h:232
#define BEGIN_INTERFACE
Definition: objbase.h:231
#define REFIID
Definition: guiddef.h:118
EXTERN_C const IID IID_IRecycleBin
Definition: recyclebin.h:243
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HANDLE hDeletedFile)
Definition: recyclebin.c:93
BOOL WINAPI EnumerateRecycleBinA(IN LPCSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:171
BOOL WINAPI DeleteFileToRecycleBinA(IN LPCSTR FileName)
Definition: recyclebin.c:31
BOOL WINAPI DeleteFileToRecycleBinW(IN LPCWSTR FileName)
Definition: recyclebin.c:67
BOOL WINAPI GetDeletedFileDetailsW(IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:327
BOOL WINAPI GetDeletedFileDetailsA(IN HANDLE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_A FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:282
struct _DELETED_FILE_DETAILS_A * PDELETED_FILE_DETAILS_A
BOOL WINAPI CloseRecycleBinHandle(IN HANDLE hDeletedFile)
Definition: recyclebin.c:12
struct _DELETED_FILE_DETAILS_W * PDELETED_FILE_DETAILS_W
BOOL(WINAPI * PENUMERATE_RECYCLEBIN_CALLBACK)(IN PVOID Context, IN HANDLE hDeletedFile)
Definition: recyclebin.h:58
struct _DELETED_FILE_DETAILS_A DELETED_FILE_DETAILS_A
BOOL WINAPI GetDeletedFileTypeNameW(IN HANDLE hDeletedFile, OUT LPWSTR pTypeName, IN DWORD BufferSize, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:256
#define ANY_SIZE
Definition: recyclebin.h:20
BOOL WINAPI EmptyRecycleBinA(IN LPCSTR pszRoot OPTIONAL)
Definition: recyclebin.c:113
BOOL WINAPI EmptyRecycleBinW(IN LPCWSTR pszRoot OPTIONAL)
Definition: recyclebin.c:145
EXTERN_C const IID IID_IRecycleBinFile
Definition: recyclebin.h:241
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:399
BOOL WINAPI RestoreFile(IN HANDLE hDeletedFile)
Definition: recyclebin.c:380
struct _DELETED_FILE_DETAILS_W DELETED_FILE_DETAILS_W
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:242
#define EmptyRecycleBin
Definition: recyclebin.h:108
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULARGE_INTEGER FileSize
Definition: recyclebin.h:28
ULARGE_INTEGER PhysicalFileSize
Definition: recyclebin.h:29
ULARGE_INTEGER FileSize
Definition: recyclebin.h:37
ULARGE_INTEGER PhysicalFileSize
Definition: recyclebin.h:38
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_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 DeleteFile
Definition: winbase.h:3764
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define WINAPI
Definition: msvc.h:6
int WINAPI EnumObjects(_In_ HDC, _In_ int, _In_ GOBJENUMPROC, _In_ LPARAM)
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175