In the PSDK HRESULT_FROM_WIN32() is now an inline function, and it
is __HRESULT_FROM_WIN32() which is a macro.
Francois Gouget
fgouget at free.fr
Sun May 27 06:28:58 CDT 2007
---
Compilation with the PSDK failed because the initializer for
mime_tests[] was not a constant. So I have updated our winerror.h header
to match the PSDK. This means defining the HRESULT type in winerror.h so
that it does not depend on winnt.h (just like in the PSDK).
dlls/urlmon/tests/misc.c | 4 ++--
include/winerror.h | 14 +++++++++++++-
include/winnt.h | 5 ++++-
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c
index 67e0d3d..375875b 100644
--- a/dlls/urlmon/tests/misc.c
+++ b/dlls/urlmon/tests/misc.c
@@ -373,9 +373,9 @@ static const struct {
{url2, mimeTextHtml, S_OK},
{url3, mimeTextHtml, S_OK},
{url4, NULL, E_FAIL},
- {url5, NULL, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
+ {url5, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
{url6, NULL, E_FAIL},
- {url7, NULL, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)}
+ {url7, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)}
};
static BYTE data1[] = "test data\n";
diff --git a/include/winerror.h b/include/winerror.h
index 437cc83..6eb6822 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -81,8 +81,20 @@
#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1)
+#define __HRESULT_FROM_WIN32(x) ((x) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0 )
+#ifndef _HRESULT_DEFINED
+#define _HRESULT_DEFINED
+# ifdef _MSC_VER
+typedef long HRESULT;
+# else
+typedef int HRESULT;
+# endif
+#endif
+static inline HRESULT HRESULT_FROM_WIN32(unsigned long x)
+{
+ return x ? ((HRESULT) ((x & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0;
+}
#define FACILITY_NT_BIT 0x10000000
-#define HRESULT_FROM_WIN32(x) ((x) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)) : 0 )
#define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT))
/* SCODE <-> HRESULT functions */
diff --git a/include/winnt.h b/include/winnt.h
index 04f5cf6..71dbf6d 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -398,10 +398,13 @@ typedef LPCSTR PCTSTR, LPCTSTR;
/* Misc common WIN32 types */
typedef char CCHAR;
-typedef LONG HRESULT;
typedef DWORD LCID, *PLCID;
typedef WORD LANGID;
typedef DWORD EXECUTION_STATE;
+#ifndef _HRESULT_DEFINED
+#define _HRESULT_DEFINED
+typedef LONG HRESULT;
+#endif
/* Handle type */
--
1.4.4.4
More information about the wine-patches
mailing list