furrycat's Battlecom pages
Don't use Battlecom; use Teamspeak
Instructions on setting up Battlecom to run as a service under Windows NT/2000 are now available.
Instructions on setting permissions to allow a non-administrator to start and stop the service are now available.
Firewall configuration for Battlecom
Battlecom is a DirectPlay application, so to run either the client or the server you need to allow both incoming and outgoing connections to tcp and udp ports 2300-2400 and 47624. If you are running the server you will need to allow incoming connections to tcp port 40889. If you are running the client you will need to allow outgoing connections to that port.
Here are the ipfilter rules I use:
pass in proto tcp/udp from any to CLIENT 2300 >< 2400
pass in proto tcp/udp from any 47624 to CLIENT
pass in proto tcp from any 40889 to CLIENT
pass in proto tcp/udp from any to CLIENT 47624
pass in proto tcp/udp from any to SERVER 2300 >< 2400
pass in proto tcp/udp from any to SERVER 47624
pass in proto tcp from any to SERVER 40889
Running Battlecom as a service
Windows NT is able to run programs as "services" in the background. A service can run even if no-one is logged on to the computer to control it. Windows 2000 extends this functionality and is capable of restarting services that die.
Normally, software has to be explicitly written to run as a service but Microsoft make available some useful tools that enable you to run pretty much anything as a service.
The following only applies to Windows NT/2000/XP. It will NOT work on Windows 95/98/ME.
What we will do
We will run the Battlecom server as a service. It will keep on truckin' in the background whether we are logged on or not and it will be restarted if (when) it crashes.
Required software
If you haven't already done so, download these:
Battlecom
server
instsrv.exe
srvany.exe
Registry entries
instsrv.exe and srvany.exe are commandline tools from Microsoft that come with the NT resource kit. I recommend downloading them into your C:\WINNT\System32 directory (or more correctly, your %systemroot%\system32 directory) and for the remainder of this article I will assume you have done so.
The procedure
Configure Battlecom
-
The first thing you must do is install and configure the Battlecom server. After it is installed, host a new session. Take this opportunity to set up your server the way you want it. Set the number of players that can connect and create the channels for the server. Remember to set the settings as default when you host the session. Once the session is hosted, stop it immediately and close down Battlecom.
When Battlecom runs as a service it will not appear on the screen, which means you won't be able to see who's connected and, more importantly, you won't be able to configure the session before it starts up. That's why you should configure to your liking now, and that's why I recommend setting a remote administration password, should you later decide you want to add or remove channels, or in case you want to kick players :-)
Create a new service
-
Use the instsrv.exe program to create an entry in the services database for srvany. This is the program that is used to enable arbitrary applications (eg Battlecom) to run as services.
instsrv Battlecom %systemroot%\system32\srvany.exe
Important: You MUST be logged on as a user with administrator privileges when you do this. Furthermore, you might need an account named "Administrator" to exist for it to work. If you have renamed your local administrator account or if your Windows installation is not in English (and hence the Administrator account never was called that) you might have to either create an administrator account named Administrator or rename the local administrator account to Administrator before carrying out the above step. It is safe to delete/rename it back afterwards.
Import the registry entries
-
Simply registering the srvany service isn't enough. I said it can run arbitrary programs. Well we need to tell it to run Battlecom. I've included the necessary registry entries in the bc_server.reg file. If you installed Battlecom in the default location and copied srvany.exe to your System32 directory as recommended, you should be able to just import the registry and go!
The service will be configure to be started at bootup and magically restarted in the event that it dies so you shouldn't have to worry about it again...
Start the service
-
To run the Battlecom service, go to the Services console (under the Control Panel in NT, Control Panel\Administrative Tools in 2000 - or use the Services snap-in to mmc), highlight Battlecom and press start. If you want to stop the service ... well, I'll leave that as an exercise for the reader.
Removing the service
If you decide you no longer want to run Battlecom 24/7, stop it using the Services console and then pull up a command prompt and run:
instsrv Battlecom remove
A more elegant solution would be to change the service's Startup type (double click Battlecom in the console) to Manual, so it will not be started at bootup, and then simply stop it. This way you don't have to go to all the trouble of configuring everything if you decide later that you do want to run it after all.
Server administration
When Battlecom runs as a service it doesn't show up on the screen. If you want change the default settings you must first stop the service, run Battlecom manually, change whatever you wish (setting the new configuration to the default) and finally restart the service.
Delegating control of the service to non-administrators
The main problem with Battlecom running as an NT service is that you need to be an administrator to control it. The following is a way to allow an unprivileged user to start and stop the service.
Assume you created a user called bcadmin. If you wanted trusted friends to be able to control your Battlecom server you could grant this user logon access via Terminal Services. To give the user permission to start and stop the service, you need to set an ACE on the service registry entries. The easiest way to do this is to download subinacl.exe if you don't already have it (it's from the Resource Kit) and run this command:
subinacl /service Battlecom /grant=bcadmin=STOP
Change bcadmin if you chose a different username.
Please note that STOP doesn't mean the right to stop the service. It's the four options S, T, O and P together!
This user can now login and control the service from the services snap-in of mmc or using the Resource Kit tool sc.exe.
To start the service:
sc start Battlecom
To stop the service:
sc stop Battlecom
To query the service:
sc query Battlecom
This is desirable as sometimes Battlecom "half-crashes," leaving itself in a state where the service manager thinks it is still running but the actual program is not working. If you happen to be away/asleep/busy when this happens, your server will be inaccessible. If someone notices and can login as an unprivileged user and fix it, the problem is solved!
Feedback
Send any comments to swat3@furrycat.net.