Red alert 2 network play

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Red alert 2 network play

Post by nicolo.p »

Hi to everybody,
I'm writing to ask your help in playing LAN games with Red alert 2.

some data: I'm using wine 1.2.1 on Ubuntu 10.04, with kernel 2.6.32-27-generic
the game is Red alert 2, with patch 1.006.

What I would like to do is playing LAN games, using the UDP patch given at understorm at http://www.understorm.net/downloads/ts_ ... h_1_00.zip
What I made is copy the wsock32.dll file in the same directory where the Ra2.exe file is (the name of the executable file I play with), but it doesn't seem to work (it should, since I know for sure the patch runs on Windows, and I've heard about other people, in other posts in this forum, that in the end succeded in playing this way.)

What I thought to do is run as root, add an overwrite rule in winecfg for native-then-integrate, viceversa or disable, but none of these seems to work.

Does anybody know how to solve this problem?

Thanks for your help, N
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Red alert 2 network play

Post by vitamin »

nicolo.p wrote:What I made is copy the wsock32.dll file in the same directory where the Ra2.exe file is
You can't override Wine dlls that easily. The technique this custom wsock32.dll use won't work on Wine.
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

That's exactly what I'm asking about.
As discusse in these 2 posts, this kind of technique should work

http://forum.winehq.org/viewtopic.php?t ... =red+alert
http://forum.winehq.org/viewtopic.php?t ... =red+alert

but I don't know the exact details (I'm just putting in my doubts, and I'm sorry for my possible ignorance):
- do I need to compile my own wine, or the Ubuntu pre-compiled one is enough?
- do I have to do something as root?
- as regards the override of the dll, what should be done other than putting it in the game's directory, in order to make it work properly?

thanks, N
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

nicolo.p wrote:That's exactly what I'm asking about.
And that's exactly what I told you. Wine has a specific limitation on what dll can be (native or built in). It applies for the entire process. You can't load native dll and then import built in from it (exactly what this wsock32.dll tries to do). Unless you change the name of the built in dll, and modify wrapper dll to load that new dll instead.
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

Ok, then can you tell me the exact steps I have to go through, to make it work? The only thing I know, is that this is a modified version (from understorm.net) of a dll.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

nicolo.p wrote:The only thing I know, is that this is a modified version (from understorm.net) of a dll.
Then why don't you ask them about how to use it in Wine. If this is a windows version it can not work in Wine.
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

this is a windows dll, in the sense that in its read me says

============================================

Tiberian Sun / Red Alert 2 LAN Patch

v1.00

by Scorpio9a

============================================



.:: Release Notes ::.



This patch allows you to play TS and RA2 over LAN on Windows 2000 and above.

The patch makes use of the UDP protocol instead of IPX which no longer requires you to have IPX installed.



Supported Operating Systems by this release of the multiplayer patch:

Windows 2000, Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008.



For the latest version and tutorials check http://www.understorm.net/



.:: Installation ::.



Extract the files in your Tiberian Sun or/and Red Alert 2 directory.
--

I've asked here because the issue regards wine and this dll, not the dll itself in interacting with windows, and because I'm pretty sure (from reading the above posts) there's someone here who made it work in the end.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

nicolo.p wrote:I've asked here because the issue regards wine and this dll, not the dll itself in interacting with windows
And I answered that what this dll is doing will not work on Wine without that dlls modification. There is no work around it. It's currently impossible on Wine.
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

ok, but then how do you explain the last post here
http://forum.winehq.org/viewtopic.php?t=3650

I've also emailed the author, and he confirmed me the only thing he did was put the modified dll in the game folder and add an overwrite rule for native in winecfg. Maybe it's due to the use of a different version of wine..
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

nicolo.p wrote:ok, but then how do you explain the last post here
You are welcome to try that yourself and let us know if it worked or not.
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

To me, it's not working, and I guess it's due to my using a different wine version or not having the correct settings.

I don't know if these can help in finding an answer..
---
nicolo@studio:~$ winedump -j import /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll
Contents of /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll: 49664 bytes

Import Table size: 0000003c
offset 0000859c WS2_32.dll
Hint/Name Table: 000096C4
TimeDateStamp: 00000000 (Thu Jan 1 01:00:00 1970)
ForwarderChain: 00000000
First thunk RVA: 000080EC
Ordn Name
40 WSAEnumProtocolsA 9710
115 <by ordinal>
70 WSARecvFrom 9702
21 <by ordinal>
2 <by ordinal>
7 <by ordinal>
82 WSASocketA 96f4
76 WSASendTo 96e8

