WineHQ
Bug Tracking Database – Bug 52222

 Bugzilla

 

Last modified: 2021-12-26 10:44:38 CST  

WINEDLLOVERRIDES="DINPUT8.dll=n,b" no longer works since 4f1095a, worked in V6.23.

Bug 52222 - WINEDLLOVERRIDES="DINPUT8.dll=n,b" no longer works since 4f1095a, worked in V6.23.
WINEDLLOVERRIDES="DINPUT8.dll=n,b" no longer works since 4f1095a, worked in V...
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: winmm&mci
7.0-rc1
x86-64 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
: regression
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2021-12-15 20:29 CST by Bill Fleming
Modified: 2021-12-26 10:44 CST (History)
2 users (show)

See Also:
Regression SHA1: 4f1095a0ee4c7577e5287e56e388c36d0ba659ad
Fixed by SHA1: e9282254c6824c4387d3a6368c7fb8ca44aeef53
Distribution: ArchLinux
Staged patchset:


Attachments
Delay load dinput8 (393 bytes, patch)
2021-12-16 03:23 CST, Rémi Bernon
Details | Diff
DELAYIMPORTS dinput8 doesn't fix the problem (88.46 KB, application/zip)
2021-12-16 07:02 CST, Bill Fleming
Details
Create dinput8 instance through COM (1.35 KB, patch)
2021-12-16 09:30 CST, Rémi Bernon
Details | Diff
logfile of dinput8 instance through COM method (130.45 KB, application/zip)
2021-12-17 05:45 CST, Bill Fleming
Details
Log of wine-7.0-rc2-41-gd03984709d8 (236.74 KB, application/zip)
2021-12-23 08:50 CST, Bill Fleming
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Fleming 2021-12-15 20:29:49 CST
Zebediah pointed out where this new bug was and I confirmed the regression with a minor code modification. See his comments here for the program I first saw the regression against.
https://bugs.winehq.org/show_bug.cgi?id=51409#c7

In Wine 3.X, 4.X, 5.X, 6.X we have been able to supply modified DLLs (for example that some games require to load a translation or a mod to fix bugs, etc) in the game's directory and override the built-in DLL to load the modification hook into the application. From 4f1095a on-wards dinput8 became an IMPORT requirement of winmm makefile leading to the following error in wine, before it even really attempts to load the application.

LdrInitializeThunk "WINMM.dll" failed to initialize, aborting

I can modify wine 7.0-rc1 to allow the dll to load again, making the game playable other than any lingering video playback issues it has.
In dlls/winmm/Makefile.in I modified the IMPORTS line to remove dinput8.
In dlls/winmm/joystick.c I commented out the contents of the void joystick_load( HINSTANCE instance ) function. (lines 157 to 159 as of 7.0-rc1).

Then after rebuilding wine the application will launch again using WINEDLLOVERRIDES="DINPUT8.dll=n,b"

Note that this regression will affect a large number of video games as it is almost universal to "hook" into a game using DINPUT8.dll specifically, as apposed to other possible DLLs.

If anyone really wants to look at a log file I put one here in the old report.
https://bugs.winehq.org/attachment.cgi?id=71302

Note that at least in this one game my xbox 1 controller still works with xow after removing those lines, but someone who knows what they are doing should propose a new patch relating to joysticks.
Comment 1 Rémi Bernon 2021-12-16 03:23:51 CST
Created attachment 71307 [details]
Delay load dinput8
Comment 2 Rémi Bernon 2021-12-16 03:24:05 CST
Could you try if this patch solves the issue as well?
Comment 3 Bill Fleming 2021-12-16 07:02:17 CST
Created attachment 71315 [details]
DELAYIMPORTS dinput8 doesn't fix the problem

The patch to DELAYIMPORTS dinput8 doesn't fix the problem.
Comment 4 Rémi Bernon 2021-12-16 09:30:50 CST
Created attachment 71316 [details]
Create dinput8 instance through COM

Thanks, I'm a bit surprised as I don't expect the DLL to be loaded right away if DELAYIMPORTS is used although it looks like it's what it is doing. Maybe it didn't actually take the changes into account if it's only the Makefile.in that is modified? Could you confirm with touching dlls/winmm/joystick.c as well?

Then if it's really not enough, maybe something like this other patch instead?
Comment 5 Bill Fleming 2021-12-17 05:45:52 CST
Created attachment 71327 [details]
logfile of dinput8 instance through COM method

The problem is fixed now. I have attached a WINEDEBUG=+dll,+module,+winmm,+dinput log file also. Controller works also.
Thanks.
Comment 6 Rémi Bernon 2021-12-17 09:02:28 CST
Thanks, although Paul rightfully noted on the mailing list that COM involves tricky details that we may want to avoid here.

I think I was looking at an invalid version of the code before and didn't see that winmm is actually creating a dinput instance at load time, I believe that's what made the delay load behave exactly like the non-delay load version.

With some added lazy loading I think it should work fine.
Comment 7 Bill Fleming 2021-12-23 08:50:20 CST
Created attachment 71392 [details]
Log of wine-7.0-rc2-41-gd03984709d8

Game loads on latest master with Remi's e928225 patch from Tuesday. Tested 2 different games with dinput8 dll successfully.
Comment 9 Alexandre Julliard 2021-12-26 10:44:38 CST
Closing bugs fixed in 7.0-rc3.


Privacy Policy
If you have a privacy inquiry regarding this site, please write to privacy@winehq.org

Hosted By CodeWeavers