tcbw.net

In for the long haul

User Tools

Site Tools


ta:thirdparty_addons:ta_registry_patcher

TA DirectPlay Windows Registry Patcher

Written to fix problems caused by missing or wrong DirectPlay Windows Registry entries for multiplayer TA.

Those entries are only required when a TA multiplayer game instance is set up thru a game services (i.e. DirectPlay lobby launched). They have no impact on multiplayer games set up from a manually launched totala.exe instance.

Interactive mode commands

In interactive mode a simple command line prompt appears at the end of the list showing the TA directories found. The following inputs are reconized (you have to finalize every input by using the ENTER key):

Command Input Effect
Enter position up to two digits [0-9] Selects one of the directories for further processing. You can use any number in the range of the whole list size even if it refers to a line not visible right know.
f(orward) f Displays the next page of the directory list.
b(ackwards) b Displays the previous page of the directory list.
trim l(eft) l Displays the maximum possible part of a path name too long to fit into a display line beginning at the left end. The left trim truncate indicator >>> will appear at the end of the path to state the fact it has been cut off for display purpose. The left trim option is the default truncate policy and you can use this command to restore it.
trim r(ight) r This is the counter part to the left trim option. Displays the maximum possible part of a path name too long to fit into a display line beginning at the position that allows to output the path from there to its right end. The right trim truncate indicator <<< will appear at the begin of the path to state the the fact it has been cut off for display purpose.
a(bort) a Exits taregfix2 without taking any further actions like checking or updating the DirectPlay registry entries for TA.

Well known TA versions

For the time being taregfix2 recognizes the well known totala.exe versions listed below. The MD5 fingerprints have been computed based on the US version of the basic TA game, TA:CC and TA:BT. In case taregfix2 can't identify a particular totala.exe version it may have been modified by a program other than the TA Demo Recorder version 0.98b5 or 0.99b2 installer or an old BY version of the is still installed. In this case the MD5 fingerprint of the unknown version instead the well known version string will be displayed.

totala.exe MD5 fingerprint Comment
CDE TA 1.0 99b3105c7e7acd3599783a2e0881f741 This version was shipped with the basic game.
CDE TA 3.0 c8053ed575cceee39f3f573f7a9e565d This version was shipped with the TA:CC.
CDE TA 3.0a ddb75b6e06292e49c971ce42325bc562 This version was shipped with the TA:BT.
CDE TA 3.1c f76d367fbbd43008ae04c0f314a61b13 This is the 3.1c patch version. It does differ from the patches made for BY which are often confused with the 3.1c patch because the BY versions are showing a '3' for the leading digit too.
Demo Recorder TA 0.98b5 and 0.99b2 26bfc1b8a59ef28180f0c71fa9457b5b When TA is installed on Windows9x or WindwosME the TA Demo Recorder installers version 0.98b5 and 0.99b2 need to modify the totala.exe file in order to make all of the features work. This is the fingerprint of the CDE TA 3.1c version after it has been modified by a recorder installer. The installers leaves the totala.exe file untouched when running on WindowsNT 4.0 or Windows2000. I guess there is no need to patch the TA engine file on any other real 32bit version of the Windows as well but I haven't tried that out.

Installation

  1. Download taegfix2's installer incarnation taregfix2_setup.exe.
  2. For running the installer incarnation make sure you are logged on with a Windows user account that has Administrator rights.
  3. Run taregfix2.exe either from within a Microsoft cmd.exe command shell console window, the Windows desktop's Start→Run menu or by double clicking on the file in the Windows File Explorer.

The installer incarnation taregfix2_setup.exe will create a copy of itself in the Windows OS system root folder under the runtime incarnation's file name taregfix2.exe. If such a file already exists there then the installer will only overwrite that file when all of the following conditions are fulfilled:

  • The MD5 fingerprint computed for the existing taregfix2.exe runtime instance is on the list of well known taregfix2 versions/MD5 fingerprints pairs hard wired into the installer instance.
  • The computed MD5 fingerprint is associated with a version on the list that is older than the version of the installer instance.

Otherwise the installer instance will assume that a newer or identical version of TAregfix is already installed and will abort the installation,

