WineHQ
Bug Tracking Database – Bug 20838

 Bugzilla

 

Last modified: 2014-02-07 13:06:45 UTC  

Morrowind Graphics Extender's d3d8.dll replacement fails to load

Bug 20838 - Morrowind Graphics Extender's d3d8.dll replacement fails to load
Morrowind Graphics Extender's d3d8.dll replacement fails to load
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: kernel32
1.1.33
x86 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
http://morrgraphext.sourceforge.net/
: download, source
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-11-26 17:26 UTC by Chris
Modified: 2014-02-07 13:06 UTC (History)
5 users (show)

See Also:
Regression SHA1:
Fixed by SHA1:
Distribution: ---
Staged patchset:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2009-11-26 17:26:27 UTC
Morrowind Graphics Extender enhances Morrowind's graphics by providing its own d3d8.dll that calls to d3d9, and catches certain calls to provide enhanced functionality. Under Wine, the provided d3d8.dll fails to load with exception c0000005 (sigsegv).

Being open source, I was able to trace the crash to the handling of the STARTUPINFO provided by GetStartupInfo. As you can see in DllMain here:
https://morrgraphext.svn.sourceforge.net/svnroot/morrgraphext/d3d8/main.cpp
it calls GetStartupInfo then goes right to parsing the lpTitle field to find the executable name.

Under Wine, though, the returned STARTUPINFO.lpTitle field will either be an empty string (for the unicode version) or NULL (the ansi version, and sometimes the unicode version), as opposed to the full application path/exe. Being that the code uses the ansi version, it gets a NULL lpTitle and segfaults when it derefs it while looking for the directory separator.

To reproduce, you'll have to install MGE, then run Morrowind using
WINEDLLOVERRIDES="d3d8=n,b;dinput8=n,b"
(it has to be n,b since the dll will also try to load the system/built-in dll). The crash is reproduceable with any d3d8 app, but will likely not work properly when fixed if it's not Morrowind.
Comment 1 Xavier Vachon 2010-10-21 09:47:21 UTC
Is this still an issue in curent git (1.3.5)?
Comment 2 joaopa 2011-07-09 09:08:35 UTC
no answer since 2 years. This bug could be closed as ABANDONED
Comment 3 Chris 2011-07-09 12:43:10 UTC
Unfortunately I'm unable to test if the root cause (STARTUPINFO.lpTitle being NULL after calling GetStartupInfo), as MGE has been changed to not make that call anymore. Checking Wine's source, it's difficult to tell if it's still being set to NULL.
Comment 4 Dan Kegel 2011-07-09 13:18:38 UTC
OK, let's close as abandoned, then.  You can reopen if you find the old version and want to pursue this.
Comment 5 Jeff Zaroyko 2011-07-11 16:24:50 UTC
Closing abandoned.
Comment 6 Jeff Zaroyko 2011-07-11 16:25:42 UTC
Closing.
Comment 7 WineBuG 2013-12-01 15:44:37 UTC
It has been closed as ABANDONED, but I think this is still a problem in recent versions of Wine. Maybe it would be good to REOPEN it?

This is an important fragment (2013-06-26) of the discussion concerning Morrowind Graphics Extender and Wine from official MGE forums:

"But actually launching the game with MGE is impossible: if we set Wine to use native d3d8/dinput8 dlls so that MGE is enabled, it'll then fail to find the 'real' dlls which it loads during initialization. Thing is, MGE explicitly tries to load those dlls from system directory (normally \windows\system32 on 32-bit machine), but in Wine those DLLs are just stubs: Wine tries to load them, looks for overrides, see that they're overridden, and tries to load native libs again, which is obviously not the desired behavior. However, through some experimentation, I've found out that LoadLibrary() can happily load Wine's "proper" dll.so libraries. So...

This patch enables MGE to look for "MGE_WINEDLLPATH" environment variable and try to load d3d8.dll.so and dinput8.dll.so from there. Failing to find the variable it'll revert to the original dlls in system directory. Thus, users launching the game on Linux under Wine will now be able to see the MGE in its full glory :)

On Ubuntu, the value for this variable would be /usr/lib/i386-linux-gnu/wine for 32-bit Wine prefix and /usr/lib/x86_64-linux-gnu on 64-bit Wine prefix, though the latter is not tested since pretty much any other prerequisites (DirectX, .NET, etc.) currently only work with 32-bit Wine prefix. G
enerally, it's whatever directory that contains d3d8.dll.so and dinput8.dll.so."