offset 000085b0 KERNEL32.dll
Hint/Name Table: 000095D8
TimeDateStamp: 00000000 (Thu Jan 1 01:00:00 1970)
ForwarderChain: 00000000
First thunk RVA: 00008000
Ordn Name
614 GetTickCount 9960
678 HeapSize 9b60
739 LCMapStringW 9b50
737 LCMapStringA 9b40
576 GetStringTypeW 9b2e
500 GetModuleFileNameA 9730
429 GetCurrentThreadId 9754
367 GetCommandLineA 976a
505 GetModuleHandleW 977c
544 GetProcAddress 9790
1076 TlsGetValue 97a2
1074 TlsAlloc 97b0
1077 TlsSetValue 97bc
1075 TlsFree 97ca
704 InterlockedIncrement 97d4
1004 SetLastError 97ec
486 GetLastError 97fc
700 InterlockedDecrement 980c
673 HeapFree 9824
1057 Sleep 9830
260 ExitProcess 9838
1000 SetHandleCount 9846
571 GetStdHandle 9858
471 GetFileType 9868
569 GetStartupInfoA 9876
190 DeleteCriticalSection 9888
330 FreeEnvironmentStringsA 98a0
447 GetEnvironmentStrings 98ba
331 FreeEnvironmentStringsW 98d2
1146 WideCharToMultiByte 98ec
449 GetEnvironmentStringsW 9902
671 HeapCreate 991c
672 HeapDestroy 992a
1111 VirtualFree 9938
852 QueryPerformanceCounter 9946
426 GetCurrentProcessId 9970
591 GetSystemTimeAsFileTime 9986
751 LeaveCriticalSection 99a0
217 EnterCriticalSection 99b8
347 GetCPInfo 99d0
338 GetACP 99dc
531 GetOEMCP 99e6
731 IsValidCodePage 99f2
669 HeapAlloc 9a04
1108 VirtualAlloc 9a10
676 HeapReAlloc 9a20
1165 WriteFile 9a2e
1069 TerminateProcess 9a3a
425 GetCurrentProcess 9a4e
1086 UnhandledExceptionFilter 9a62
1045 SetUnhandledExceptionFilter 9a7e
721 IsDebuggerPresent 9a9c
753 LoadLibraryA 9ab0
693 InitializeCriticalSectionAndSpinCount 9ac0
914 RtlUnwind 9ae8
488 GetLocaleInfoA 9af4
573 GetStringTypeA 9b06
794 MultiByteToWideChar 9b18


Done dumping /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll
---
nicolo@studio:~$ winedump -j export /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll
Contents of /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll: 49664 bytes

Exports table:

Name: wsock32.dll
Characteristics: 00000000
TimeDateStamp: 4837D947 Sat May 24 11:00:55 2008
Version: 0.00
Ordinal base: 1
# of functions: 1111
# of Names: 0
Addresses of functions: 00009B98
Addresses of name ordinals: 00000000
Addresses of names: 00000000

Entry Pt Ordn Name
0000AEA2 1 <by ordinal> (-> ws2_32.accept)
000012C0 2 <by ordinal>
0000AEB0 3 <by ordinal> (-> ws2_32.closesocket)
0000AEC3 4 <by ordinal> (-> ws2_32.connect)
0000AF0F 5 <by ordinal> (-> ws2_32.getpeername)
0000AF7A 6 <by ordinal> (-> ws2_32.getsockname)
00001000 7 <by ordinal>
00001310 8 <by ordinal>
00001320 9 <by ordinal>
0000AF8D 10 <by ordinal> (-> ws2_32.inet_addr)
0000AF9E 11 <by ordinal> (-> ws2_32.inet_ntoa)
0000AFAF 12 <by ordinal> (-> ws2_32.ioctlsocket)
0000AFC2 13 <by ordinal> (-> ws2_32.listen)
00001310 14 <by ordinal>
00001320 15 <by ordinal>
0000AFD0 16 <by ordinal> (-> ws2_32.recv)
00001090 17 <by ordinal>
0000AFDC 18 <by ordinal> (-> ws2_32.select)
0000AFEA 19 <by ordinal> (-> ws2_32.send)
00001330 20 <by ordinal>
00001070 21 <by ordinal>
0000AFF6 22 <by ordinal> (-> ws2_32.shutdown)
000013C0 23 <by ordinal>
0000AED2 51 <by ordinal> (-> ws2_32.gethostbyaddr)
0000AEE7 52 <by ordinal> (-> ws2_32.gethostbyname)
0000AF22 53 <by ordinal> (-> ws2_32.getprotobyname)
0000AF38 54 <by ordinal> (-> ws2_32.getprotobynumber)
0000AF50 55 <by ordinal> (-> ws2_32.getservbyname)
0000AF65 56 <by ordinal> (-> ws2_32.getservbyport)
0000AEFC 57 <by ordinal> (-> ws2_32.gethostname)
0000ADB2 101 <by ordinal> (-> ws2_32.WSAAsyncSelect)
0000AD00 102 <by ordinal> (-> ws2_32.WSAAsyncGetHostByAddr)
0000AD1D 103 <by ordinal> (-> ws2_32.WSAAsyncGetHostByName)
0000AD58 104 <by ordinal> (-> ws2_32.WSAAsyncGetProtoByNumber)
0000AD3A 105 <by ordinal> (-> ws2_32.WSAAsyncGetProtoByName)
0000AD95 106 <by ordinal> (-> ws2_32.WSAAsyncGetServByPort)
0000AD78 107 <by ordinal> (-> ws2_32.WSAAsyncGetServByName)
0000ADC8 108 <by ordinal> (-> ws2_32.WSACancelAsyncRequest)
0000AE40 109 <by ordinal> (-> ws2_32.WSASetBlockingHook)
0000AE71 110 <by ordinal> (-> ws2_32.WSAUnhookBlockingHook)
0000AE14 111 <by ordinal> (-> ws2_32.WSAGetLastError)
0000AE5A 112 <by ordinal> (-> ws2_32.WSASetLastError)
0000ADE5 113 <by ordinal> (-> ws2_32.WSACancelBlockingCall)
0000AE2B 114 <by ordinal> (-> ws2_32.WSAIsBlocking)
00001410 115 <by ordinal>
0000AE02 116 <by ordinal> (-> ws2_32.WSACleanup)
0000AE8E 151 <by ordinal> (-> ws2_32.__WSAFDIsSet)
00001170 1111 <by ordinal>

