https://bugs.winehq.org/show_bug.cgi?id=47120
Bug ID: 47120 Summary: Expansive Civilian Warfare 1.0.0.0 fails to start, reports 'there was an error loading bhs.dll' (Wine's 'd3d8.dll' is preferred over native d3d8->d3d9 thunk dll, causing failure) Product: Wine Version: 4.7 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
reported here:
https://forum.winehq.org/viewtopic.php?f=2&t=32324
https://w3dhub.com/forum/topic/416741-horrible-luck-cannot-get-ecw-or-w3dhl-...
http://www.renegadeforums.com/index.php?t=msg&th=25165
It seems various people spend a good amount of time trying to investigate without luck.
Download:
http://download.expansivecivilianwarfare.com/Alpha/ExpansiveCivilianWarfareS...
Backup:
https://web.archive.org/web/20190503192509/http://download.expansivecivilian...
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files/Expansive Civilian Warfare
$ WINEDEBUG=+seh,+loaddll,+relay,+d3dx,+d3d8 wine ./Game300.exe >>log.txt 2>&1 ... 003e:Call KERNEL32.LoadLibraryA(007f8838 "D3D8.DLL") ret=00546c4e ... 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\opengl32.dll" at 0x7c180000: builtin 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\wined3d.dll" at 0x7c2c0000: builtin 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\d3d8.dll" at 0x7c820000: builtin 003e:Call PE DLL (proc=0x7c83e4e0,module=0x7c820000 L"d3d8.dll",reason=WINE_PREATTACH,res=(nil)) 003e:Ret PE DLL (proc=0x7c83e4e0,module=0x7c820000 L"d3d8.dll",reason=WINE_PREATTACH,res=(nil)) retval=1 003e:Call PE DLL (proc=0x7c1fa0b0,module=0x7c180000 L"opengl32.dll",reason=PROCESS_ATTACH,res=(nil)) 003e:Ret PE DLL (proc=0x7c1fa0b0,module=0x7c180000 L"opengl32.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1 003e:Call PE DLL (proc=0x7c38dda0,module=0x7c2c0000 L"wined3d.dll",reason=PROCESS_ATTACH,res=(nil)) ... 003e:Ret PE DLL (proc=0x7c83e4e0,module=0x7c820000 L"d3d8.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1 003e:Ret KERNEL32.LoadLibraryA() retval=7c820000 ret=00546c4e 003e:Call KERNEL32.GetProcAddress(7c820000,007f8828 "Direct3DCreate8") ret=00546c6b 003e:Ret KERNEL32.GetProcAddress() retval=7c82cdbc ret=00546c6b 003e:Call d3d8.Direct3DCreate8(00000078) ret=00546c78 003e:trace:d3d8:Direct3DCreate8 sdk_version 0x78. ... 003e:trace:d3d8:Direct3DCreate8 Created d3d8 object 0x16d838. 003e:Ret d3d8.Direct3DCreate8() retval=0016d838 ret=00546c78 003e:trace:d3d8:d3d8_GetAdapterCount iface 0x16d838. ... 003e:trace:d3d8:device_parent_wined3d_device_created device_parent 0x1cf57c, device 0x1e00030 003e:Ret wined3d.wined3d_device_create() retval=00000000 ret=7c836eb3 ... 003e:trace:d3d8:device_parent_create_swapchain_texture device_parent 0x1cf57c, container_parent 0x16d5b0, desc 0x33dae4, texture flags 0, texture 0x1bc4c00. ... 003e:trace:d3d8:d3d8_device_QueryInterface iface 0x1cf578, riid {b4211cfa-51b9-4a9f-ab78-db99b2bb678e}, out 0x33d87c. 003e:warn:d3d8:d3d8_device_QueryInterface {b4211cfa-51b9-4a9f-ab78-db99b2bb678e} not implemented, returning E_NOINTERFACE. 003e:trace:d3d8:device_parent_texture_sub_resource_created Created surface 0x16d5d0. 003e:Ret wined3d.wined3d_texture_create() retval=00000000 ret=7c832fd1 ... 003e:Call KERNEL32.LoadLibraryA(1120ed98 "bhs.dll") ret=110022a4 ... 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\d3dcompiler_47.dll" at 0x66c20000: builtin ... 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\d3dxof.dll" at 0x67040000: builtin ... 003e:trace:loaddll:load_builtin_dll Loaded L"C:\windows\system32\d3dx9_43.dll" at 0x66ca0000: builtin 003e:trace:loaddll:load_native_dll Loaded L"C:\Program Files\Expansive Civilian Warfare\shaders.dll" at 0x12800000: native 003e:trace:loaddll:load_native_dll Loaded L"C:\Program Files\Expansive Civilian Warfare\bhs.dll" at 0x45000000: native ... 003e:Call PE DLL (proc=0x66cf9960,module=0x66ca0000 L"d3dx9_43.dll",reason=PROCESS_ATTACH,res=(nil)) ... 003e:Ret PE DLL (proc=0x66cf9960,module=0x66ca0000 L"d3dx9_43.dll",reason=PROCESS_ATTACH,res=(nil)) retval=1 003e:Call PE DLL (proc=0x1281ab80,module=0x12800000 L"shaders.dll",reason=PROCESS_ATTACH,res=(nil)) ... 003e:Call KERNEL32.SetUnhandledExceptionFilter(12825aad) ret=12825b24 003e:Ret KERNEL32.SetUnhandledExceptionFilter() retval=111eb77c ret=12825b24 ... 003e:trace:seh:raise_exception code=c0000005 flags=0 addr=0x8b117508 ip=8b117508 tid=003e 003e:trace:seh:raise_exception info[0]=00000000 003e:trace:seh:raise_exception info[1]=8b117508 003e:trace:seh:raise_exception eax=7c8429a4 ebx=00000000 ecx=7c834ac0 edx=8b117508 esi=0486c56c edi=00000000 003e:trace:seh:raise_exception ebp=1283868c esp=0033d0bc cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00010206 003e:trace:seh:call_stack_handlers calling handler at 0x1282a71c code=c0000005 flags=0 003e:Call KERNEL32.GetLastError() ret=1281b154 003e:Ret KERNEL32.GetLastError() retval=00000000 ret=1281b154 ... 003e:exception c0000005 in PE entry point (proc=0x1281ab80,module=0x12800000,reason=PROCESS_ATTACH,res=(nil)) ... 003e:trace:loaddll:free_modref Unloaded module L"C:\Program Files\Expansive Civilian Warfare\bhs.dll" : native 003e:trace:loaddll:free_modref Unloaded module L"C:\Program Files\Expansive Civilian Warfare\shaders.dll" : native 003e:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\d3dx9_43.dll" : builtin 003e:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\d3dxof.dll" : builtin 003e:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\d3dcompiler_47.dll" : builtin 003e:Ret KERNEL32.LoadLibraryA() retval=00000000 ret=110022a4 ... 003e:Call user32.MessageBoxA(00000000,1120eca0 "Unfortunately, there was an error loading bhs.dll. Please report this bug!",1120ee80 "Error",00040030) ret=11002328 --- snip ---
One has to debug through the dll init of 'shaders.dll' to see what's going on. The ease debugging, the game should be configured to run in Windowed mode (it's not by default). See registry snippet.
--- snip --- [HKEY_LOCAL_MACHINE\Software\Westwood\Rp2 \Render] ... "DriverVersionCheckDisabled"=dword:00000057 ... "RenderDeviceWindowed"=dword:00000001 --- snip ---
I spare you a long trace of disassembly, only providing the final crash site:
--- snip --- 12803650 push ecx 12803651 mov eax,dword ptr ds:[12838284] ; d3d8_wined3d_device_parent_ops 12803656 mov ecx,dword ptr ds:[eax] ; device_parent_wined3d_device_created 12803658 mov edx,dword ptr ds:[ecx+1C] 1280365B push shaders.128380C0 12803660 push eax 12803661 call edx ; *boom* 12803663 mov ecx,dword ptr ds:[1283818C] 12803669 movzx edx,cl 1280366C mov eax,CCCCCCCD 12803671 mul edx 12803673 movzx eax,ch 12803676 shr edx,3 12803679 add edx,eax 1280367B mov dword ptr ss:[esp],edx 1280367E fild st(0),dword ptr ss:[esp] --- snip ---
--- snip --- Address To From Size Comment Party 0032D12C 128032B7 12803650 18 shaders.sub_12803639+17 User 0032D144 1282A71C 128032B7 1C shaders.128032B7 User 0032D160 1282A87B 1282A71C 80 shaders.sub_1282A71C User 0032D1E0 1281AB9E 1282A87B BC shaders.sub_1282A87B User 0032D29C 7BCC3730 1281AB9E 694 shaders.EntryPoint+1E User 0032D930 111D395D 7BCC3730 BC 7BCC3730 User 0032D9EC 7BCC3730 111D395D 243C scripts.111D395D User 0032FE28 0043D050 7BCC3730 AC 7BCC3730 User 0032FED4 7B47ACA2 0043D050 4C game300.0043D050 System 0032FF20 7B4A5A50 7B47ACA2 BC kernel32.7B47ACA2 System 0032FFDC 7B47ACAE 7B4A5A50 14 kernel32.7B4A5A50 System 0032FFF0 00000000 7B47ACAE kernel32.7B47ACAE User --- snip ---
Apparently the game ships its own d3d8->d3d9 thunk dll.
Similar to what this FOSS project does:
https://github.com/crosire/d3d8to9
--- quote --- This is a pseudo-driver module that intends to improve compatibility and stability in games using Direct3D 8 for rendering by converting all API calls and lowlevel shaders to equivalent Direct3D 9 ones. By that it also opens those games to the new possibilities from proven tools and wrappers written for Direct3D 9. --- quote ---
NOTE: The game provided thunk dlls seem to be proprietary/closed (Westwood Renegade) and have no relation to the FOSS project.
Wine doesn't pick up the d3d8 thunk dll from the game directory but instead loads the builtin (preferred) one by default, causing a crash due to different vtable/interface layouts later.
To avoid the crash, force Wine to load native 'd3d8.dll' (thunk/wrapper). Interestingly the game seems to only need d3d8 override, even though it ships d3d9 as well ("ShaderInjector"). Maybe it misses some functionality later, I did not create (host)/join a game to verify.
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files/Expansive Civilian Warfare
$ WINEDLLOVERRIDES=d3d8=n,b wine ./Game300.exe --- snip ---
ProtectionID scan of shipped D3D8/9 dlls:
--- snip ---
-=[ ProtectionID v0.6.9.0 DECEMBER]=- (c) 2003-2017 CDKiLLER & TippeX Build 24/12/17-21:05:42 Ready... Scanning -> C:\Program Files\Expansive Civilian Warfare\d3d8.dll File Type : 32-Bit Dll (Subsystem : Win GUI / 2), Size : 128000 (01F400h) Byte(s) | Machine: 0x14C (I386) Compilation TimeStamp : 0x46E888A9 -> Thu 13th Sep 2007 00:47:37 (GMT) [TimeStamp] 0x46E888A9 -> Thu 13th Sep 2007 00:47:37 (GMT) | PE Header | - | Offset: 0x000000F0 | VA: 0x120000F0 | - [TimeStamp] 0x46E888A8 -> Thu 13th Sep 2007 00:47:36 (GMT) | Export | - | Offset: 0x0001D134 | VA: 0x1201E534 | - [TimeStamp] 0x46E888A9 -> Thu 13th Sep 2007 00:47:37 (GMT) | DebugDirectory | - | Offset: 0x00016DA4 | VA: 0x120181A4 | - [LoadConfig] Struct determined as v8 (Expected size 140 | Actual size 64) [!] Executable uses SEH Tables (/SAFESEH) (9 calculated 9 recorded... 0 invalid addresses) [LoadConfig] CodeIntegrity -> Flags 0x5 | Catalog 0x0 (0) | Catalog Offset 0x775C3A63 | Reserved 0x77747365 [LoadConfig] GuardAddressTakenIatEntryTable 0x5C646F6F | Count 0x656E6572 (1701733746) [LoadConfig] GuardLongJumpTargetTable 0x65646167 | Count 0x6433645C (1681089628) [LoadConfig] HybridMetadataPointer 0x64702E38 | DynamicValueRelocTable 0x62 [LoadConfig] FailFastIndirectProc 0x0 | FailFastPointer 0x0 [LoadConfig] UnknownZero1 0x0 [File Heuristics] -> Flag #1 : 00000100000001001100000100000000 (0x0404C100) [Entrypoint Section Entropy] : 6.70 (section #0) ".text " | Size : 0x166DF (91871) byte(s) [DllCharacteristics] -> Flag : (0x0000) -> NONE [SectionCount] 4 (0x4) | ImageSize 0x24000 (147456) byte(s) [Export] 100% of function(s) (1 of 1) are in file | 0 are forwarded | 1 code | 0 data | 0 uninit data | 0 unknown | [ModuleReport] [IAT] Modules -> d3d9.dll | KERNEL32.dll | ADVAPI32.dll [Debug Info] (record 1 of 1) (file offset 0x16DA0) Characteristics : 0x0 | TimeDateStamp : 0x46E888A9 (Thu 13th Sep 2007 00:47:37 (GMT)) | MajorVer : 0 / MinorVer : 0 -> (0.0) Type : 2 (0x2) -> CodeView | Size : 0x36 (54) AddressOfRawData : 0x1D2D8 | PointerToRawData : 0x1BED8 CvSig : 0x53445352 | SigGuid 1383BEE1-0556-4DB0-B5D8930F8B72CBF2 Age : 0x5 (5) | Pdb : c:\westwood\renegade\d3d8.pdb [CompilerDetect] -> Visual C++ 8.0 (Visual Studio 2005) [!] File appears to have no protection or is using an unknown protection - Scan Took : 0.211 Second(s) [0000000D3h (211) tick(s)] [246 of 580 scan(s) done]
Scanning -> C:\Program Files\Expansive Civilian Warfare\d3d9.dll File Type : 32-Bit Dll (Subsystem : Win GUI / 2), Size : 170496 (029A00h) Byte(s) | Machine: 0x14C (I386) Compilation TimeStamp : 0x4EE53333 -> Sun 11th Dec 2011 22:48:19 (GMT) [TimeStamp] 0x4EE53333 -> Sun 11th Dec 2011 22:48:19 (GMT) | PE Header | - | Offset: 0x00000100 | VA: 0x10000100 | - [TimeStamp] 0x4EE53333 -> Sun 11th Dec 2011 22:48:19 (GMT) | Export | - | Offset: 0x000267C4 | VA: 0x10027BC4 | - [TimeStamp] 0x4EE53333 -> Sun 11th Dec 2011 22:48:19 (GMT) | DebugDirectory | - | Offset: 0x0000FD84 | VA: 0x10011184 | - [LoadConfig] Struct determined as v8 (Expected size 140 | Actual size 64) [!] Executable uses SEH Tables (/SAFESEH) (9 calculated 9 recorded... 0 invalid addresses) [LoadConfig] CodeIntegrity -> Flags 0x6 | Catalog 0x0 (0) | Catalog Offset 0x555C3A43 | Reserved 0x73726573 [LoadConfig] GuardAddressTakenIatEntryTable 0x4141485C | Count 0x5C49444E (1548305486) [LoadConfig] GuardLongJumpTargetTable 0x75636F44 | Count 0x746E656D (1953391981) [LoadConfig] HybridMetadataPointer 0x69565C73 | DynamicValueRelocTable 0x6C617573 [LoadConfig] FailFastIndirectProc 0x75745320 | FailFastPointer 0x206F6964 [LoadConfig] UnknownZero1 0x30313032 [File Heuristics] -> Flag #1 : 00000100000001001101000100000000 (0x0404D100) [Entrypoint Section Entropy] : 6.65 (section #0) ".text " | Size : 0xF6D5 (63189) byte(s) [DllCharacteristics] -> Flag : (0x0140) -> ASLR | DEP [SectionCount] 5 (0x5) | ImageSize 0x2F000 (192512) byte(s) [Export] 100% of function(s) (8 of 8) are in file | 0 are forwarded | 8 code | 0 data | 0 uninit data | 0 unknown | [ModuleReport] [IAT] Modules -> d3dx9_43.dll | KERNEL32.dll | USER32.dll [Debug Info] (record 1 of 1) (file offset 0xFD80) Characteristics : 0x0 | TimeDateStamp : 0x4EE53333 (Sun 11th Dec 2011 22:48:19 (GMT)) | MajorVer : 0 / MinorVer : 0 -> (0.0) Type : 2 (0x2) -> CodeView | Size : 0x6E (110) AddressOfRawData : 0x26C90 | PointerToRawData : 0x25890 CvSig : 0x53445352 | SigGuid 14025EC5-8B84-4BDC-BEDA3337679779DC Age : 0x6 (6) | Pdb : C:\Users\HAANDI\Documents\Visual Studio 2010\Projects\ShaderInjector\Release\d3d9.pdb [CompilerDetect] -> Visual C++ 10.0 (Visual Studio 2010) [!] File appears to have no protection or is using an unknown protection - Scan Took : 0.261 Second(s) [000000105h (261) tick(s)] [246 of 580 scan(s) done] --- snip ---
Similiar class of bug as:
* bug 14980 ("Wine does not automatically use the riched20 installed by Office 2003/2007/2010/2013/2016")
* bug 25373 ("Nokia S60 5th Edition SDK 1.0: epoc32 emulator and other tools fail to run (Wine's 'hal.dll' is preferred over native, causing failure to load app provided library with same name)")
* bug 29678 ("Multiple application installers report 'OS version is too old, requires Windows 2000 or later' (loader: builtin 'version.dll' vs. private path 'version.dll')(ER Viewer 11, Fetion 2013 January)")
* bug 43472 ("Several apps (R-Link 2 Toolbox/boulangerie patisserie Mavimplant) crash on startup (Wine's 'packager.dll' is preferred over native, causing failure to load app provided library with same name)")
* bug 45551 ("InstallShield exits with 0x80004002, cannot find SECURITY.MySetFileSecurity (Wine's 'security.dll' is preferred over native, causing failure to load app provided library with same name)")
* bug 47053 ("Beat Saber 'BSIPA' injector using Unity Doorstop proxy (.NET 4.6) fails to hook 'winhttp.dll' (Wine's 'winhttp.dll' is preferred over native, causing failure to load app provided library with same name)")
$ sha1sum ExpansiveCivilianWarfareSetup.exe b0ffbf6299dc3b1680e8208ea5da3b08ea5645d8 ExpansiveCivilianWarfareSetup.exe
$ du -sh ExpansiveCivilianWarfareSetup.exe 1.3G ExpansiveCivilianWarfareSetup.exe
$ wine --version wine-4.7-142-g0ece679210
Regards
https://bugs.winehq.org/show_bug.cgi?id=47120
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |http://download.expansiveci | |vilianwarfare.com/Alpha/Exp | |ansiveCivilianWarfareSetup. | |exe Keywords| |download Summary|Expansive Civilian Warfare |Expansive Civilian Warfare |1.0.0.0 fails to start, |1.0.0.0 fails to start, |reports 'there was an error |reports 'there was an error |loading bhs.dll' (Wine's |loading bhs.dll' (Wine's |'d3d8.dll' is preferred |'d3d8.dll' is preferred |over native d3d8->d3d9 |over native d3d8->d3d9 |thunk dll, causing failure) |thunk dll of same name, | |causing failure)
https://bugs.winehq.org/show_bug.cgi?id=47120
pattietreutel katyaberezyaka@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |katyaberezyaka@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=47120
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Expansive Civilian Warfare |Multiple games using W3D |1.0.0.0 fails to start, |engine fail to start, |reports 'there was an error |reporting 'there was an |loading bhs.dll' (Wine's |error loading bhs.dll' |'d3d8.dll' is preferred |(Wine's 'd3d8.dll' is |over native d3d8->d3d9 |preferred over native |thunk dll of same name, |d3d8->d3d9 thunk dll of |causing failure) |same name, causing | |failure)(ECW, Red Alert: A | |Path Beyond)
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
refining summary to collect dupes. There are few other games all based on the W3D engine with same underlying problem.
https://cnc.fandom.com/wiki/Red_Alert:_A_Path_Beyond
--- quote --- Red Alert: A Path Beyond (previously known as RenAlert) is a freeware game based on the W3D engine as was used in Command & Conquer: Renegade which aims to transform the first Red Alert game into a first/third person shooter. It features most of the units from the original game and the two expansions, Counterstrike and The Aftermath. The game was named after A Path Beyond, one of the most popular multiplayer maps of Red Alert.
While it began production as a modification of a commercial single/multiplayer game (then called RenAlert), it is now available as a free, standalone download accessed from within the W3D Hub Launcher (as of version 3.0.0.0). However, it lacks a singleplayer campaign, which was announced for the 3.0 (Delta) release, but was ultimately scrapped.
Additionally, its recommended system requirements are higher than those of Renegade, although the graphics actually scale very well and several improvements made performance improvements over the original base engine thanks to the Scripts project for the W3D Engine. A Path Beyond has been widely promoted by Electronic Arts, in a similar manner to Renegade X. --- quote ---
http://expansivecivilianwarfare.com/
--- quote --- Expansive Civilian Warfare (ECW) is a standalone game that is built off the W3D engine (specifically the version that C&C Renegade used). ... --- quote ---
Also adding stable download link via Internet Archive:
https://web.archive.org/web/20190503192509/http://download.expansivecivilian...
Regards
https://bugs.winehq.org/show_bug.cgi?id=47120
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |emkay@gmx.de
--- Comment #2 from Anastasius Focht focht@gmx.net --- *** Bug 22198 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=47120
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|http://download.expansiveci |https://web.archive.org/web |vilianwarfare.com/Alpha/Exp |/20190503192509/http://down |ansiveCivilianWarfareSetup. |load.expansivecivilianwarfa |exe |re.com/Alpha/ExpansiveCivil | |ianWarfareSetup.exe