From 89621addb4a7c87d2e3f3e7462e3c690cf71de71 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Wed, 16 Mar 2016 21:31:24 +0100 Subject: 7.6 --- zen/recycler.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'zen/recycler.cpp') 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& #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) -- cgit