http://bugs.winehq.org/show_bug.cgi?id=15323
Paul "TBBle" Hampson Paul.Hampson@Pobox.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |Paul.Hampson@Pobox.com
--- Comment #10 from Paul "TBBle" Hampson Paul.Hampson@Pobox.com 2009-02-22 08:28:10 --- I've been looking at this anew, and here's what I've found, in summary, from warpatch.bin.
The patcher creates a second thread, then goes and starts checking a certain shared flag for a 0 (which is its initial value) calling Sleep(10) in the meantime.
The thread's code sets the flag to 1, launches its own code (which is the actual windows you see when it works) and then sets the flag to 0.
The times that it works, the original thread gets to the flag check before the new thread sets it to 1, so it continues past that and sends off some messages (WM_USER, WM_USER+1 abd WM_USER+2) which I'm currently guessing cause the window to actually appear.
When it doesn't work, the main thread is spinning on Sleep(10) as mentioned above, while the second thread is actually spinning on GetMessageW, in a GetMessage-TranslateMessage-DispatchMessage loop which only ends when GetMessage returns 0 (ie. WM_QUIT came in).
So it looks to me like the main thread is supposed to sit by idly until the second thread exits, but in this case the second thread's window is not becoming visible. Nor should it, as the second thread's window is the main patching window, and the login window is supposed to be displayed first.
So it looks to me like a bug in the patcher. The main thread which creates and operates the login window is blocking before doing so on the thread which creates (hidden) the main patcher window, except in the specific case that the main thread checks and passes that block before the second thread sets it.
I guess this specific case always happens under Windows due to CreateThread returning and the parent thread staying active for at least a little while longer.
For anyone playing along at home, the login window is "EAMythic Patcher" and the main patch window is "EAMythic Patch Client".