[comp.sys.ibm.pc] GT1300 fix

david@squid.UUCP (12/22/87)

From squid!david Sun Dec 20 20:45 CDT 1987 remote from occrsh
Subject: GT1300 fix

When GT1300 is run for the 150th time (and after), it displays this msg:

   You should register this program.  You use it alot!

   This program can be run a limited number of times.
   Registration entitles you to unlimited use!

   Strike any key...

That's not so bad. But what it does next, is to clear the screen, print:

   LOCKED pending program registration.

...and *CRASHES* your system!!

A friend of mine was trying to use it with a multitasking system that
had a networked bbs running on the other side. When GT locked up, a
number of the bbs files were left in an indeterminate state, which
caused an evening's worth of downtime, the loss of some important files,
and a whole lot of unnecessary hassles.

GT1300 keeps track of the number of times it has run in a control field
in the dialing directory. You may hit upon this bogus little trap,
without any warning, by using a copy of someone else's dialing
directory, where your friend may have already used up most of the
alotted rounds before passing it over to you. Or, like me, you may spend
a LOT of tries by trying to set it up to work properly with some funky,
off-brand modem.

There's a word for programmers who put potentially dangerous trapdoors
into their software, but I'll not use that kind of language here....

The following simple C program, when run on a regular basis, like, from
an AUTOEXEC batch, will prevent GT1300's trojan trapdoor from ever
activating. It does this by setting 3 control bytes in the dialing
directory to the values they had when the GT.DIR file was first created.
Do not use this program with dialing dirs created with any other version
of GT.

#include <fcntl.h>  /* temporary fix for GT1300 */
#include <stdio.h>  /* using turbo-c            */
struct {
  long offset ; char value ; } fix[3] = {
  {         1 ,        149   } ,
  {       130 ,          3   } ,
  {       132 ,        106   }
} ;
char dirname[13] = "GT.DIR" ;

main( int argc, char *argv[] )
{
  int x, gtdir ;
  char *dot ;
  if( argc>1 ) {                   /* default dir is GT.DIR.  */
    strcpy( dirname, argv[1] ) ;   /* others may be specified */
    if( !strchr( argv[1], '.' ) )  /* on the command line     */
      strcat( dirname, ".DIR" ) ;
  }
  if( -1 == ( gtdir = open( dirname, O_BINARY | O_RDWR ) ) ) {
    printf( "\nError opening %s. Not updated.\n", dirname ) ;
  }
  else
  {
    for( x=0; x<3; ++x ) {
      lseek( gtdir, fix[x].offset, SEEK_SET ) ;
      write( gtdir, &fix[x].value, 1 ) ;
    }
    close( gtdir ) ;
    printf( "GT dialing directory %s restored.\n", dirname ) ;
  }
} /*** end of GT-FIX.C ***/