https://bugs.winehq.org/show_bug.cgi?id=56661
--- Comment #2 from Paul Gofman pgofman@codeweavers.com --- Created attachment 76451 --> https://bugs.winehq.org/attachment.cgi?id=76451 Compat shim on Windows
Indeed, the fatal stack overflow is in the mod's error reporting logic (and is unrelated to the issue here), while the original error triggered in the Fog.dll (one of the libraries shipped with the mod) is "FogValidateCriticalSection(%d) - bad critical section err=%d". After initializing some critical section with kernel32.InitializeCriticalSection() the dll performs some validation of the critical section and explicitly expects DebugInfo allocated here. It first checks this field for 0 (which succeds as it is -1 without crit sect debug info), then '(DebugInfo & 3) == 0' and that fails trigerring the fatal error (which is fatal regardless of the stack overflow, it is going to exit process after anyway).
It is certain however that on Windows starting from Win8 the same '-1' is there in DebugInfo field and the debug info is not allocated without InitializeCriticalSectionEx with a special flag.
The game / mod work on modern Windows because of special compatibility shim. I am attaching a screenshot from Windows Compatibility Administrator tool showing that Windows compat database enables 'AllocDebugInfoForCritSections' hack. I. e., on Windows the old behaviour is enabled on modern Windows specifically for this game.
We don't have similar compat shim facilities currently. I am not sure if we want to introduce something like that but so far looks like rather long shot to me. What we have is setting Windows version in winecfg tool for the prefix or specific application. In general binding different behaviour to this version selection is not favoured in Wine, but we have a couple of places where it is done (specifically, in kernel32/file.c and kernelbase/files.c to support backward compatibility in a core part which changed in newer Windows versions.