Done dumping /home/nicolo/.wine/drive_c/Westwood/RA2/wsock32.dll
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Post by vitamin »

nicolo.p wrote:To me, it's not working, and I guess it's due to my using a different wine version or not having the correct settings.
Have you actually set wsock32.dll to native in winecfg?
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

yes, but it's as if the dll were not in the folder, i.e. I can put the overwrite rule (with consequent warning message) but then in the game network menu I don't get the address 00 00... in the network card, as in the immage posted in this mail list 2 years ago (see above) by Christoph Korn, whom I also contacted via mail some time ago and who said me he just did what I did, maybe with a different wine version or some setting he missed to tell me..
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

Post by nicolo.p »

That's what Christoph Korn, the guy who managed to play this way, told me
I have created an overwrite rule for wsock32 in winecfg to use the native version. And have the attached dll in my game directory
(...) afair I just put that dll there and created an overwrite rule.
I don't know under which version I tested it and currently I do not have the game anymore and no network to test it with. Sorry :/
Afaik I did not run wine as root.
Does anyone know if in recent wine versions something has been introduced preventing from doing this?
nicolo.p
Level 2
Level 2
Posts: 10
Joined: Fri Dec 24, 2010 6:10 pm

SOLVED

Post by nicolo.p »

Thanks to Gert van den Berg, I found out using WINEDEBUG=+loaddll that the overwriting rule for native has to be put not for Ra2.exe (which I play with), but for game.exe; in this way I get

Code: Select all

trace:loaddll:load_native_dll Loaded L"C:\\Westwood\\RA2\\WSOCK32.dll" at 0x10000000: native
instead of

Code: Select all

trace:loaddll:load_builtin_dll Loaded L"C:\\windows\\system32\\wsock32.dll" at 0x68920000: builtin
Thanks to everybody for your help,
regards, N
joem
Level 1
Level 1
Posts: 5
Joined: Wed Aug 17, 2011 2:06 am

Re: SOLVED

Post by joem »

nicolo.p wrote:Thanks to Gert van den Berg, I found out using WINEDEBUG=+loaddll that the overwriting rule for native has to be put not for Ra2.exe (which I play with), but for game.exe; in this way I get

Code: Select all

trace:loaddll:load_native_dll Loaded L"C:\\Westwood\\RA2\\WSOCK32.dll" at 0x10000000: native
instead of

Code: Select all

trace:loaddll:load_builtin_dll Loaded L"C:\\windows\\system32\\wsock32.dll" at 0x68920000: builtin
Thanks to everybody for your help,
regards, N
Thank you too. You've saved hours of searching the net for me.
Roho
Newbie
Newbie
Posts: 4
Joined: Mon Aug 22, 2011 2:56 am

Post by Roho »

To add. Try using RA2 patch that makes the game use UDP instead of IPX.
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

Note IPX networking works fine (if set up properly on Linux) through Wine for RA2. There's one big down side you need root permissions since raw sockets are needed. Through posix file capabilities the need for root could be eliminated.
Locked