After taregfix2_setup.exe ran successfully once you can call the run time incarnation taregfix2.exe either directly from the Windows desktop menu Start→Run or a Windows cmd.exe command shell window.

Call syntax

taregfix2 [-c] [-a] [-n] [-d <absolute TA path>]
          [-b <binary>] [-l <command line>] [-f <front end>]
          [-i <IP address> -p <TCP port>]

All parameters are optional and the simplest call format is without any parameter given. This format addresses people who don't want to fiddle around with the command line parameters. For example, if you have only one TA installation on your drive and want a quick Registry fix for it than just call taregfix2 without any switch or parameter. It will automatically locate your TA directory and update the registry without any further user interaction if the following conditions to be true:

  • The switch -a was omitted
  • Only one TA directory was found on the fixed disk drives (the expansion installation backup folders are excluded from the search by default)
  • The totala.exe file in that particular directory could be identified by a well known MD5 fingerprint

Otherwise taregfix2 will come up with a list of TA directories to pick one from for further processing. To avoid the interactive mode the program would enter once it found more than one directory with a totala.exe file use the switch -d. Check and update operations against the registry will then be done without any acknowledgement requests even if the TA version found in <absolute TA path> couldn't be identified by a valid MD5 fingerprint.

-c will cause the explicitly given, implicitly selected or interactively picked TA directory to be checked against the current Registry settings rather than updating the Registry data.

-a is only of interest when <absolute TA path> is omitted. When set directories with the same folder name as the standard backup folders created by the TA expansions installers are not ignored when searching for TA installations. The only two values on the ignore list are currently backup (created by TA:CC) and btbackup (created by TA:BT). So if you have a TA installation residing in a folder named C:\STRANGE\BACKUP you need to use this flag otherwise the search algorithm will ignore a totala.exe file found there. On the other hand sub folders of ignored folders are not excluded from the search. If a TA installation resides in C:\STRANGE\BACKUP\MYTA then the folder is recognized as a valid TA directory even without using the -a switch.

-n avoids the 10 second delay before exiting the program. The delay is active by default in order to give the user enough time to read error or success messages.

-b will put the value <binary> rather totala.exe in the registry entry File. If you omit this switch then taregfix2 will put the default value totala.exe in the registry. A prerequisite is that <binary> resides in the same directory as indicated by the -d switch respective as picked from the TA directory list in interactive mode. A TA game service client program will then run <binary> instead of totala.exe when a game session is launched. Although you can theoretically configure whatever executable file you want for the File registry entry you have to keep in mind that the binary has to be a lobby aware application thus it must call IDirectPlayLobby3::GetConnectionSettings at program startup and has to establish communication with the game service client via the DirectPlay7 Lobby interface once it became aware of a lobby launch. You may want to use this function if you have at least two different versions of totala.exe in the same TA directory under different names and want to switch between them before playing a game service game. For instance if there is a hacked totala_hacked.exe and an original totala.exe in the TA directory d:\games\ta and you want the game service lobby launcher to use totala_hacked.exe rather than totala.exe then call taregfix2 as follows:

taregfix2 -d d:\games\ta -b totala_hacked.exe

-l will put he value <command line> rather than the targefix2 default -c into the registry entry CommandLine. The command line value -c will skip the intro movie when TA is launched. Basically the -l switch allows to configure any command line for <binary> you want.

-f will create a registry entry for Ripple DirectPlay7 lobby launching. <front end> refers to a program residing in the same directory as indicated by the switch -d respective as picked in interactive mode from the TA directory list. Once the value is set in the registry the game service client program won't launch <binary> (default: totala.exe) but <front end>. The difference is that <front end> doesn't need to be a DirectPlay lobby aware application, it can be any simple executable file executing whatever operations you want. As soon as <front end> is done with its prae-launch operations it has to call the actual application, which would usally be totala.exe. For launching the actual application <front end> can use a simple CreateProcess() API call thus it doesn't need to setup any DirectPlay7 communication link between the game service program which started it and the actual application to start. The only prerequisite is that <front end> passes all command line parameters it was launched with to the actual application to be launched except the first one which is its own program name. Passing those parameters is so important because one of them is a special value that will allow the lobby aware child process to establish a direct link to the game service client program thus bypassing its father process <front end> completely. Once the actual application runs it's save to terminate <front end>.

