https://bugs.winehq.org/show_bug.cgi?id=43464
Bug ID: 43464 Summary: Elite Dangerous Horizons fails to connect to server with CRC error Product: Wine Version: 2.13 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: pecisk@gmail.com Distribution: ---
Created attachment 58839 --> https://bugs.winehq.org/attachment.cgi?id=58839 EDH launching trace
Version: Wine 2.13 on Fedora 26 Winetricks: WINE=/usr/bin/win64 ./winetricks dotnet452 corefonts quartz vcrun2012
1. Install ED Launcher wine64 EliteDangerous-Client-Installer.exe 2. Launch ED Launcher wine64 /.wine/drive_c/Program\ Files\ (x86)/Frontier/EDLaunch/EDLaunch.exe 3. Install Elite Dangerous Horizons 4. Press Play
Expected result: EDH main menu appears
Actual result: EDH compiles shaders but gets CRC error for server connection along the way at the left bottom corner. Compiling ends with game showing error message about not being able to verify connection with server.
Note: ED 32-bit version which is separate client, does not receive same error and seems to be connecting to game just fine.
Goal of this bug report to understand what might cause this CRC error.
https://bugs.winehq.org/show_bug.cgi?id=43464
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #1 from Peteris Krisjanis pecisk@gmail.com --- Just for note there are some persistent bugs for winsock there
err:winsock:WSAIoctl -> SIO_ADDRESS_LIST_CHANGE request failed with status 0x2733 err:winsock:WSAIoctl -> SIO_ADDRESS_LIST_CHANGE request failed with status 0x2733 err:winsock:WSAIoctl -> SIO_ADDRESS_LIST_CHANGE request failed with status 0x2733 err:winsock:WSAIoctl -> SIO_ADDRESS_LIST_CHANGE request failed with status 0x2733
However I doubt they are related as they seem to pop up everywhere .Net based launcher is used under Wine.
https://bugs.winehq.org/show_bug.cgi?id=43464
Bronson bronsonmathews@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bronsonmathews@gmail.com
--- Comment #2 from Bronson bronsonmathews@gmail.com --- I can launch the demo under wine staging with graphical issues in the game as there is no online connection in the demo.
However trying to launch the full version the launcher works, but when launching the main game it fails to load. I have the end of my launch log here: https://pastebin.com/Bb9NdFVm
https://bugs.winehq.org/show_bug.cgi?id=43464
Dmitry dz64@protonmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dz64@protonmail.com
--- Comment #3 from Dmitry dz64@protonmail.com --- Created attachment 62042 --> https://bugs.winehq.org/attachment.cgi?id=62042 Part of the log where api.orerve.net was mentioned
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #4 from Dmitry dz64@protonmail.com --- This bug is still present in wine 3.13 and latest game client. It is possible to enable some network debug options in the game by following this guide: https://support.frontier.co.uk/kb/faq.php?id=343
By doing so, I've managed to get a detailed networking log: Webserver request: https://api.orerve.net:443/2.0/elite/user/login?B9cWZt... Plaintext error response: {"errorCode":272,"status":400,"message":"CRC Failed"}
Looks like this CRC Error is the one that appears in game ui. The game tries to access some kind of web-service and gets code 400. I'm not sure but I think 400 stands for malformed request. Maybe the game sends some malformed data to the server?
I've made a detailed debug trace of this issue, but it is too big to attach here. I've cut a part of the trace where api.orerve.net was mentioned. Ignore vulkan calls (i've used DXVK).
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #5 from Dmitry dz64@protonmail.com --- Looks like there might be an issue with crypt32.dll. The game stores MachineToken and Passowrd in C:/users/NAME/Local Settings/Application Data/Frontier_Developments/.../user.config. These are base64 encoded encrypted data. I've got different results in wine and windows. For example my encoded password string is different in wine and it has different length.
Password string in wine: AQAAAFdpbmUgQ3J5cHQzMiBvawABAAAAV2luZSBDcnlwdDMyIG9rAAAAAAACAAAAAAADZgAAqAAAABAAAABXaW5lIENyeXB0MzIgb2sAAAAAAASAAACgAAAAEAAAAMZTrUIhLcQ2XogvufOM8HMYAAAAKN4WBn0sJlao+5xocro4b2YpcX9G6U3CFAAAAL59QokeYiGI/XUmhgEmSFJBwNzT
Password string in windows: AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAhGaLlQ4cK0Oxd+frPJtmlAAAAAACAAAAAAAQZgAAAAEAACAAAAAisyYNXzWpr6jizWw46lePEyFebJwrendc8wI56Ic9igAAAAAOgAAAAAIAACAAAABXpsrFvzeWB3jEUnEayCVd9IGBfpxlcGmW6J3gXjvFQSAAAACqegFnmanMJRLty+K0YmUGu7TKC/fuTRWNskhf0Tfp2UAAAAABQX8EQV628lzC+Coqzurt+eJbTT5GHxHETkzfkou7G2sU63VxeVp6uIAgPS4lflBIG5eZIGAGojuMkfQZ9ezA
(Do not worry about my password, i've already changed it before posting)
I've tried to install crypt32.dll from winetricks but if I use it - launcher crashes.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #6 from Peteris Krisjanis pecisk@gmail.com --- Great find Dmitry. I have long suspected some part of encrypting code with Wine is to blame. It seems you have found core problem.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #7 from Dmitry dz64@protonmail.com --- Now I'm not so sure about crypt32.dll issue. It seems like current implementation of CryptProtectData and CryptUnprotectData is not the same as on windows, but those functions seem to work fine. Seems like the game launcher uses those functions to encrypt and decrypt passwords and machine tokens. Encrypted data is encoded in base64 and stored in user.config file. When launcher needs to access this data it decrypts it without problems.
After setting WINEDEBUG=+crypt I can see when this data is encrypted/decrypted but default debug prints don't show full data array. I need to setup a proper build environment to debug this.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #8 from Dmitry dz64@protonmail.com --- Created attachment 62085 --> https://bugs.winehq.org/attachment.cgi?id=62085 Wireshark capture
I'm trying to understand what this game sends over network. It looks like the game has ssl library inside of it. The game uses winsock 2 for tcp connections, but data is encrypted (http-over-tls). I assume that this data is in JSON format.
Here is my wireshark capture of communication between the game and api.orerve.net.
1. The game connects to the first server. 2. The game sends 92 bytes and receives 200 bytes - this communication seems successful. 3. The game connects to the next server. 4. The game sends 1376 bytes and receives 351 bytes. That 351 seems to be JSON string: {"errorCode":272,"status":400,"message":"CRC Failed"} 5. The game sends 1386 bytes and receives 351 bytes. 6. The game connects to the next server. 7. The game sends 1386 bytes and receives 351 bytes. 8. After that CRC error is displayed in the game window.
https://bugs.winehq.org/show_bug.cgi?id=43464
zzzzzyzz@hacari.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zzzzzyzz@hacari.org
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #9 from Dmitry dz64@protonmail.com --- This might be related - I found that the game generates malformed json in C:/users/username/Saved Games/Frontier Developments/Elite Dangerous/Status.json
Content of this file: { "timestamp":"2018-08-30T16:41:25Z", "event":"Status", "":0 }
The last element in this json is "":0 but it should have been "Flags":0
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #10 from Peteris Krisjanis pecisk@gmail.com --- Dmitry,
I just realized that Win32 version of launcher had interesting similar issue - .NET launcher passed arguments to EDClient.exe and client responded 'Please launch game from launcher'. It tried to pass parameters from launcher, it seems they might be borked there. Win64 responds differently but that might be just way it is checked.
When launching EDClient.exe from launcher, you can check process list and see it is launched with parameters. Those might be culpit.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #11 from Dmitry dz64@protonmail.com --- Launch arguments looks fine. You can launch the game without launcher with this string:
wine64 EliteDangerous64.exe "wseed 9688" "ServerToken [your machineToken] [your authToken] " "/language English\UK"
Seems like those arguments are the same as on windows.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #12 from Dmitry dz64@protonmail.com --- I've done some debugging with the game executable. Here is what I found: 1. The game uses static-linked OpenSSL library for communication. 2. At first the game communicates with some kind of "time api" with a request like this:
GET /2.0/server/time HTTP/1.1 etc...
3. After time request, the game sends something to the "login api". The request looks like this:
GET /2.0/elite/user/login?p6rEJhO8YqpD5q0JKLRBD(long base64 encoded url)... HTTP/1.1 Host: api.orerve.net Accept: */* Retry: 1 User-Agent: EDGame/11.0/Win64 Encrypted: 1 Nonce: f64537d2a3a0edd2
That long encoded url is encoded somewhere in the game, and it looks like the encoded data is malformed. 3. I've tried to run the game under debugger - looks like this is the original string before it is encoded:
terrain=1&season=2&cqcarena=0&language=en&connCap=1&[some unprintable garbage here]&machineId=ef4b8b36ef0c8c78&machineToken=5c6346f307aec7c4781ba9acb0c43d6fcf7dd33f85204a451df098344118c7eb407780336950d4602c8e9f055f924550&authToken=[my auth token]...
The part where unprintable garbage consists of these bytes: 9D 23 C9 0C 65 3D FF FF FF FF
I've had a debugging session where this string "fTime=[FF FF FF FF]" appeared instead of that garbage. Perhaps this is some thread synchronization issue.
I've had some problems with my debugger - the game crashes under debugger. Looks like some kind of memory corruption happened. I want to run the game under valgrind but it seems like something is wrong with my setup - valgrind is crashing every time I try to run it.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #13 from Dmitry dz64@protonmail.com --- I've looked into the game auth protocol, here is how it works:
1. The game builds request string:
terrain=1&season=2&cqcarena=0&language=en&connCap=1&fTime=1535992761&machineId=ef4b8b36ef0c8c78&machineToken=5c6346f307aec7c4781ba9acb0c43d6fcf7dd33f85204a451df098344118c7eb407780336950d4602c8e9f055f924550&authToken=[My auth token here]
2. The string goes through some kind of encryption algorithm. The result is proportional to size of the original string. I cannot identify this algorithm - I need to do some research. 3. The result of encryption is encoded into base64 string. 4. That base64 string is attached as a part of URL for GET request:
GET /2.0/elite/user/login?p6rEJhO8YqpD5q0JKLRBD(long base64 encoded url)... HTTP/1.1 Host: api.orerve.net Accept: */* Retry: 1 User-Agent: EDGame/11.0/Win64 Encrypted: 1 Nonce: f64537d2a3a0edd2
5. The request is sent using SSL_Write from that static-linked OpenSSL library. 6. SSL_Write uses winsock send from wine to send this data. 7. Game server receives this request and responds with code 400. 8. CRC error message is displayed in the game window.
My debugger makes the game fail with segfault sometimes without any reason. Also there are a lot of calls to ntdll around this auth code. Functions like __wine_user_shared_data are called a lot.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #14 from Peteris Krisjanis pecisk@gmail.com --- That's impressive investigative work Dmitry. You have tried to use Windows winsock right? And it didn't help?
I have a feeling that problem is there. It seems process of encrypting that request and sending it should be isolated enough to be valid.
Maybe embedded OpenSSL throws a fit?
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #15 from Dmitry dz64@protonmail.com --- I'm not sure if using windows winsock is possible, how is it going to connect to anything without Linux sockets and the kernel network stuff? I thought that the only reason why wine's winsock implementation works is that it uses Linux sockets inside.
Anyway, I've tried to replace some of the wine's dlls with native ones from winetricks but that didn't help. By the way, here is a full list of dlls used by the game (Not launcher). Ignore all vulkan stuff - i'm using dxvk instead of wined3d because it does initial shader compilation a bit faster.
Z:\ssd\elite\game\elite-dangerous-64\openvr\win64\openvr_api.dll C:\windows\system32\d3d11.dll C:\windows\system32\dxgi.dll C:\windows\system32\opengl32.dll C:\windows\system32\kernel32.dll C:\windows\system32\ntdll.dll Z:\ssd\elite\game\elite-dangerous-64\EliteDangerous64.exe Z:\ssd\elite\game\elite-dangerous-64\portaudio_x64.dll C:\windows\system32\kernelbase.dll C:\windows\system32\api-ms-win-appmodel-runtime-l1-1-2.dll C:\windows\system32\xaudio2_9.dll C:\windows\system32\winepulse.drv C:\windows\system32\mmdevapi.dll C:\windows\system32\ksuser.dll C:\windows\system32\avrt.dll C:\windows\system32\wined3d.dll C:\windows\system32\nvapi64.dll C:\windows\system32\winspool.drv C:\windows\system32\wbemprox.dll C:\windows\system32\api-ms-win-core-sysinfo-l1-2-1.dll C:\windows\system32\api-ms-win-core-localization-l1-2-1.dll C:\windows\system32\uxtheme.dll C:\windows\system32\api-ms-win-core-fibers-l1-1-1.dll C:\windows\system32\api-ms-win-core-synch-l1-2-0.dll C:\windows\system32\winex11.drv C:\windows\system32\setupapi.dll C:\windows\system32\winmm.dll C:\windows\system32\iphlpapi.dll C:\windows\system32\ws2_32.dll C:\windows\system32\dinput8.dll C:\windows\system32\xinput9_1_0.dll C:\windows\system32\dbghelp.dll C:\windows\system32\msvcrt.dll C:\windows\system32\winevulkan.dll C:\windows\system32\oleaut32.dll C:\windows\system32\rpcrt4.dll C:\windows\system32\ole32.dll C:\windows\system32\imm32.dll C:\windows\system32\usp10.dll C:\windows\system32\comctl32.dll C:\windows\system32\advapi32.dll C:\windows\system32\gdi32.dll C:\windows\system32\user32.dll C:\windows\system32\shlwapi.dll C:\windows\system32\shell32.dll C:\windows\system32\vulkan-1.dll C:\windows\system32\aclui.dll C:\windows\system32\version.dll C:\windows\system32\wow64cpu.dll
https://bugs.winehq.org/show_bug.cgi?id=43464
Brendan McGrath brendan@redmandi.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |brendan@redmandi.com
--- Comment #16 from Brendan McGrath brendan@redmandi.com --- I've solved why we get the CRC error (and I have a work-around).
It looks like .NET (which the launcher uses) and the value Wine sees in the registry (which the client uses) are different for the key: \HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid
So the 'machineId' value generated by the launcher and the one sent by the client are different - hence the CRC issue.
The work-around is easy. Just replace the value in the registry of your wine prefix with the one the launcher sees.
To see what the launcher sees, I wrote a simple C-Sharp program: using Microsoft.Win32; using System;
public class HelloWorld { static public void Main () { Console.WriteLine (Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Cryptography").GetValue("MachineGuid").ToString()); } }
and ran it in my wine prefix (you can compile with 'mcs' which is in the 'mono-mcs' package).
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #17 from Brendan McGrath brendan@redmandi.com --- Actually - it turns out there's already an easy way to check the registry values: wine reg query 'HKLM\Software\Microsoft\Cryptography' /v MachineGuid wine64 reg query 'HKLM\Software\Microsoft\Cryptography' /v MachineGuid
On a fresh wine prefix - you can see the 32-bit wine (which is how the Launcher runs) vs. the 64-bit wine (which is how the client runs) get two different values.
It seems you need to add 'Wow6432Node' to the registry path to get a consistent value with wine64: wine reg query 'HKLM\Software\Wow6432Node\Microsoft\Cryptography' /v MachineGuid wine64 reg query 'HKLM\Software\Wow6432Node\Microsoft\Cryptography' /v MachineGuid
My guess is they are suppose to be the same. But I'll investigate and raise an issue (or submit a patch) with wine.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #18 from Gijs Vermeulen gijsvrm@gmail.com --- Is this still an issue after c970b263c0329bcb47d0ea492b823bda7dc7c0f3 and 926dd780697852b375ec0a193c762e7723a3f5e6 ?
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #19 from Brendan McGrath brendan@redmandi.com --- The solution is to run EDLaunch with 'wine64' which became possible in commit 926dd780697852b375ec0a193c762e7723a3f5e6 (available in wine 3.19).
So no, it's no longer an issuer.
https://bugs.winehq.org/show_bug.cgi?id=43464
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |c970b263c0329bcb47d0ea492b8 | |23bda7dc7c0f3 Status|UNCONFIRMED |RESOLVED
--- Comment #20 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to Brendan McGrath from comment #19)
In that case, marking FIXED. Thank you for reporting back.
https://bugs.winehq.org/show_bug.cgi?id=43464
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |advapi32 CC| |focht@gmx.net
https://bugs.winehq.org/show_bug.cgi?id=43464
jens jp7677@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jp7677@gmail.com
--- Comment #21 from jens jp7677@gmail.com --- Thanks a lot for the work here! Will this solution work with SteamPlay/Proton once Proton contains this fix?
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #22 from Brendan McGrath brendan@redmandi.com --- (In reply to jens from comment #21)
Thanks a lot for the work here! Will this solution work with SteamPlay/Proton once Proton contains this fix?
Yes it will. I've rebuilt Proton 3.16 with this patch (and changed the 'proton' python script to launch with 'wine64') and the MachineGuid workaround mentioned above is no longer required.
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #23 from jens jp7677@gmail.com --- (In reply to Brendan McGrath from comment #22)
(In reply to jens from comment #21)
Thanks a lot for the work here! Will this solution work with SteamPlay/Proton once Proton contains this fix?
Yes it will. I've rebuilt Proton 3.16 with this patch (and changed the 'proton' python script to launch with 'wine64') and the MachineGuid workaround mentioned above is no longer required.
Thanks for the confirmation. Cool! So ED wont be running out of the box from a Steam installation, but requires either modifying the proton script (which is not per game but would effect all proton games in a steam installation) or requires the MachineGuid workaround in the ED prefix?
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #24 from Brendan McGrath brendan@redmandi.com --- (In reply to jens from comment #23)
Thanks for the confirmation. Cool! So ED wont be running out of the box from a Steam installation, but requires either modifying the proton script (which is not per game but would effect all proton games in a steam installation) or requires the MachineGuid workaround in the ED prefix?
Yes - there are some other steps required too (like installing .NET). You can get ED running on Proton right now. The best instructions for doing so can be found here: https://github.com/ValveSoftware/Proton/issues/150
https://bugs.winehq.org/show_bug.cgi?id=43464
--- Comment #25 from jens jp7677@gmail.com --- (In reply to Brendan McGrath from comment #24)
(In reply to jens from comment #23)
Thanks for the confirmation. Cool! So ED wont be running out of the box from a Steam installation, but requires either modifying the proton script (which is not per game but would effect all proton games in a steam installation) or requires the MachineGuid workaround in the ED prefix?
Yes - there are some other steps required too (like installing .NET). You can get ED running on Proton right now. The best instructions for doing so can be found here: https://github.com/ValveSoftware/Proton/issues/150
Ok, things are clear now. Thanks for your instructions and thanks again for your work on ED!
https://bugs.winehq.org/show_bug.cgi?id=43464
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #26 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.20.
https://bugs.winehq.org/show_bug.cgi?id=43464
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |3.0.x
https://bugs.winehq.org/show_bug.cgi?id=43464
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.0.x |---
--- Comment #27 from Michael Stefaniuc mstefani@winehq.org --- Removing the 3.0.x milestone from bug fixes included in 3.0.5.