https://bugs.winehq.org/show_bug.cgi?id=56364
Bug ID: 56364 Summary: Crazy Factory: Hang when starting new game Product: Wine Version: 9.2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: winebugzilla@tasossah.com Distribution: ---
Created attachment 76101 --> https://bugs.winehq.org/attachment.cgi?id=76101 Minimal reproducible example: client
Crazy Factory (AppID 13494, also known as Gadget Tycoon) hangs when starting a new game (Main Menu -> Offline game -> Freeplay). This is not a regression, but has last been tested under wine-staging 9.2.
The game (client) spawns the server (CrazyFactoryServer.exe), waits for it to finish initialising by calling WaitForSingleObject() and WaitForInputIdle(), and then looks for its HWND so that it can communicate with it using window messages.
I have written a standalone test case which reproduces this issue in Wine without requiring access to the original software.
To reproduce: 1. Download client.c and server.c 2. Compile them as follows: - i686-w64-mingw32-gcc server.c -l ole32 -mwindows -o server.exe - i686-w64-mingw32-gcc client.c -o client.exe 3. Run client.exe
Under Windows XP: client.exe reports "HWND Found" and exits. Under Wine: client.exe hangs on WaitForInputIdle().
The only way in Wine to get WaitForInputIdle() to return is by running everything in a virtual desktop, clicking on the start menu (which makes the server show up in the taskbar), clicking on the server in the taskbar, and then clicking on the server's window decoration and moving it around.
Unfortunately, since the game itself runs in fullscreen, one can not click and drag the server window. Instead, to get the game working as-is, one can patch the binary (556b01b1afa97f39d361fe692bc3477a2577a25abf91f4a92e88a561bd5bd561 GadgetTycoon.exe) by setting the byte at offset 0x241ED from 0xFF to 0x01. This sets the dwMilliseconds parameter on WaitForInputIdle() to 0x01 (instead of INFINITE), which makes it time out, thus avoiding the hang and getting the game running.