-i and -p allow to send the output the program generates to an echo server that runs on another computer via a TCP connection. This is intended to be used for remote support. It's a one way street (as you will see when you study the source files), there is no way for the echo server to send any data into the other direction. I added this option because I learned that some people have problems to interpret the program output and need to be talked thru the process of fixing the Windows registry, especially if more than one TA installation was found and they get stuck at the selection screen. To display the echo output on the other computer you need to launch an echo server program there that can handle the echoed output taregfix2 streams to the given IPv4 address and TCP port number. I provided a very simple EchoStream server which should be sufficient for use with taregfix2. Since activating the echo interface requires to launch taregfix2.exe with command line switches I also decided to add the option to put the IPv4 echo server address and the TCP port number in a simple text file named taregfix2.cfg. The first line has to contain the IPv4 address, the second line the TCP port number. The file must be placed in the same folder where taregfix2.exe resides in order to be recognized by taregfix2.exe. Do not add the switches -i and -p to the lines in taregfix2.cfg, just put the actual values in. The command line parameters -i and -p have a higher priority than the entries in taregfix2.cfg, thus the file is ignored if the program was called with any of these two parameters.

Be aware that game service client programs might override any of the DirectPlay related registry entries mentioned above at any point in time.

Program exit codes

Some of the exit codes are returned by both incarnations of taregfix2 (the installer taregfix2_setup.exe and the run time taregfix2.exe) others only by one of the two. The Used by column will state which of the incarnations may return which value. All registry entries referred in the table below are located at the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Applications\Total Annihilation

The documented exit codes are only valid for the latest version. Previous versions may return different values.

