/********************************************************************
**
**	VirusTrap.c
**
**	(c) 1988 Eduardo Horvath
**
**	All Rights Reserved
**
**      Permission to copy and distribute free of charge
**
********************************************************************/ 

#include <exec/memory.h>
#include <libraries/dos.h>
#include <functions.h>

/*******************************************************************

   This program checks its own size and reports any changes.

   It should be placed in the first line of s:Startup-Sequence.

********************************************************************/

/*   This was compiled under Aztec C v3.04.  The program size will
       vary according to compiler.  Compile the program, find its
       size, and then replace PROGSIZ.
*/
#define PROGSIZ		5216L


struct FileInfoBlock *fib = NULL, FileInfoBlock[3];

struct FileLock *lock = NULL;


main(argc, argv)
int argc;
char *argv[];
{
int i;

/* Put a lock on this executable file (is stored in argv[0]) */
   lock = Lock(argv[0], ACCESS_READ );

   if(!lock) return(0);

/* Longword Align fib (don't alter mem lists) */
   fib = ((long) &FileInfoBlock[1]) & 0xfffffffc;

   if( !Examine(lock,fib) ) Exit( printf( "Unsuccessful Examine().\n") );;

   if( fib->fib_Size != PROGSIZ )
     printf("Original File Length = %ld\n\
             Current File Length = %ld\n\n\
             WARNING:  POSSIBLE VIRAL INFECTION!!!\n",
             PROGSIZ, fib->fib_Size );

   UnLock( lock );
}
