From 9762ef948094394987a6cf7594e85847c24cceb6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 3 Dec 2022 15:00:28 +0200 Subject: [PATCH] [WIN32K] Workaround for broken/retarded (on non-x86) FLOATOBJ_GetFloat The official definition in winddi.h always returns the result in an ULONG. This works to assign to a FLOATL on x86, which is also an ULONG, but it doesn't work on any other architecture, where FLOATL is actually a FLOAT, so the assignment would convert the ULONG encoding of the FLOAT to an actual float, which gives broken results. Work around this by simply replacing the definition with a sane one in win32k. --- win32ss/pch.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/win32ss/pch.h b/win32ss/pch.h index 60bdb37a8d6..31bf7246d8b 100644 --- a/win32ss/pch.h +++ b/win32ss/pch.h @@ -74,6 +74,12 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; /* SEH support with PSEH */ #include +/* The native x64 definition of FLOATOBJ_GetFloat in winddi.h is retarded. Use this instead. */ +#ifndef _M_IX86 +#undef FLOATOBJ_GetFloat +#define FLOATOBJ_GetFloat(pf) (*(pf)) +#endif + #ifdef __cplusplus extern "C" { #endif