Value Used by Meaning
0 both incarnations No error occured.
1 taregfix2_setup.exe The OS API call GetWindowsDirectory() failed with an OS error. The program wasn't able to retrieve the path of the OS software root directory. Check the OS error part of the message for more details.
2 taregfix2_setup.exe The OS API call CreateFile() failed with an OS error. The program couldn't open the source file taregfix2_setup.exe when trying to create a copy of that file with the name taregfix2.exe in the Windows OS root folder. Check the OS error part of the message for more details.
3 taregfix2_setup.exe The OS API call CreateFile() failed with an OS error. The program couldn't open the destination file taregfix2.exe when trying to create a copy of taregfix2_setup.exe in the Windows OS root folder. Check the OS error part of the message for more details.
4 taregfix2_setup.exe One of the OS API calls ReadFile() or WriteFile() failed with an OS error. taregfix2_setup.exe could open the source and destination file but wasn't able to copy the complete file over to the Windows OS root folder. Check the OS error part of the message for more details.
51 taregfix2.exe An OS error occurred when the program tried to initialize the TCP/IP interface on the local computer. This error can only occur if the switches -i and -p have been used in order to attempt to redirect the program output to an remote echo server. The error indicates a problem with your local operating system network installation or that taregfix2 requested support for network functions which the TCP socket interface on the local computer can't provide.
52 taregfix2.exe The switch -i was followed by an address parameter that doesn't represent a valid IPv4 address string in dotted format.
53 taregfix2.exe The OS API call socket() failed with an OS error. This can only occure when the switches -i and -p have been provided to contact a remote echo server. Check the OS error part of the message for more details.
54 taregfix2.exe The OS API call connect() failed with an OS error. This can only occure when the switches -i and -p have been provided to contact a remote echo server. This indicates a problem with the remote host represented by the IPv4 address and TCP port you used for the two switches. Check the OS error part of the message for hints why the remote machine could not be connected.
55 taregfix2.exe The OS API call send() failed with an OS error. This can only occure when the switches -i and -p have been provided to contact a remote echo server. This error means that a connection was made and even some data could be sent already but then the connection between the two endpoints suddenly failed.
101 both incarnations The OS API call GetModuleFile() failed with an OS error. The program wasn't able to retrieve the path from where the program was launched. Check the OS error part of the message for more details.
102 both incarnations The program was called by using the wrong syntax. The order of the parameters doesn't matter but certain combinations are not allowed.
103 taregfix2.exe An attempt to open the echo server configuration file taregfix2.cfg lead to an error other than file not found. Check the OS error part of the message for more details.
104 taregfix2.exe A read operation on the successfully opened echo server configuration file taregfix2.cfg failed with an error. Check the OS error part of the message for more details.
105 taregfix2.exe Unexpected end of file marker was encountered when processing the successfully opened echo server configuration file taregfix2.cfg. The file doesn't contain all the expected entries.
201 taregfix2.exe An OS error occurred when retrieving the fixed drive list. Check the OS error part of the error message for possible reasons.
202 taregfix2.exe The fixed drive list was too long to fit in the buffer taregfix2 provides. The buffer can hold a maximum of 27 drive letters.
205 taregfix2.exe No folder containing a totala.exe file could be found when searching the fixed drives. This error can only occure when <absolute TA path> is omitted. Maybe the -a switch has to be used to make taregfix2 expand its folder name search namespace.
301 taregfix2.exe An OS error occurred when taregfix2 tried to open a totala.exe file for MD5 fingerprint verification. Using the <absolute TA path> call syntax with a folder containing no totala.exe file in it will cause this error too. Check the OS error part of the error message for more details.
401 taregfix2.exe The program can only maintain up to 99 directories containing a totala.exe file. This boundary has been crossed.
402 taregfix2.exe The program switched to interactive mode because the user had to make a choice between different possible TA installation folders and the user has picked the abort option.
501 taregfix2.exe OS API call CreateFile() failed when probing existence of <absolute TA path>\<binary>. Check the OS error part of the message for more details.
502 taregfix2.exe OS API call CreateFile() failed when probing existence of <absolute TA path>\<front_end>. Check the OS error part of the message for more details.
503 taregfix2.exe An OS error occurred in check mode (switch -c set) when the program tried to access a Windows registry key object itself (not one of it's value strings). Check the OS error part of the message for more details.
504 taregfix2.exe An OS error occurred in check mode (switch -c set) when the program tried to access one of the registry values Guid, File, CommandLine, Path, CurrentDirectory or Launcher. Check the OS error part of the message for more details.
505 taregfix2.exe The program runs in check mode (switch -c set) and the validation of the registry entries failed. That means at least one of the expected registry entries does not exist, is not of type type string, contains an unexpected value or the entry Launcher exists although it shouldn't be there.
506 taregfix2.exe An OS error occurred in update mode when the program tried to create or access the registry key object itself (not one of it's value strings). Check the OS error part of the message for more details.
507 taregfix2.exe An OS error occurred in update mode when trying to create or update one of the registry values Guid, File, CommandLine, Path, CurrentDirectory, Launcher. Check the OS error part of the message for more details.
508 taregfix2.exe An OS error occurred in update mode when trying to delete an existing value entry for the registry entry Launcher. The program attempts to remove an existing value entry for Launcher if the -f switch wasn't set and such an entry already existed. Check the OS error part of the message for more details.

Version overview

From version 1.0.2.0 on two manifestations of the same binary file exist: taregfix2_setup.exe and taregfix2.exe. Since it's the same binary file just carrying a different name the MD5 fingerprint for both instances has to be the same. All Windows registry values referred in the sections below are located at the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Applications\Total Annihilation

If you have no access to a MD5 checksum computing tool you can download md5.exe. The md5.exe sources are also available.

Version 1,0,4,1

build date 2010-12-28
MD5 fingerprint 8a1b893b8aaaa5035ca9268291c1ac2d
  • Fixed a bug in installer instance code that caused the program to crash when running under Windows Vista or Windows 7.
  • Binary now linked against static CRT libraries to avoid problems with missing Microsoft CRT DLLs.
  • Added Project files for Microsoft Visual Studio 2010.

Version 1,0,4,0

build date 2009-10-11
MD5 fingerprint 8ac20374165ba7f171710cc0a2f4a7c7
  • TA installation search process is now more error tolerant: the program will no longer abort execution when a folder entry can't be accessed. Instead such an entry is skipped and processing continues with the next one. At the end of the search process the names of the skipped entries and the reasons why they have been skipped (i.e. the OS error encountered when trying to access the entry's data) are displayed.
  • Source code adapted so it can be compiled using Microsoft Visual Visual Studio 2008 C++.

Version 1,0,3,1

build date 2003-05-11
MD5 fingerprint 1ebe33db59c03cb8d7fa3d3d9f5122d7
  • Call parameter processing is skipped for the installer front end manifestation now.
  • Fixed severe bug in EchoStream interface that could cause the program to hang in cdiag output. Althought the bug could theoretically affect any application using the cdiag template it seems that to trigger it certain timing conditions had to be fulfilled as well.
  • Exit codes changed due to revision of shared sources for the Installer and EchoManager classes.

Version 1,0,3,0

build date 2003-05-04
MD5 fingerprint 731b80e3ac486ee2f1c19295bd14ca89
  • The registry entries File, CommandLine and Launcher can now be customized too by using the new switches -b, -l and -f.
  • In check mode missing Windows registry values are now treated as 'logical' errors and won't lead to an exception throw until the complete set of entries is validated.

Version 1,0,2,1

build date 2002-06-01
MD5 fingerprint e67612122934de6a6bff60c7c47f4f04
  • When running on WindowsME taregfix2_setup.exe reported 'file does not exist' after copying the program into the Windows OS folder when no previous version was found. It turned out that WindowsME doesn't reset the GetLastError() state state before executing the OS API call ReadFile() while Windows2000 does. This lead to a wrong interpretation of the current error state after leaving the copy loop. Fixed by using the API call result values of ReadFile() and WriteFile() rather than relying on GetLastError().

Version 1,0,2,0

build date 2002-06-01
MD5 fingerprint e5a04e3a4ec787f65c583251cc61c6b0
  • Split program into installer and run time manifestation. Actually it's the same binary file but different program names will make it act different.
  • -i and -p switches for echo server can be replaced by entries in the file taregfix2.cfg. The IPv4 address has to be stored as dotted string in the first line of the text file, the TCP port number in the second line of the file. The switches -i and -p must not appear in this file.

Version 1,0,1,0

build date 2002-05-31
MD5 fingerprint d2fb3b463e4faedc8fb960227fd6eba5
  • Added interface to echo console output on a TCP stream.
  • Running instance is copying its own binary file into the Windows OS system folder now if no taregfix2.exe file can be found there. If such a file exists and if it's recognized as an older version it will be overwritten with the binary file of the running version.

Version 1,0,0,3

build date 2002-01-20
MD5 fingerprint ee95372c0e977e9a8dc96e586b9f8d8d
  • Replaced for( … ) loops in md5.c with memcpy() and memset() as recommended (though calculation speed of MD5 fingerprints wasn't a performance issue even with the loops).
  • Removed superfluous totala.exe string from registry command line entry. The command line now contains only the -c switch to suppress the intro movie when TA is launched.
  • Using the more accurate label '3.1c' in the patch identify string now rather than the fuzzy '3.1' label which is likely to get mixed up with BY patch versions.
  • Removed last wait counter output from screen before exiting the program.

Version 1,0,0,2

build date 2002-01-09
MD5 fingerprint eb3bd6cea4b53ce23c9ba9e9e19e9d4a
  • For Windows 2000: Excluded OS folder System Volume Information owned by OS user account system from TA folder search in order to avoid program abortion due to access denied OS error.

Version 1,0,0,1

build date 2001-12-11
MD5 fingerprint e1e06b23bec89b62b5f380b40c7f91c7
  • File version info added by providing a resource file.
  • Rebuilt binary using Microsoft Visual C++ 6.0 SP5. Since with 6.0 SP5 the C++ stream STL implementation finally work as supposed to I got rid of the old C style stream read API.

Version n/a

build date 2001-12-10
MD5 fingerprint 9136ee0b8b2809772d2f46e6df5f1990
  • Initial public build.

Source code

taregfix2's source code is available for download. The source package is suited for use with Microsoft Visual Studio C++ 2008 and 2010.

ta/thirdparty_addons/ta_registry_patcher.txt · Last modified: UTC 2016-02-14 10:46 by tcbw