https://git.reactos.org/?p=reactos.git;a=commitdiff;h=61e7ea5be5ef98bb54b37…
commit 61e7ea5be5ef98bb54b37f919abcfc14438c42f2
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Fri Jul 23 20:24:13 2021 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Fri Jul 23 22:10:36 2021 +0200
[SHELLUTILS] Fix FAILED_UNEXPECTEDLY macro evaluating twice
---
sdk/include/reactos/shellutils.h | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/sdk/include/reactos/shellutils.h b/sdk/include/reactos/shellutils.h
index c4e4026fd14..f1b8461653f 100644
--- a/sdk/include/reactos/shellutils.h
+++ b/sdk/include/reactos/shellutils.h
@@ -23,7 +23,7 @@
extern "C" {
#endif /* defined(__cplusplus) */
-static inline ULONG
+inline ULONG
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
{
char szMsg[512];
@@ -68,7 +68,18 @@ Win32DbgPrint(const char *filename, int line, const char *lpFormat,
...)
#endif
#if 1
-#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (Win32DbgPrint(__FILE__, __LINE__,
"Unexpected failure %08x.\n", hr), TRUE))
+
+inline BOOL _ROS_FAILED_HELPER(HRESULT hr, const char* expr, const char* filename, int
line)
+{
+ if (FAILED(hr))
+ {
+ Win32DbgPrint(filename, line, "Unexpected failure (%s)=%08x.\n", expr,
hr);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#define FAILED_UNEXPECTEDLY(hr) _ROS_FAILED_HELPER((hr), #hr, __FILE__, __LINE__)
#else
#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
#endif