Piotr Caban piotr@codeweavers.com writes:
I decided to leave 16-bit version of SetTimer as is for now. I haven't seen any application running out of window procedures in this case. This patch will change behavior of following 16-bit application: SetTimer(hWnd, TIMER_ID, 1, tfunc); GetMessage32(&msg, 0, 0, 0, TRUE); //get's WM_TIMER message DispatchMessage32(&msg, TRUE); Now this code will no longer call tfunc callback. According to my test new behavior is correct.
The more likely case is a 16-bit app retrieving a 32-bit timer and calling it through DispatchMessage16. How is this going to work with your proposed changes?
On 03/03/16 06:42, Alexandre Julliard wrote:
The more likely case is a 16-bit app retrieving a 32-bit timer and calling it through DispatchMessage16. How is this going to work with your proposed changes?
As far as I can see it should not work. I'm attaching a compiled 16-bit application that tries to do it. All tests were done on Windows XP, I guess Windows 95/98 may behave differently. set_timer.c was compiled using mingw-w64, ttimer.c using openwatcom.
There are following executables: ttimer.exe - 16-bit application, that creates window, calls set_timer.dll->set_timer and pumps messages set_timer.dll - 32-bit dll that exports set_timer(HWND, DWORD *count) function, it sets timer on window and increases count when callback is called.
Here's the output of the application on Windows XP (without first few lines that are not important): ttimer.c:214:set_timer 32-bit callback pointer 10001010 (0 means error) ttimer.c:216:For some reason GetMessage32 is always failing on windows: 0 ttimer.c:217:For some reason GetMessage32 is always failing on windows: 0
ttimer.c:220:Checking SetTimer32/GetMessage16/DispatchMessage16: ttimer.c:224:hwnd 0158 msg c09c lparam 28 ttimer.c:224:hwnd 015a msg 113 lparam 10001010 ttimer.c:229:timer callback was called 0 times, expected 0
ttimer.c:231:Checking SetTimer32/GetMessage16/DispatchMessage32: ttimer.c:235:hwnd 0158 msg c09f lparam 1 ttimer.c:235:hwnd 0158 msg c09c lparam 28 ttimer.c:235:hwnd 015a msg 113 lparam 10001010 ttimer.c:240:timer callback was called 0 times, expected 0
ttimer.c:242:Checking SetTimer32/GetMessage16/DispatchMessage32(wParamHigh): ttimer.c:246:hwnd 0156 msg 101 lparam c01c0001 ttimer.c:246:hwnd 015a msg 113 lparam 10001010 ttimer.c:253:timer callback was called 0 times, expected 0
The lParam parameter of WM_TIMER message contains 32-bit pointer to callback function (not some kind of handle). DispatchMessage{16/32} is not calling this callback. On windows there's no crash in this case (while there is in wine with my patches).
I've also checked what's in WM_TIMER message when SetTimer16 is used. It turns out windows simply passes function far pointer in LPARAM in this case as well.
I've also tries calling DispatchMessage16 on WM_TIMER message with incorrect callback pointer. It crashes on wine, doesn't crash on windows.
Please let me know if anything else should be tested.
Thanks, Piotr
Piotr Caban piotr@codeweavers.com writes:
Please let me know if anything else should be tested.
My concern is that we use 32-bit timers in several places in Wine, for instance for the caret, tooltips, etc. Do these things still work in 16-bit apps?
On 04/03/16 04:06, Alexandre Julliard wrote:
Piotr Caban piotr@codeweavers.com writes:
Please let me know if anything else should be tested.
My concern is that we use 32-bit timers in several places in Wine, for instance for the caret, tooltips, etc. Do these things still work in 16-bit apps?
I didn't think about it, sorry. I will try to find a solution for it.
Thanks, Piotr
On 04/03/16 08:39, Piotr Caban wrote:
On 04/03/16 04:06, Alexandre Julliard wrote:
Piotr Caban piotr@codeweavers.com writes:
Please let me know if anything else should be tested.
My concern is that we use 32-bit timers in several places in Wine, for instance for the caret, tooltips, etc. Do these things still work in 16-bit apps?
I didn't think about it, sorry. I will try to find a solution for it.
I will do the tests and try to scan the wine source for possible problems. A quick grep on user32 sources shows that SetTimer is always used with NULL callback - this works for 16-bit applications. In comctl32.dll only listview.c and tab.c uses timers with non-null callbacks.
Thanks, Piotr