I recommend looking through the whole thread: http://sourceforge.net/p/morrgraphext/discussion/866295/thread/422538db
Comment 8 Austin English 2014-01-24 00:31:50 UTC
(In reply to comment #7)
> It has been closed as ABANDONED, but I think this is still a problem in
> recent versions of Wine. Maybe it would be good to REOPEN it?
> 
> This is an important fragment (2013-06-26) of the discussion concerning
> Morrowind Graphics Extender and Wine from official MGE forums:
> 
> "But actually launching the game with MGE is impossible: if we set Wine to
> use native d3d8/dinput8 dlls so that MGE is enabled, it'll then fail to find
> the 'real' dlls which it loads during initialization. Thing is, MGE
> explicitly tries to load those dlls from system directory (normally
> \windows\system32 on 32-bit machine), but in Wine those DLLs are just stubs:
> Wine tries to load them, looks for overrides, see that they're overridden,
> and tries to load native libs again, which is obviously not the desired
> behavior. However, through some experimentation, I've found out that
> LoadLibrary() can happily load Wine's "proper" dll.so libraries. So...

I can confirm this in wine-1.7.11 (didn't try the patch though..)
Comment 9 WineBuG 2014-01-24 12:34:57 UTC
(In reply to comment #8)
...
> I can confirm this in wine-1.7.11 (didn't try the patch though..)

Could you attach a debug trace/logs from this version? Maybe it'd help to solve this issue.
Comment 10 WineBuG 2014-01-24 12:35:43 UTC
I currently don't have Morrowind, so I can't test this out.
Comment 11 Austin English 2014-01-27 23:09:49 UTC
Well, I was able to get it to run with MGE, but the screen is black when doing so.

WINEDLLOVERRIDES="*d3d8=n,b;*dinput8=n,b" wine Steam.exe

lsof shows it loading the mge dll:
[austin@localhost Steam]$ lsof | grep d3d8
wineserve 23313        austin  297r      REG              253,4    479232  9961495 /home/austin/.wine/drive_c/Program Files/Steam/steamapps/common/Morrowind/d3d8.dll
Morrowind 23635        austin  mem       REG              253,4    479232  9961495 /home/austin/.wine/drive_c/Program Files/Steam/steamapps/common/Morrowind/d3d8.dll

but, as I said, there's a black screen. I'm not sure that we support overriding the d3d libraries in this way.

any wined3d guy care to comment?
Comment 12 Henri Verbeet 2014-01-30 02:34:28 UTC
(In reply to comment #11)
> but, as I said, there's a black screen. I'm not sure that we support
> overriding the d3d libraries in this way.
> 
> any wined3d guy care to comment?

If it calls into d3d9.dll I think that should work in principle. Calling directly into the D3D DDI won't.
Comment 13 Austin English 2014-02-03 03:20:22 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > but, as I said, there's a black screen. I'm not sure that we support
> > overriding the d3d libraries in this way.
> > 
> > any wined3d guy care to comment?
> 
> If it calls into d3d9.dll I think that should work in principle. Calling
> directly into the D3D DDI won't.

Well, it seemed like it was a regression, working in wine-1.4.1, but not in recent wine. I started a bisect, but wasn't getting good results. After a reboot, it works fine in wine-1.7.11-114-g6f498c4.

Command used was:
WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe -applaunch 22320
Comment 14 WineBuG 2014-02-04 11:55:13 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #11)
> > > but, as I said, there's a black screen. I'm not sure that we support
> > > overriding the d3d libraries in this way.
> > > 
> > > any wined3d guy care to comment?
> > 
> > If it calls into d3d9.dll I think that should work in principle. Calling
> > directly into the D3D DDI won't.
> 
> Well, it seemed like it was a regression, working in wine-1.4.1, but not in
> recent wine. I started a bisect, but wasn't getting good results. After a
> reboot, it works fine in wine-1.7.11-114-g6f498c4.
> 
> Command used was:
> WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe
> -applaunch 22320

So you say it's fixed even though you had to use these overrides parameters? Does Morrowind Overhaul (it uses MGE) work now? http://www.ornitocopter.net/morrowind-overhaul/
Comment 15 Austin English 2014-02-04 12:05:26 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #12)
> > > (In reply to comment #11)
> > > > but, as I said, there's a black screen. I'm not sure that we support
> > > > overriding the d3d libraries in this way.
> > > > 
> > > > any wined3d guy care to comment?
> > > 
> > > If it calls into d3d9.dll I think that should work in principle. Calling
> > > directly into the D3D DDI won't.
> > 
> > Well, it seemed like it was a regression, working in wine-1.4.1, but not in
> > recent wine. I started a bisect, but wasn't getting good results. After a
> > reboot, it works fine in wine-1.7.11-114-g6f498c4.
> > 
> > Command used was:
> > WINEPREFIX=~/.wine-mge/ WINEDLLOVERRIDES="*d3d8,*dinput8=n,b" wine Steam.exe
> > -applaunch 22320
> 
> So you say it's fixed even though you had to use these overrides parameters?

My understanding is that those DLL overrides are expected to be required. From get_load_order() in dlls/ntdll/load_order.c:
    /* first explicit module name */
...
    /* then module basename preceded by '*' */
...
    /* then module basename without '*' (only if explicit path) */
...
    /* if loading the main exe with an explicit path, try native first */
...
    /* and last the hard-coded default */
...

> Does Morrowind Overhaul (it uses MGE) work now?
> http://www.ornitocopter.net/morrowind-overhaul/

I was testing on my laptop with a not very powerful intel chip. The initial loading screen shows the 'Morrowind Graphics Extender' message, and lsof indicates that the dll is loaded. I didn't check for improved graphics (since my settings are pretty low anyway).

I didn't try Morrowind Overhaul.
Comment 16 Alexandre Julliard 2014-02-07 13:06:45 UTC
Closing bugs fixed in 1.7.12.


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers