summaryrefslogtreecommitdiff
path: root/zen/recycler.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2016-03-16 21:31:24 +0100
committerDaniel Wilhelm <daniel@wili.li>2016-03-16 21:31:24 +0100
commit89621addb4a7c87d2e3f3e7462e3c690cf71de71 (patch)
tree008b5dea7624ee1eeb57ff82c45fdf1afcab3b08 /zen/recycler.cpp
parent7.5 (diff)
downloadFreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.tar.gz
FreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.tar.bz2
FreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.zip
7.6
Diffstat (limited to 'zen/recycler.cpp')
-rw-r--r--zen/recycler.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/zen/recycler.cpp b/zen/recycler.cpp
index d49e686c..59d2729a 100644
--- a/zen/recycler.cpp
+++ b/zen/recycler.cpp
@@ -12,6 +12,8 @@
#ifdef ZEN_WIN_VISTA_AND_LATER
#include "vista_file_op.h"
+ #else
+ #include "com_tools.h"
#endif
#elif defined ZEN_LINUX
@@ -179,12 +181,18 @@ bool zen::recycleBinExists(const Zstring& dirPath, const std::function<void ()>&
#else
//excessive runtime if recycle bin exists, is full and drive is slow:
- auto ft = runAsync([dirPath]()
+ auto ft = runAsync([dirPath]() -> HRESULT
{
- SHQUERYRBINFO recInfo = {};
- recInfo.cbSize = sizeof(recInfo);
- return ::SHQueryRecycleBin(dirPath.c_str(), //__in_opt LPCTSTR pszRootPath,
- &recInfo); //__inout LPSHQUERYRBINFO pSHQueryRBInfo
+ try
+ {
+ ComInitializer ci; //throw SysError
+
+ SHQUERYRBINFO recInfo = {};
+ recInfo.cbSize = sizeof(recInfo);
+ return ::SHQueryRecycleBin(dirPath.c_str(), //__in_opt LPCTSTR pszRootPath,
+ &recInfo); //__inout LPSHQUERYRBINFO pSHQueryRBInfo
+ }
+ catch (SysError&) { assert(false); return ERROR_GEN_FAILURE; }
});
while (ft.wait_for(std::chrono::milliseconds(50)) != std::future_status::ready)
bgstack15