From f2e0c5cab2366c038680796bc7ddf780fc4eb01b Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 31 Jan 2022 14:13:33 +0100 Subject: [PATCH] include: Define HandleToU?Long to return a long (as SDK does). Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- include/basetsd.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/include/basetsd.h b/include/basetsd.h index a46172403ef..329db66c8f0 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -153,16 +153,32 @@ typedef unsigned int UHALF_PTR, *PUHALF_PTR; #if !defined(__midl) && !defined(__WIDL__) -static inline ULONG32 HandleToULong(const void *h) +#if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES) + +static inline unsigned long HandleToULong(const void *h) { - return (ULONG32)(ULONG_PTR)h; + return (unsigned long)(ULONG_PTR)h; } -static inline LONG32 HandleToLong(const void *h) +static inline long HandleToLong(const void *h) { - return (LONG32)(LONG_PTR)h; + return (long)(LONG_PTR)h; } +#else + +static inline unsigned HandleToULong(const void *h) +{ + return (unsigned)(ULONG_PTR)h; +} + +static inline int HandleToLong(const void *h) +{ + return (int)(LONG_PTR)h; +} + +#endif /* !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES) */ + static inline void *ULongToHandle(ULONG32 ul) { return (void *)(ULONG_PTR)ul;