Module: wine Branch: master Commit: c85b74d63e770c378ca5836966f4c8ecd197ffed URL: http://source.winehq.org/git/wine.git/?a=commit;h=c85b74d63e770c378ca5836966...
Author: Francois Gouget fgouget@free.fr Date: Sun May 27 13:28:58 2007 +0200
In the PSDK HRESULT_FROM_WIN32() is now an inline function, and it is __HRESULT_FROM_WIN32() which is a macro.
---
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 */