Joined: 24 May 2004 Location: Flanders (Be) Posts:300000001
Posted: 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
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
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
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...
Joined: 24 May 2004 Location: Flanders (Be) Posts:300000001
Posted: Tue Apr 12, 2011 6:43 am Post subject:
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
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 QUICK_EDIT
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