https://bugs.winehq.org/show_bug.cgi?id=56260
--- Comment #5 from Fabian Maurer dark.shadow4@web.de --- Created attachment 75991 --> https://bugs.winehq.org/attachment.cgi?id=75991 Second Testprogram to reproduce the issue
I found a way to work around the "Invalid parameter" issue, attaching a new testprogram that hacks around the issue (Win16 progamming is a massive PITA, did I ever say that?) Anyways, this should work at least on XP with original ntvdm.
Instead of using a mutex to ensure that only one 16-bit thread is running at a time, I wonder if we could make the callback pause/suspend the original thread to simulate what would happen on Windows 3.1 during an interrupt.
Sounds at least sensible to me, after all (if I understand things right) 16bit programs allow only one running thread and having it run code outside of where it's expected could lead to issues.
Btw, not sure if that is obvious, but I couldn't use ReleaseThunkLock/RestoreThunkLock because that thread doesn't own the Win16 Mutex so it can't release it.
Could also be interesting to see how otvdm does it, from what I saw they also employ a mutex, but that sample (and MYST) work there. Maybe there's something to be learned here?