Index: src/plugin/PluginUtil.cpp |
diff --git a/src/plugin/PluginUtil.cpp b/src/plugin/PluginUtil.cpp |
index fe7acb6b7c81194819966308eab9b1cef9238f4b..3c8bf354745b5530cfae4e1420adc3c627c6d29d 100644 |
--- a/src/plugin/PluginUtil.cpp |
+++ b/src/plugin/PluginUtil.cpp |
@@ -1,20 +1,20 @@ |
-/* |
- * This file is part of Adblock Plus <https://adblockplus.org/>, |
- * Copyright (C) 2006-2015 Eyeo GmbH |
- * |
- * Adblock Plus is free software: you can redistribute it and/or modify |
- * it under the terms of the GNU General Public License version 3 as |
- * published by the Free Software Foundation. |
- * |
- * Adblock Plus is distributed in the hope that it will be useful, |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- * GNU General Public License for more details. |
- * |
- * You should have received a copy of the GNU General Public License |
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
- */ |
- |
+/* |
+ * This file is part of Adblock Plus <https://adblockplus.org/>, |
+ * Copyright (C) 2006-2015 Eyeo GmbH |
+ * |
+ * Adblock Plus is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 3 as |
+ * published by the Free Software Foundation. |
+ * |
+ * Adblock Plus is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ */ |
+ |
#include "PluginStdAfx.h" |
#include <algorithm> |
#include <stdexcept> |
@@ -45,3 +45,38 @@ std::wstring FileUrl(const std::wstring& path) |
std::replace(url.begin(), url.end(), L'\\', L'/'); |
return L"file:///" + url; |
} |
+ |
+bool EntryPoint(const std::function<void()>& functionBody) |
+{ |
+ bool withoutException = true; |
+ if (!functionBody) |
+ { |
+ return withoutException; |
+ } |
+ try |
+ { |
+ functionBody(); |
+ } catch(...) |
+ { |
+ withoutException = false; |
+ } |
+ return withoutException; |
+} |
+ |
+HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody) |
+{ |
+ HRESULT retValue = S_OK; |
+ if (!functionBody) |
+ { |
+ return retValue; |
+ } |
+ try |
+ { |
+ functionBody(); |
+ } catch(...) |
+ { |
+ retValue = E_FAIL; |
+ } |
+ return retValue; |
+} |
+ |