ReactOS 0.4.16-dev-336-gb667d82
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/* Distinct handle type for deleted file/folder */
52
53/* API Interface */
54
55/* Function called for each deleted file in the recycle bin
56 * Context: value given by the caller of the EnumerateRecycleBin function
57 * hDeletedFile: a handle to the deleted file
58 * Returning FALSE stops the enumeration.
59 * Remarks: the handle must be closed with the CloseRecycleBinHandle function
60 */
61typedef BOOL (WINAPI *PENUMERATE_RECYCLEBIN_CALLBACK)(IN PVOID Context, IN HDELFILE hDeletedFile);
62
63/* Closes a file deleted handle.
64 * hDeletedFile: the handle to close
65 * Returns TRUE if operation succeeded, FALSE otherwise.
66 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
67 */
70 IN HDELFILE hDeletedFile);
71
72/* Moves a file to the recycle bin.
73 * FileName: the name of the file to move the recycle bin
74 * Returns TRUE if operation succeeded, FALSE otherwise.
75 */
82#ifdef UNICODE
83#define DeleteFileToRecycleBin DeleteFileToRecycleBinW
84#else
85#define DeleteFileToRecycleBin DeleteFileToRecycleBinA
86#endif
87
88/* Moves a file to the recycle bin.
89 * hDeletedFile: handle of the deleted file to delete
90 * Returns TRUE if operation succeeded, FALSE otherwise.
91 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
92 */
95 IN HDELFILE hDeletedFile);
96
97/* Removes all elements contained in a recycle bin
98 * pszRoot: the name of the drive containing the recycle bin
99 * Returns TRUE if operation succeeded, FALSE otherwise.
100 * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
101 */
104 IN LPCSTR pszRoot OPTIONAL);
107 IN LPCWSTR pszRoot OPTIONAL);
108#ifdef UNICODE
109#define EmptyRecycleBin EmptyRecycleBinW
110#else
111#define EmptyRecycleBin EmptyRecycleBinA
112#endif
113
114/* Enumerate contents of a recycle bin.
115 * pszRoot: the name of the drive containing the recycle bin
116 * pFnCallback: callback function to be called for each deleted item found
117 * Context: some value which will be given back in the callback function
118 * Returns TRUE if operation succeeded, FALSE otherwise.
119 * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
120 */
123 IN LPCSTR pszRoot OPTIONAL,
128 IN LPCWSTR pszRoot OPTIONAL,
131#ifdef UNICODE
132#define EnumerateRecycleBin EnumerateRecycleBinW
133#else
134#define EnumerateRecycleBin EnumerateRecycleBinA
135#endif
136
139 IN HDELFILE hDeletedFile,
140 OUT LPWSTR pTypeName,
143
144/* Gets details about a deleted file
145 * hDeletedFile: handle of the deleted file to get details about
146 * BufferSize: size of the 'FileDetails' buffer, in bytes
147 * FileDetails: if the function succeeded, contains details about the deleted file
148 * RequiredSize: contains the minimal buffer size required to get file information details
149 * Returns TRUE if operation succeeded, FALSE otherwise.
150 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
151 */
154 IN HDELFILE hDeletedFile,
160 IN HDELFILE hDeletedFile,
164#ifdef UNICODE
165#define GetDeletedFileDetails GetDeletedFileDetailsW
166#else
167#define GetDeletedFileDetails GetDeletedFileDetailsA
168#endif
169
170/* Restores a deleted file
171 * hDeletedFile: handle of the deleted file to restore
172 * Returns TRUE if operation succeeded, FALSE otherwise.
173 * Remarks: if the function succeeds, the handle is not valid anymore.
174 */
177 IN HDELFILE hDeletedFile);
178
179/* COM interface */
180
181#define INTERFACE IRecycleBinFile
183{
185
186 /* IUnknown methods */
190
191 /* IRecycleBinFile methods */
192 STDMETHOD(GetLastModificationTime)(THIS_ FILETIME *pLastModificationTime) PURE;
193 STDMETHOD(GetDeletionTime)(THIS_ FILETIME *pDeletionTime) PURE;
196 STDMETHOD(GetAttributes)(THIS_ DWORD *pAttributes) PURE;
200 STDMETHOD(Restore)(THIS) PURE;
201
203};
204#undef INTERFACE
205
206#define INTERFACE IRecycleBinEnumList
207DECLARE_INTERFACE_(IRecycleBinEnumList, IUnknown)
208{
210
211 /* IUnknown methods */
215
216 /* IRecycleBinEnumList methods */
217 STDMETHOD(Next)(THIS_ DWORD celt, IRecycleBinFile **rgelt, DWORD *pceltFetched) PURE;
218 STDMETHOD(Skip)(THIS_ DWORD celt) PURE;
219 STDMETHOD(Reset)(THIS) PURE;
220
222};
223#undef INTERFACE
224
225#define INTERFACE IRecycleBin
227{
229
230 /* IUnknown methods */
234
235 /* IRecycleBin methods */
236 STDMETHOD(DeleteFile)(THIS_ LPCWSTR szFileName);
238 STDMETHOD(EnumObjects)(THIS_ IRecycleBinEnumList **ppEnumList);
239
241};
242#undef INTERFACE
243
247
248#if (!defined(__cplusplus) || defined(CINTERFACE)) && defined(COBJMACROS)
249#define IRecycleBinFile_QueryInterface(This, riid, ppvObject) \
250 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
251#define IRecycleBinFile_AddRef(This) \
252 (This)->lpVtbl->AddRef(This)
253#define IRecycleBinFile_Release(This) \
254 (This)->lpVtbl->Release(This)
255#define IRecycleBinFile_GetLastModificationTime(This, pLastModificationTime) \
256 (This)->lpVtbl->GetLastModificationTime(This, pLastModificationTime)
257#define IRecycleBinFile_GetDeletionTime(This, pDeletionTime) \
258 (This)->lpVtbl->GetDeletionTime(This, pDeletionTime)
259#define IRecycleBinFile_GetFileSize(This, pFileSize) \
260 (This)->lpVtbl->GetFileSize(This, pFileSize)
261#define IRecycleBinFile_GetPhysicalFileSize(This, pPhysicalFileSize) \
262 (This)->lpVtbl->GetPhysicalFileSize(This, pPhysicalFileSize)
263#define IRecycleBinFile_GetAttributes(This, pAttributes) \
264 (This)->lpVtbl->GetAttributes(This, pAttributes)
265#define IRecycleBinFile_GetFileName(This, BufferSize, Buffer, RequiredSize) \
266 (This)->lpVtbl->GetFileName(This, BufferSize, Buffer, RequiredSize)
267#define IRecycleBinFile_GetTypeName(This, BufferSize, Buffer, RequiredSize) \
268 (This)->lpVtbl->GetTypeName(This, BufferSize, Buffer, RequiredSize)
269#define IRecycleBinFile_Delete(This) \
270 (This)->lpVtbl->Delete(This)
271#define IRecycleBinFile_Restore(This) \
272 (This)->lpVtbl->Restore(This)
273
274#define IRecycleBinEnumList_QueryInterface(This, riid, ppvObject) \
275 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
276#define IRecycleBinEnumList_AddRef(This) \
277 (This)->lpVtbl->AddRef(This)
278#define IRecycleBinEnumList_Release(This) \
279 (This)->lpVtbl->Release(This)
280#define IRecycleBinEnumList_Next(This, celt, rgelt, pceltFetched) \
281 (This)->lpVtbl->Next(This, celt, rgelt, pceltFetched)
282#define IRecycleBinEnumList_Skip(This, celt) \
283 (This)->lpVtbl->Skip(This, celt)
284#define IRecycleBinEnumList_Reset(This) \
285 (This)->lpVtbl->Reset(This)
286
287#define IRecycleBin_QueryInterface(This, riid, ppvObject) \
288 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
289#define IRecycleBin_AddRef(This) \
290 (This)->lpVtbl->AddRef(This)
291#define IRecycleBin_Release(This) \
292 (This)->lpVtbl->Release(This)
293#define IRecycleBin_DeleteFile(This, szFileName) \
294 (This)->lpVtbl->DeleteFile(This, szFileName)
295#define IRecycleBin_EmptyRecycleBin(This) \
296 (This)->lpVtbl->EmptyRecycleBin(This)
297#define IRecycleBin_EnumObjects(This, ppEnumList) \
298 (This)->lpVtbl->EnumObjects(This, ppEnumList)
299#endif
300
303 IN LPCWSTR pszVolume OPTIONAL,
304 OUT IRecycleBin **pprb);
305
306#ifdef __cplusplus
307}
308#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
static LPWSTR GetTypeName(PFILE_TYPE_ENTRY Entry, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:287
REFIID riid
Definition: atlbase.h:39
#define DECLARE_HANDLE(name)
Definition: mimeole.idl:23
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:246
BOOL WINAPI RestoreFile(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:380
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
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 GetDeletedFileDetailsA(IN HDELFILE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_A FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:282
BOOL WINAPI CloseRecycleBinHandle(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:12
struct _DELETED_FILE_DETAILS_A * PDELETED_FILE_DETAILS_A
struct _DELETED_FILE_DETAILS_W * PDELETED_FILE_DETAILS_W
struct _DELETED_FILE_DETAILS_A DELETED_FILE_DETAILS_A
#define ANY_SIZE
Definition: recyclebin.h:20
BOOL WINAPI GetDeletedFileTypeNameW(IN HDELFILE hDeletedFile, OUT LPWSTR pTypeName, IN DWORD BufferSize, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:256
BOOL(WINAPI * PENUMERATE_RECYCLEBIN_CALLBACK)(IN PVOID Context, IN HDELFILE hDeletedFile)
Definition: recyclebin.h:61
BOOL WINAPI GetDeletedFileDetailsW(IN HDELFILE hDeletedFile, IN DWORD BufferSize, IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL, OUT LPDWORD RequiredSize OPTIONAL)
Definition: recyclebin.c:327
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:244
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:93
HRESULT WINAPI GetDefaultRecycleBin(IN LPCWSTR pszVolume OPTIONAL, OUT IRecycleBin **pprb)
Definition: recyclebin.c:399
struct _DELETED_FILE_DETAILS_W DELETED_FILE_DETAILS_W
EXTERN_C const IID IID_IRecycleBinEnumList
Definition: recyclebin.h:245
#define EmptyRecycleBin
Definition: recyclebin.h:111
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:3789
_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