[PATCH 02/14] include/basestd.h: define HandleToU?Long return a long (as SDK does)

Eric Pouech eric.pouech at gmail.com
Mon Jan 31 07:13:33 CST 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 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 (unsigned long)(ULONG_PTR)h;
+}
+
+static inline long HandleToLong(const void *h)
+{
+    return (long)(LONG_PTR)h;
+}
+
+#else
+
+static inline unsigned HandleToULong(const void *h)
 {
-    return (ULONG32)(ULONG_PTR)h;
+    return (unsigned)(ULONG_PTR)h;
 }
 
-static inline LONG32 HandleToLong(const void *h)
+static inline int HandleToLong(const void *h)
 {
-    return (LONG32)(LONG_PTR)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;




More information about the wine-devel mailing list