3375b75c
by Martin Storsjö at 2026-06-29T18:00:43+02:00
include: Use __msvcrt_ulong in setjmp.h.
This fixes some cases of longjmp on x86_64, in ELF builds of Wine.
In 64 bit ELF builds, the "long" type normally is 64 bit, while
the type should be 32 bit in Windows environments.
Therefore, use typedefs like __msvcrt_ulong (in msvcrt headers,
or LONG/ULONG in Windows API headers) to get the right type
in all build configurations.
While this changes many instances in these structs for consistency,
only one of the cases actually make a difference. On 32 bit
architectures, long is the right size anyway. On aarch64, ELF
builds aren't supported/possible. Therefore, this only makes
a difference for x86_64.
On x86_64, this fixes the size of the field MxCsr.
This discrepancy for x86_64 ELF builds was introduced in
d60c450c7be196c2072f74e34f7760d39e3bad32, where one "__int64 Spare"
field was converted into one "long" and two "short". However
not much seemed to actually use this struct as such, so the
discrepancy wasn't really noted.
After 7a156cbd7fbbf1ce10f805bcfb43ff94fd94dda1, the incorrect
layout of _JUMP_BUFFER started affecting longjmps.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59920