12 /* Structures used by the API Interface */
14 typedef struct _DELETED_FILE_DETAILS_A
16 FILETIME LastModification
;
17 FILETIME DeletionTime
;
18 ULARGE_INTEGER FileSize
;
19 ULARGE_INTEGER PhysicalFileSize
;
21 CHAR FileName
[ANY_SIZE
];
22 } DELETED_FILE_DETAILS_A
, *PDELETED_FILE_DETAILS_A
;
23 typedef struct _DELETED_FILE_DETAILS_W
25 FILETIME LastModification
;
26 FILETIME DeletionTime
;
27 ULARGE_INTEGER FileSize
;
28 ULARGE_INTEGER PhysicalFileSize
;
30 WCHAR FileName
[ANY_SIZE
];
31 } DELETED_FILE_DETAILS_W
, *PDELETED_FILE_DETAILS_W
;
33 #define DELETED_FILE_DETAILS DELETED_FILE_DETAILS_W
34 #define PDELETED_FILE_DETAILS PDELETED_FILE_DETAILS_W
36 #define DELETED_FILE_DETAILS DELETED_FILE_DETAILS_A
37 #define PDELETED_FILE_DETAILS PDELETED_FILE_DETAILS_A
42 /* Function called for each deleted file in the recycle bin
43 * Context: value given by the caller of the EnumerateRecycleBin function
44 * hDeletedFile: a handle to the deleted file
45 * Returning FALSE stops the enumeration.
46 * Remarks: the handle must be closed with the CloseRecycleBinHandle function
48 typedef BOOL (WINAPI
*PENUMERATE_RECYCLEBIN_CALLBACK
)(IN PVOID Context
, IN HANDLE hDeletedFile
);
50 /* Closes a file deleted handle.
51 * hDeletedFile: the handle to close
52 * Returns TRUE if operation succeeded, FALSE otherwise.
53 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
56 CloseRecycleBinHandle(
57 IN HANDLE hDeletedFile
);
59 /* Moves a file to the recycle bin.
60 * FileName: the name of the file to move the recycle bin
61 * Returns TRUE if operation succeeded, FALSE otherwise.
64 DeleteFileToRecycleBinA(
67 DeleteFileToRecycleBinW(
70 #define DeleteFileToRecycleBin DeleteFileToRecycleBinW
72 #define DeleteFileToRecycleBin DeleteFileToRecycleBinA
75 /* Moves a file to the recycle bin.
76 * hDeletedFile: handle of the deleted file to delete
77 * Returns TRUE if operation succeeded, FALSE otherwise.
78 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
81 DeleteFileHandleToRecycleBin(
82 IN HANDLE hDeletedFile
);
84 /* Removes all elements contained in a recycle bin
85 * pszRoot: the name of the drive containing the recycle bin
86 * Returns TRUE if operation succeeded, FALSE otherwise.
87 * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
91 IN LPCSTR pszRoot OPTIONAL
);
94 IN LPCWSTR pszRoot OPTIONAL
);
96 #define EmptyRecycleBin EmptyRecycleBinW
98 #define EmptyRecycleBin EmptyRecycleBinA
101 /* Enumerate contents of a recycle bin.
102 * pszRoot: the name of the drive containing the recycle bin
103 * pFnCallback: callback function to be called for each deleted item found
104 * Context: some value which will be given back in the callback function
105 * Returns TRUE if operation succeeded, FALSE otherwise.
106 * Remarks: 'pszRoot' can be NULL to mean 'all recycle bins'.
109 EnumerateRecycleBinA(
110 IN LPCSTR pszRoot OPTIONAL
,
111 IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback
,
112 IN PVOID Context OPTIONAL
);
114 EnumerateRecycleBinW(
115 IN LPCWSTR pszRoot OPTIONAL
,
116 IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback
,
117 IN PVOID Context OPTIONAL
);
119 #define EnumerateRecycleBin EnumerateRecycleBinW
121 #define EnumerateRecycleBin EnumerateRecycleBinA
124 /* Gets details about a deleted file
125 * hDeletedFile: handle of the deleted file to get details about
126 * BufferSize: size of the 'FileDetails' buffer, in bytes
127 * FileDetails: if the function succeeded, contains details about the deleted file
128 * RequiredSize: contains the minimal buffer size required to get file information details
129 * Returns TRUE if operation succeeded, FALSE otherwise.
130 * Remark: The handle is obtained in the PENUMERATE_RECYCLEBIN_CALLBACK callback
133 GetDeletedFileDetailsA(
134 IN HANDLE hDeletedFile
,
136 IN OUT PDELETED_FILE_DETAILS_A FileDetails OPTIONAL
,
137 OUT LPDWORD RequiredSize OPTIONAL
);
139 GetDeletedFileDetailsW(
140 IN HANDLE hDeletedFile
,
142 IN OUT PDELETED_FILE_DETAILS_W FileDetails OPTIONAL
,
143 OUT LPDWORD RequiredSize OPTIONAL
);
145 #define GetDeletedFileDetails GetDeletedFileDetailsW
147 #define GetDeletedFileDetails GetDeletedFileDetailsA
150 /* Get details about a whole recycle bin
156 GetRecycleBinDetails(
157 IN LPCWSTR pszVolume OPTIONAL
,
158 OUT ULARGE_INTEGER
*pulTotalItems
,
159 OUT ULARGE_INTEGER
*pulTotalSize
);
161 /* Restores a deleted file
162 * hDeletedFile: handle of the deleted file to restore
163 * Returns TRUE if operation succeeded, FALSE otherwise.
164 * Remarks: if the function succeeds, the handle is not valid anymore.
168 IN HANDLE hDeletedFile
);
173 #define INTERFACE IRecycleBinFile
175 DECLARE_INTERFACE_(IRecycleBinFile
, IUnknown
)
179 /* IUnknown methods */
180 STDMETHOD(QueryInterface
)(THIS_ REFIID riid
, void **ppvObject
) PURE
;
181 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
182 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
184 /* IRecycleBinFile methods */
185 STDMETHOD(GetLastModificationTime
)(THIS_ FILETIME
*pLastModificationTime
) PURE
;
186 STDMETHOD(GetDeletionTime
)(THIS_ FILETIME
*pDeletionTime
) PURE
;
187 STDMETHOD(GetFileSize
)(THIS_ ULARGE_INTEGER
*pFileSize
) PURE
;
188 STDMETHOD(GetPhysicalFileSize
)(THIS_ ULARGE_INTEGER
*pPhysicalFileSize
) PURE
;
189 STDMETHOD(GetAttributes
)(THIS_ DWORD
*pAttributes
) PURE
;
190 STDMETHOD(GetFileName
)(THIS_ SIZE_T BufferSize
, LPWSTR Buffer
, SIZE_T
*RequiredSize
) PURE
;
191 STDMETHOD(Delete
)(THIS
) PURE
;
192 STDMETHOD(Restore
)(THIS
) PURE
;
198 #define INTERFACE IRecycleBinEnumList
200 DECLARE_INTERFACE_(IRecycleBinEnumList
, IUnknown
)
204 /* IUnknown methods */
205 STDMETHOD(QueryInterface
)(THIS_ REFIID riid
, void **ppvObject
) PURE
;
206 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
207 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
209 /* IRecycleBinEnumList methods */
210 STDMETHOD(Next
)(THIS_ DWORD celt
, IRecycleBinFile
**rgelt
, DWORD
*pceltFetched
);
211 STDMETHOD(Skip
)(THIS_ DWORD celt
) PURE
;
212 STDMETHOD(Reset
)(THIS
) PURE
;
218 #define INTERFACE IRecycleBin
220 DECLARE_INTERFACE_(IRecycleBin
, IUnknown
)
224 /* IUnknown methods */
225 STDMETHOD(QueryInterface
)(THIS_ REFIID riid
, void **ppvObject
) PURE
;
226 STDMETHOD_(ULONG
, AddRef
)(THIS
) PURE
;
227 STDMETHOD_(ULONG
, Release
)(THIS
) PURE
;
229 /* IRecycleBin methods */
230 STDMETHOD(DeleteFile
)(THIS_ LPCWSTR szFileName
);
231 STDMETHOD(EmptyRecycleBin
)(THIS
);
232 STDMETHOD(EnumObjects
)(THIS_ IRecycleBinEnumList
**ppEnumList
);
237 EXTERN_C
const IID IID_IRecycleBinFile
;
238 EXTERN_C
const IID IID_IRecycleBinEnumList
;
239 EXTERN_C
const IID IID_IRecycleBin
;
241 #if (!defined(__cplusplus) || defined(CINTERFACE)) && defined(COBJMACROS)
242 #define IRecycleBinFile_QueryInterface(This, riid, ppvObject) \
243 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
244 #define IRecycleBinFile_AddRef(This) \
245 (This)->lpVtbl->AddRef(This)
246 #define IRecycleBinFile_Release(This) \
247 (This)->lpVtbl->Release(This)
248 #define IRecycleBinFile_GetLastModificationTime(This, pLastModificationTime) \
249 (This)->lpVtbl->GetLastModificationTime(This, pLastModificationTime)
250 #define IRecycleBinFile_GetDeletionTime(This, pDeletionTime) \
251 (This)->lpVtbl->GetDeletionTime(This, pDeletionTime)
252 #define IRecycleBinFile_GetFileSize(This, pFileSize) \
253 (This)->lpVtbl->GetFileSize(This, pFileSize)
254 #define IRecycleBinFile_GetPhysicalFileSize(This, pPhysicalFileSize) \
255 (This)->lpVtbl->GetPhysicalFileSize(This, pPhysicalFileSize)
256 #define IRecycleBinFile_GetAttributes(This, pAttributes) \
257 (This)->lpVtbl->GetAttributes(This, pAttributes)
258 #define IRecycleBinFile_GetFileName(This, BufferSize, Buffer, RequiredSize) \
259 (This)->lpVtbl->GetFileName(This, BufferSize, Buffer, RequiredSize)
260 #define IRecycleBinFile_Delete(This) \
261 (This)->lpVtbl->Delete(This)
262 #define IRecycleBinFile_Restore(This) \
263 (This)->lpVtbl->Restore(This)
265 #define IRecycleBinEnumList_QueryInterface(This, riid, ppvObject) \
266 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
267 #define IRecycleBinEnumList_AddRef(This) \
268 (This)->lpVtbl->AddRef(This)
269 #define IRecycleBinEnumList_Release(This) \
270 (This)->lpVtbl->Release(This)
271 #define IRecycleBinEnumList_Next(This, celt, rgelt, pceltFetched) \
272 (This)->lpVtbl->Next(This, celt, rgelt, pceltFetched)
273 #define IRecycleBinEnumList_Skip(This, celt) \
274 (This)->lpVtbl->Skip(This, celt)
275 #define IRecycleBinEnumList_Reset(This) \
276 (This)->lpVtbl->Reset(This)
278 #define IRecycleBin_QueryInterface(This, riid, ppvObject) \
279 (This)->lpVtbl->QueryInterface(This, riid, ppvObject)
280 #define IRecycleBin_AddRef(This) \
281 (This)->lpVtbl->AddRef(This)
282 #define IRecycleBin_Release(This) \
283 (This)->lpVtbl->Release(This)
284 #define IRecycleBin_DeleteFile(This, szFileName) \
285 (This)->lpVtbl->DeleteFile(This, szFileName)
286 #define IRecycleBin_EmptyRecycleBin(This) \
287 (This)->lpVtbl->EmptyRecycleBin(This)
288 #define IRecycleBin_EnumObjects(This, ppEnumList) \
289 (This)->lpVtbl->EnumObjects(This, ppEnumList)
293 GetDefaultRecycleBin(
294 IN LPCWSTR pszVolume OPTIONAL
,
295 OUT IRecycleBin
**pprb
);
301 #endif /* __RECYCLEBIN_H */