From d4585001134a774ea23a315865aa2b03f446424a Mon Sep 17 00:00:00 2001 From: jhdxr Date: Sat, 22 Dec 2018 14:23:28 +0800 Subject: [PATCH] fix #1456 Error when empty recycle bin --- Plugins/Wox.Plugin.Sys/Main.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Wox.Plugin.Sys/Main.cs b/Plugins/Wox.Plugin.Sys/Main.cs index 70dbd7ddc8..1334034a3b 100644 --- a/Plugins/Wox.Plugin.Sys/Main.cs +++ b/Plugins/Wox.Plugin.Sys/Main.cs @@ -143,9 +143,10 @@ namespace Wox.Plugin.Sys Action = c => { // http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html + // FYI, couldn't find documentation for this but if the recycle bin is already empty, it will return -2147418113 (0x8000FFFF (E_UNEXPECTED)) // 0 for nothing var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0); - if (result != (uint) HRESULT.S_OK) + if (result != (uint) HRESULT.S_OK && result != (uint)0x8000FFFF) { MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" + "please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137",