From 49d9b84514415d89efdf45a0ead47ba0abba6415 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 1 Jul 2012 22:05:06 +0300 Subject: [PATCH] Additional change to fdcf133 --- Plugins/PluginRecycleManager/RecycleManager.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Plugins/PluginRecycleManager/RecycleManager.cpp b/Plugins/PluginRecycleManager/RecycleManager.cpp index 390e149f..4cfbf835 100644 --- a/Plugins/PluginRecycleManager/RecycleManager.cpp +++ b/Plugins/PluginRecycleManager/RecycleManager.cpp @@ -187,6 +187,10 @@ PLUGIN_EXPORT double Update(void* data) } else if (!data.directory.empty()) { + // Prevent the system from displaying message box. + UINT oldMode = SetErrorMode(0); + SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); + HANDLE bin = CreateFile( data.directory.c_str(), GENERIC_READ, @@ -208,6 +212,8 @@ PLUGIN_EXPORT double Update(void* data) CloseHandle(bin); } + + SetErrorMode(oldMode); } *pos = DRIVE_HANDLED; @@ -367,9 +373,7 @@ LPWSTR GetCurrentUserSid() if (GetTokenInformation(hToken, TokenUser, buf, dwBufSize, &dwBufSize)) { TOKEN_USER* tu = (TOKEN_USER*)buf; - if (ConvertSidToStringSid(tu->User.Sid, &sidStr)) - { - } + ConvertSidToStringSid(tu->User.Sid, &sidStr); } delete [] buf; @@ -385,15 +389,9 @@ CRawString GetRecycleBinDirectory(WCHAR drive, bool& isFAT) WCHAR search[] = L"\0:\\"; search[0] = drive; - // Prevent the system from displaying message box. - UINT oldMode = SetErrorMode(0); - SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); - WCHAR filesystem[16]; BOOL volumeResult = GetVolumeInformation(search, NULL, 0, NULL, NULL, NULL, filesystem, _countof(filesystem)); - SetErrorMode(oldMode); - if (!volumeResult) { return NULL;