Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 8:48 am
All times are UTC + 0
Adapting the WSOCK32.DLL LAN patch for your mod project
Moderators: Global Moderators, Tiberian Sun Moderators
Post new topic   Reply to topic Page 1 of 1 [6 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Sun Jun 01, 2008 11:05 pm    Post subject:  Adapting the WSOCK32.DLL LAN patch for your mod project
Subject description: when you got a custom exe file
Reply with quote  Mark this post and the followings unread

This tutorial requires basic knowledge of hexadecimal numbers & the use of a hex editor

Most of you probably heard by now that Scorpio9a released a patch that enables TS & RA2 LAN on Vista, and which is incredibly useful on XP too since it removes the need to install the IPX protocol. If you haven't, get up to date

Now, one of the problems with this patch is that it replaces a standard Windows library, and for that reason, Scorpio9a seems to have built in a check to make sure the program calling it is actually TS, RA2 or YR. This patch simply checks if the program is either "game.exe" or "gamemd.exe".

This obviously means adapted and renamed exes used for mod projects can't use it.


Here's the fix:


1. Open wsock32.dll in a hex editor.

Shouldn't be too hard. Lots of those are up for download for free.


2. Disable game/gamemd.exe check:

There are two ways to do this... one is to disable the exe filename checks altogether. The second is to make it only run with your exe name.

Go to offset 0x8A5.


To disable the exe check completely, change the byte "74" there to "EB". Save and exit, you're done.



================================================================
Upon further investigation, the next part of the tutorial is actually completely useless.
If you want to make the dll run only with your exe name, feel free to continue though.
================================================================


To check on your own exe instead, change the bytes there from "74 15" to "75 BF". This will make sure it only checks for "game.exe", and no longer does the check for gamemd.exe. The reason I do this is because that means that you can use the space taken by the "gamemd.exe" string to make the original "game.exe" string replacement a lot longer than the original 8 characters, by overwriting the space used by the (now unused) "gamemd.exe" string Wink


3. Replace the string:

Go to offset 0x828C. You'll see the string "\game.exe" there, followed by "\gamemd.exe".
You can replace the data behind the first "\" (starting with "game.exe") by anything you want, as long as you make sure that you
A. NEVER add new bytes in between; always overwrite existing ones
B. Make sure there is a 00 byte behind your new string
C. don't overwrite the letter "H" behind the gamemd.exe string. The space of gamemd.exe itself can be overwritten completely though, but stop before the 00-byte right before that "H".

This means your exe file's name can be up to 26 characters (including the .exe part, of course)




4. Set the length of your exe name:

There is a hardcoded value which determines how long the exe string is, so unless your own exe file is exactly 8 characters long just like "game.exe", you need to adjust that.

Go to address 0x894.

The value to put there takes a bit of calculation, though you can easily do that with the Windows calculator if you put it on Scientific mode, and then on hexadecimal mode.

The value to put there is:
100h - ([length of exe name]+1)

So for my example string ("Return of the dawn.exe"), the length is 22 (16h), meaning this becomes:
100h - (16h+1) = 100h - 17h = E9h

(the +1 is simply because the actual string has a "\" added before it, and is thus one byte longer than the exe filename)


(the first marked byte is the one with the string size. The second is the one changed in part #1)


Save and exit, and the LAN patch should work on your mod exe Smile


Key Words: #Tutorials #Modding #TiberianSun #Firestorm #ExeHack #HexEdit 

_________________

Last edited by Nyerguds on Tue Apr 12, 2011 6:57 am; edited 9 times in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
IcySon55
Commander


Joined: 19 Nov 2003
Location: Overworld

PostPosted: Mon Jun 02, 2008 6:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Thank you Nyerguds. I have successfully hacked the dll to work with Taktics.exe Very Happy

_________________

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account
Jeffman12
Vehicle Driver


Joined: 19 Jan 2004

PostPosted: Mon Jan 18, 2010 5:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

I know this is an old thread, but I might be able to save everyone this step if I am given a source file, and maybe told the language.

Back to top
View user's profile Send private message Send e-mail
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Mon Jan 18, 2010 6:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, i wrote a little byte hack some time ago and forgot about it. Just found it and updated it a little. Someone give this a try, it should not check the requisite application filename at all...

Credit to el'Scorpio9a for the orignal.



lanpatch_1_00_hyper.rar
 Description:

Download
 Filename:  lanpatch_1_00_hyper.rar
 Filesize:  19.28 KB
 Downloaded:  547 Time(s)


Back to top
View user's profile Send private message
Nyerguds
General


Joined: 24 May 2004
Location: Flanders (Be) Posts:300000001

PostPosted: Tue Apr 12, 2011 6:43 am    Post subject: Reply with quote  Mark this post and the followings unread

I just realized I made a stupid mistake in this guide...

The only thing needed from al this is the first byte change ("74" to "EB" at 0x8A5). It doesn't just jump over the gamemd.exe check, but by doing so it also ignores the result of the first check #Tongue

I adapted the tutorial to show the correct hack for checking your mod name, but overall this is pretty useless; just the change to EB does the trick.


Hyper: Huh, why is the file size of your version different?

_________________

Last edited by Nyerguds on Tue Apr 12, 2011 1:17 pm; edited 1 time in total

Back to top
View user's profile Send private message Visit poster's website Skype Account
Reaperrr
Commander


Joined: 26 Apr 2003
Location: Somewhere in Germany

PostPosted: Tue Apr 12, 2011 11:54 am    Post subject: Reply with quote  Mark this post and the followings unread

Nyerguds wrote:

Hyper: Huh, why is the file size of your version different?

Last time I tried Hyper's version it made the game crash, so I guess something went wrong when he made it.

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [6 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1899s ][ Queries: 13 (0.0108s) ][ Debug on ]